Thanks for all your reply&#39;s.<br>Will give a try to on non-blocking.<br><br><br><div class="gmail_quote">On Tue, Jan 19, 2010 at 9:34 PM, Anthony Minessale <span dir="ltr">&lt;<a href="mailto:anthony.minessale@gmail.com">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;">Its nothing we can fix, that is what you must do on a failed read syscall.<br>you can do a non blocking read instead and take your chances.<div>
<div></div><div class="h5"><br><br><br><div class="gmail_quote">On Tue, Jan 19, 2010 at 3:07 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;">I tried with SIGUSR1, but no progress. I got SERVER_DISCONNECTED.<br>Output:<br><br>CHILD 3814: Received USR1<br>

EVENT [SERVER_DISCONNECTED]<br><br>In esl.c, in esl_recv_event() function, line no: 824<br>if (rrval &lt; 0) {<br>
                        strerror_r(handle-&gt;errnum, handle-&gt;err, sizeof(handle-&gt;err));<br>                        goto fail;<br>}<br>When the program is blocked under receive, I passed the signal. So recv returns -1, and in fail: it call esl_disconnect(handle). <br>


<br>Is it because of this??? If so, whether it should be fixed or not???<div><div></div><div><br><br><br><br><div class="gmail_quote">On Mon, Jan 18, 2010 at 9:54 PM, 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;">try a less famous signal like SIGUSR1 it&#39;s possible something in perl still reacts to SIGINT<div>


<div></div><div><br><br><br><div class="gmail_quote">On Mon, Jan 18, 2010 at 5:22 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;">Here is the result<br><br>Program:<div><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; 1,  Reuse =&gt; 1 );<br>
die &quot;Could not create socket: $!\n&quot; unless $sock;<br><br><br></div><div>for(;;) {<br>    my $new_sock = $sock-&gt;accept();<br>    next if (not defined ($new_sock));<br>    my $pid = fork();<br>    if ($pid) {<br>



        close($new_sock);<br>
        next;<br>    }<br>    print &quot;CHILD PID: $$\n&quot;;<br></div>    &amp;register_Signals_Child();<br>    sub register_Signals_Child() {<br>        foreach ( keys %SIG ) {<br>            $SIG{$_} = &#39;Handler&#39;;<br>




        }<br>    }<br><br>    sub Handler() {<div><br>        my $handle=$_[0];<br>        if($handle eq &quot;INT&quot;) {<br></div>            print &quot;CHILD $$: SIGNAL SIG$handle is generated\n&quot;;<br>
        }<br>        else<br>
        {<br>            print &quot;CHILD $$: Received $handle\n&quot;;<div><br>        }<br>    }<br>    my $host = $new_sock-&gt;sockhost();<br>    my $fd = fileno($new_sock);<br><br>    my $con = new ESL::ESLconnection($fd);<br>




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




    my $r=$con-&gt;execute(&quot;answer&quot;);<br>    print Dumper $r;<br>    $con-&gt;events(&quot;plain&quot;,&quot;all&quot;);<br>    my $re=$con-&gt;execute(&quot;playback&quot;,&quot;/usr/local/freeswitch1/sounds/en/us/callie/ivr/8000/ivr-welcome_to_freeswitch.wav&quot;);<br>




    while($con-&gt;connected()) {<br>        my $e = $con-&gt;recvEvent();<br><br>        if ($e) {<br>            my $name = $e-&gt;getHeader(&quot;event-name&quot;);<br>            print &quot;EVENT [$name]\n&quot;;<br>




            if ($name eq &quot;DTMF&quot;) {<br>                my $digit = $e-&gt;getHeader(&quot;dtmf-digit&quot;);<br>                print &quot;$digit\n&quot;;<br>            }<br>        }<br>    }<br>    close($new_sock);<br>




}<br><br></div>I executed the program and the following things were printed<br><br>CHILD PID: 6778<br>Connected call e0d1001a-03f4-11df-b002-db488337e0ea, from 1001<br>$VAR1 = 0;<br>EVENT [CHANNEL_EXECUTE]<br>EVENT [CHANNEL_ANSWER]<br>




EVENT [CHANNEL_EXECUTE_COMPLETE]<br>EVENT [COMMAND]<br>EVENT [CHANNEL_EXECUTE]<br>EVENT [HEARTBEAT]<br>EVENT [RE_SCHEDULE]<br>EVENT [CHANNEL_EXECUTE_COMPLETE]<br><br>Then from another shell I executed kill -2 6778, the result is follows<br>




CHILD 6778: SIGNAL SIGINT is generated<br>EVENT [SERVER_DISCONNECTED]<br><br>But the child process is still running as expected.<br>But  I don&#39;t know why I received SERVER_DISCONNECTED from freeswitch???<div><div></div>



<div><br><br><br><br>
<br><br><div class="gmail_quote">On Thu, Jan 14, 2010 at 1:27 PM, 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;">




<div>I taught the signal handler will be inherited by the child process. It also does like that.</div>
<div>After making a call, If I press ctrl + c, the above program printed</div>
<div>PARENT PID: Signal SIGINT is generated</div>
<div>CHILD PID: Signal SIGINT is generated.</div>
<div> </div>
<div>So I think the sigal handlers will be inherited to the child.<br>Anyway I&#39;ll also try registering signal handlers in child also, and then I&#39;ll come back with that result.</div>
<div> </div>
<div>Thanks....<br></div><div><div></div><div>
<div class="gmail_quote">On Wed, Jan 13, 2010 at 9:48 PM, 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: 0px 0px 0px 0.8ex; padding-left: 1ex;">you would have to register signals in your child process too<br><br>
<div class="gmail_quote">
<div>
<div></div>
<div>On Wed, Jan 13, 2010 at 3:13 AM, lakshmanan ganapathy <span dir="ltr">&lt;<a href="mailto:lakindia89@gmail.com" target="_blank">lakindia89@gmail.com</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>Hi all,<br><br>I&#39;ve done a sample program (In perl ESL) , which play a file to the caller and then it will call recvEvent() and print the event name. I&#39;ve handled signals also.<br><br>When I send SIGINT to my program (Perl), the signal handler is called and I can see the print output. But in the same time,  I received SERVER_DISCONNECTED from freeswitch as event.<br>





<br>I don&#39;t know why I received SERVER_DISCONNECTED from freeswitch. Is it because, the recvEvent() from perl internally  calls the recvevent function in the Esl.c and when it waits to receive the information from socket, the signal occurred???<br>





<br>Please clarify me!! <br><br>Here is my program<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; 1,  Reuse =&gt; 1 );<br>





die &quot;Could not create socket: $!\n&quot; unless $sock;<br>&amp;register_Signals();<br><br>for(;;) {<br>    my $new_sock = $sock-&gt;accept();<br>    next if (not defined ($new_sock));<br>    my $pid = fork();<br>    if ($pid) {<br>





        close($new_sock);<br>        next;<br>    }<br>    print &quot;CHILD PID: $$\n&quot;;<br>    my $host = $new_sock-&gt;sockhost();<br>    my $fd = fileno($new_sock);<br><br>    my $con = new ESL::ESLconnection($fd);<br>





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





    my $r=$con-&gt;execute(&quot;answer&quot;);<br>    print Dumper $r;<br>    $con-&gt;events(&quot;plain&quot;,&quot;all&quot;);<br>    my  $re=$con-&gt;execute(&quot;playback&quot;,&quot;/usr/local/freeswitch1/sounds/en/us/callie/ivr/8000/ivr-welcome_to_freeswitch.wav&quot;);<br>





<br>    while($con-&gt;connected()) {<br>        my $e = $con-&gt;recvEvent();<br><br>        if ($e) {<br>            my $name = $e-&gt;getHeader(&quot;event-name&quot;);<br>            print &quot;EVENT [$name]\n&quot;;<br>





            if ($name eq &quot;DTMF&quot;) {<br>                my $digit = $e-&gt;getHeader(&quot;dtmf-digit&quot;);<br>                print &quot;$digit\n&quot;;<br>            }<br>        }<br>    }<br>    close($new_sock);<br>





}<br>sub register_Signals() {<br>    foreach ( keys %SIG ) {<br>        $SIG{$_} = &#39;sig_Handler&#39;;<br>    }<br>}<br><br>sub sig_Handler() {<br>    my $handle=$_[0];<br>    if($handle eq &quot;INT&quot;) {<br>        print &quot;$$: SIGNAL SIG$handle is generated\n&quot;;<br>





    }<br>}<br><br><br></div></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></div></blockquote></div><br><br clear="all">
<div>
<div></div>
<div><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:+19193869900<br></div></div><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>
</div></div><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><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:+19193869900<br>
</div></div><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><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><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:+19193869900<br>
</div></div><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>