I've tried the following program as per the suggestion that you've told. But it seems, no success. Once the connection is closed, I created a new connection and I send originate to originate a new call. But it is not working.<br>
<br>require ESL;<br>use IO::Socket::INET;<br>use Data::Dumper;<br><br>my $ip = "192.168.1.222";<br>my $sock = new IO::Socket::INET ( LocalHost => $ip, LocalPort => '8447', Proto => 'tcp', Listen => 2, Reuse => 1 );<br>
die "Could not create socket: $!\n" unless $sock;<br><br>my $make_call;<br>my $con;<br>my $type = "user/";<br><br>for(;;) {<br> my $new_sock = $sock->accept();<br> my $pid = fork();<br>
if ($pid) {<br> close($new_sock);<br> next;<br> }<br> my $host = $new_sock->sockhost();<br> my $fd = fileno($new_sock);<br> $con = new ESL::ESLconnection($fd);<br>
my $info = $con->getInfo();<br> my $uuid = $info->getHeader("unique-id");<br> printf "Connected call %s, from %s to %s\n", $uuid, $info->getHeader("caller-caller-id-number"), $info->getHeader("caller-destination-number");<br>
<br> $con->filter("Unique-Id", $uuid);<br> $con->events("plain", "all");<br> $con->execute("answer");<br> $con->setEventLock("true");<br>
my $number=$con->execute("read","2 4 /usr/local/freeswitch/sounds/en/us/callie/conference/8000/conf-pin.wav accnt_number 5000 #");<br> while($con->connected())<br> {<br> my $e=$con->recvEvent();<br>
my $ename=$e->getHeader("Event-Name");<br> my $app=$e->getHeader("Application");<br> if($ename eq "CHANNEL_EXECUTE_COMPLETE" and $app eq "read")<br>
{<br> my $num=$e->getHeader("variable_accnt_number");<br> print "$num\n";<br> $con->execute("hangup");<br>
}<br> }<br> if(!$con->connected())<br> {<br> print "Connection not exists\n";<br> $con = new ESL::ESLconnection($fd);<br> $con->api("originate","user/1000 &park()");<br>
print "Hai\n";<br> }<br> print "Bye\n------------------------------------------------------------------\n";<br> close($new_sock);<br>}<br>Output:<br>Connected call 6b713588-d8c5-11de-8d50-596fac84e59e, from 1000 to 9097<br>
1000<br>Connection not exists<br>Hai<br>Bye<br>------------------------------------------------------------------<br>The freeswitch log is in<br><a href="http://pastebin.freeswitch.org/11258">http://pastebin.freeswitch.org/11258</a><br>
<br>I also noted that, if I don't receive any events, especially "SERVER_DISCONNECTED", then the connection is in established state, but once I receive the "SERVER_DISCONNECTED" event, the connection is closed. Is it correct??<br>
<br><br><br><br><div class="gmail_quote">On Tue, Nov 24, 2009 at 1:10 AM, Anthony Minessale <span dir="ltr"><<a href="mailto:anthony.minessale@gmail.com">anthony.minessale@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
or open a new outbound connection at the end of your script so you can send your originate command.<br>Since the channel hanging up will close your existing connection since it's only an outbound single session socket.<br>
<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Mon, Nov 23, 2009 at 11:51 AM, Michael Collins <span dir="ltr"><<a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
<br><br><div class="gmail_quote"><div><div></div><div>On Mon, Nov 23, 2009 at 3:25 AM, lakshmanan ganapathy <span dir="ltr"><<a href="mailto:lakindia89@gmail.com" target="_blank">lakindia89@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>I'm using perl ESL to control the call in freeswitch.<br>I'm having the following scenario, but not able to get it right.<br><br>Dialplan:<br><extension name="outbound_soc"><br> <condition field="destination_number" expression="^9097$"><br>
<action application="set" data="continue_on_fail=true"/><br> <action application="socket" data="<a href="http://192.168.1.222:8447" target="_blank">192.168.1.222:8447</a> async full"/><br>
</condition><br></extension><br><br><br>1. User A calls to an extention (1000).<br>2. My ESL program will be running, and it answers the call.<br>3. Then the program will get a number from the user.<br>4. It will hangup the call.<br>
5. The program has to call to the number that was given by the user.<br><br>In the above scenario, I was able to do until the 4th step. After hangup the call, if I say originate it is not working.<br>Any ideas on how to do this in ESL.<br>
<br></blockquote></div></div><div><br>I want to make sure I understand what the script is supposed to be doing. The caller will key in a phone number to your script and your script will collect those digits. The script will then hangup on the caller and originate a completely new call? Perhaps you could use sched_api to schedule a new originate command for a few seconds into the future and then hangup?<br>
-MC<br></div></div><br>
<br></div></div>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
<a href="http://iax:guest@conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org" target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400<br>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>