<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">This is how we do it in perl with ESL... it should be very similar in Ruby. You shouldn't have to manually use sendmsg if you tie the fd from the socket to ESL like we do in perl.<div><br></div><div>/b</div><div><br><div><br></div><div><div>require ESL;</div><div>use IO::Socket::INET;</div><div><br></div><div>my $ip = "127.0.0.1";</div><div>my $sock = new IO::Socket::INET ( LocalHost => $ip, LocalPort => '8040', Proto => 'tcp', Listen => 1, Reuse => 1 );</div><div>die "Could not create socket: $!\n" unless $sock;</div><div><br></div><div>for(;;) {</div><div> my $new_sock = $sock->accept();</div><div> my $pid = fork();</div><div> if ($pid) {</div><div> close($new_sock);</div><div> next;</div><div> }</div><div><br></div><div> my $host = $new_sock->sockhost();</div><div> my $fd = fileno($new_sock);</div><div> </div><div> my $con = new ESL::ESLconnection($fd);</div><div> my $info = $con->getInfo();</div><div><br></div><div> print $info->serialize();</div><div><br></div><div> my $uuid = $info->getHeader("unique-id");</div><div><br></div><div> $con->execute("answer", "", $uuid);</div><div> $con->execute("playback", "/ram/swimp.raw", $uuid);</div><div><br></div><div> close($new_sock);</div><div>}</div><div><br></div><div><br></div><div><br></div><div><div>On May 3, 2009, at 4:00 PM, Diego Viola wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="color: rgb(0, 0, 0); ">Yep, it works Guido.<br><br>require 'socket'<br><br>server = TCPServer.new(8084)<br>loop do<br> con = server.accept<br> con.puts "connect\n\n"<br> con.puts "sendmsg\ncall-command: execute\nexecute-app-name: answer\n\n"<br> con.puts "sendmsg\ncall-command: execute\nexecute-app-name:<br>playback\nexecute-app-arg: tone_stream://%(10000,0,350,440)\n\n"<br>end<br><br>Thanks for the tip =D</span></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Brian West</div><div><a href="mailto:brian@freeswitch.org">brian@freeswitch.org</a></div><div><br></div></div></span>-- Meet us at ClueCon! <a href="http://www.cluecon.com/">http://www.cluecon.com</a><br><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br></div></div></body></html>