Hi, Any help or suggestion regarding my previous post. Especially<br><br>&quot;I also noted that, if I don&#39;t receive any events, especially &quot;SERVER_DISCONNECTED&quot;, then the connection is in established state, but
once I receive the &quot;SERVER_DISCONNECTED&quot; event, the connection is
closed. Is it correct??&quot;<br>Here is the program by which I confirmed the above!<br><br>require ESL;<br>use IO::Socket::INET;<br><br>my $ip = &quot;192.168.1.222&quot;;<br>my $sock = new IO::Socket::INET ( LocalHost =&gt; $ip,  LocalPort =&gt; &#39;8447&#39;,  Proto =&gt; &#39;tcp&#39;,  Listen =&gt; 2,  Reuse =&gt; 1 );<br>
die &quot;Could not create socket: $!\n&quot; unless $sock;<br>my $con;<br>my $type = &quot;user/&quot;;<br><br>for(;;) {<br>        # wait for any client to connect, a new client will get connected when a new call comes in the dialplan.<br>
        my $new_sock = $sock-&gt;accept();<br>        # Do fork and let the parent to wait for more clients.<br>        my $pid = fork();<br>        if ($pid) {<br>                close($new_sock);<br>                next;<br>
        }<br>        # Extract the host of the client.<br>        my $host = $new_sock-&gt;sockhost();<br>        # file descriptor for the socket.<br>        my $fd = fileno($new_sock);<br>        print &quot;Host name is $host\n&quot;;<br>
        # Create object for the ESL connection package to access the ESL functions.<br>        $con = new ESL::ESLconnection($fd);<br>        # Gets the info about this channel.<br>        my $info = $con-&gt;getInfo();<br>
        my $uuid = $info-&gt;getHeader(&quot;unique-id&quot;);<br>        printf &quot;Connected call %s, from %s to %s\n&quot;, $uuid, $info-&gt;getHeader(&quot;caller-caller-id-number&quot;), $info-&gt;getHeader(&quot;caller-destination-number&quot;);<br>
<br>        # Answer the channel.<br>        $con-&gt;execute(&quot;answer&quot;);<br>        # Set the event lock to tell the FS to execute the instructions in the given order.<br>        $con-&gt;setEventLock(&quot;true&quot;);<br>
        # Play a file &amp; Get the personal number from the user.<br>        $con-&gt;execute(&quot;playback&quot;,&quot;/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-welcome_to_freeswitch.wav&quot;);<br>        $con-&gt;execute(&quot;hangup&quot;);<br>
        while($con-&gt;connected())<br>        {<br>            my $e=$con-&gt;recvEvent();<br>            my $ename=$e-&gt;getHeader(&quot;Event-Name&quot;);<br>            print $e-&gt;serialize();<br>            print &quot;$ename\n&quot;;<br>
            print &quot;Connection exists\n&quot;;<br>            sleep(1);<br>        }<br>        print &quot;Bye\n------------------------------------------------------------------\n&quot;;<br>        close($new_sock);<br>
}<br>    I&#39;ve not registered for any events.<br>    In the above program I&#39;m receiving the SERVER_DISCONNECTED event.<br>Output when receiving event:<br>    Host name is 192.168.1.222<br>    Connected call 022b79f8-d8c0-11de-8d50-596fac84e59e, from 1000 to 9097<br>
    Event-Name: SERVER_DISCONNECTED<br><br>    SERVER_DISCONNECTED<br>    Connection exists<br>    Bye<br><br>When I comment the recvEvent line, I got the following output.<br><br>    Host name is 192.168.1.222<br>    Connected call 65b7f64a-d8c0-11de-8d50-596fac84e59e, from 1000 to 9097<br>
    Connection exists<br>    Connection exists<br>    Connection exists<br>    Connection exists<br>    Connection exists<br><br><br><div class="gmail_quote">On Tue, Nov 24, 2009 at 5:57 PM, lakshmanan ganapathy <span dir="ltr">&lt;<a href="mailto:lakindia89@gmail.com">lakindia89@gmail.com</a>&gt;</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;">I&#39;ve tried the following program as per the suggestion that you&#39;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 = &quot;192.168.1.222&quot;;<br>my $sock = new IO::Socket::INET ( LocalHost =&gt; $ip,  LocalPort =&gt; &#39;8447&#39;,  Proto =&gt; &#39;tcp&#39;,  Listen =&gt; 2,  Reuse =&gt; 1 );<br>

die &quot;Could not create socket: $!\n&quot; unless $sock;<br><br>my $make_call;<br>my $con;<br>my $type = &quot;user/&quot;;<br><br>for(;;) {<br>        my $new_sock = $sock-&gt;accept();<br>        my $pid = fork();<br>

        if ($pid) {<br>                close($new_sock);<br>                next;<br>        }<br>        my $host = $new_sock-&gt;sockhost();<br>        my $fd = fileno($new_sock);<br>        $con = new ESL::ESLconnection($fd);<br>

        my $info = $con-&gt;getInfo();<br>        my $uuid = $info-&gt;getHeader(&quot;unique-id&quot;);<br>        printf &quot;Connected call %s, from %s to %s\n&quot;, $uuid, $info-&gt;getHeader(&quot;caller-caller-id-number&quot;), $info-&gt;getHeader(&quot;caller-destination-number&quot;);<br>

<br>        $con-&gt;filter(&quot;Unique-Id&quot;, $uuid);<br>        $con-&gt;events(&quot;plain&quot;, &quot;all&quot;);<br>        $con-&gt;execute(&quot;answer&quot;);<br>        $con-&gt;setEventLock(&quot;true&quot;);<br>

        my $number=$con-&gt;execute(&quot;read&quot;,&quot;2 4 /usr/local/freeswitch/sounds/en/us/callie/conference/8000/conf-pin.wav accnt_number 5000 #&quot;);<br>        while($con-&gt;connected())<br>        {<br>                my $e=$con-&gt;recvEvent();<br>

                my $ename=$e-&gt;getHeader(&quot;Event-Name&quot;);<br>                my $app=$e-&gt;getHeader(&quot;Application&quot;);<br>                if($ename eq &quot;CHANNEL_EXECUTE_COMPLETE&quot; and $app eq &quot;read&quot;)<br>

                {<br>                        my $num=$e-&gt;getHeader(&quot;variable_accnt_number&quot;);<br>                        print &quot;$num\n&quot;;<br>                        $con-&gt;execute(&quot;hangup&quot;);<br>

                }<br>        }<br>        if(!$con-&gt;connected())<br>        {<br>                print &quot;Connection not exists\n&quot;;<br>                $con = new ESL::ESLconnection($fd);<br>                $con-&gt;api(&quot;originate&quot;,&quot;user/1000 &amp;park()&quot;);<br>

                print &quot;Hai\n&quot;;<br>        }<br>        print &quot;Bye\n------------------------------------------------------------------\n&quot;;<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" target="_blank">http://pastebin.freeswitch.org/11258</a><br>

<br>I also noted that, if I don&#39;t receive any events, especially &quot;SERVER_DISCONNECTED&quot;, then the connection is in established state, but once I receive the &quot;SERVER_DISCONNECTED&quot; event, the connection is closed. Is it correct??<div>
<div></div><div class="h5"><br>
<br><br><br><br><div class="gmail_quote">On Tue, Nov 24, 2009 at 1:10 AM, Anthony Minessale <span dir="ltr">&lt;<a href="mailto:anthony.minessale@gmail.com" target="_blank">anthony.minessale@gmail.com</a>&gt;</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&#39;s only an outbound single session socket.<br>


<br><br><div class="gmail_quote"><div><div></div><div>On Mon, Nov 23, 2009 at 11:51 AM, Michael Collins <span dir="ltr">&lt;<a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>&gt;</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>
<br><br><div class="gmail_quote"><div><div></div><div>On Mon, Nov 23, 2009 at 3:25 AM, lakshmanan ganapathy <span dir="ltr">&lt;<a href="mailto:lakindia89@gmail.com" target="_blank">lakindia89@gmail.com</a>&gt;</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&#39;m using perl ESL to control the call in freeswitch.<br>I&#39;m having the following scenario, but not able to get it right.<br><br>Dialplan:<br>&lt;extension name=&quot;outbound_soc&quot;&gt;<br>    &lt;condition field=&quot;destination_number&quot; expression=&quot;^9097$&quot;&gt;<br>




            &lt;action application=&quot;set&quot; data=&quot;continue_on_fail=true&quot;/&gt;<br>            &lt;action application=&quot;socket&quot; data=&quot;<a href="http://192.168.1.222:8447" target="_blank">192.168.1.222:8447</a> async full&quot;/&gt;<br>




    &lt;/condition&gt;<br>&lt;/extension&gt;<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" 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>
</div></div></blockquote></div><br>