What you are trying to do is not possible in this fashion. The bridge occurs in the same thread as the perl script. The thread can only do one thing at a time. <div><br></div><div>If you need to know the dial status while the thread is still running you&#39;ll want a separate event socket app running and listening for channel status events. If you just need to know the dial status once the bridge is complete (i.e. once the call ends) then just use a api_hangup_hook chan var to launch a script to do whatever it is that you need done.</div>
<div><br></div><div>-MC<br><br><div class="gmail_quote">On Sun, Jul 24, 2011 at 11:45 AM, Sam <span dir="ltr">&lt;<a href="mailto:lakersman2006@yahoo.com">lakersman2006@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit">For the life of me I am still unable to get the bridged call status, when I subscribe to an &quot;event&quot; I am not here is my perl code snippet below, what am I doing wrong?<br>
<br><br>my $fs = new ESL::ESLconnection($host, $port, $password);<br><br>$session-&gt;answer();<br><br>if ($session-&gt;ready ()) <br>{<br>    #set bridge settings<br>    $session-&gt;execute(&quot;set&quot;, &quot;ringback=$ringback_tone&quot;);   <br>
    $session-&gt;execute(&quot;set&quot;, &quot;instant_ringback=true&quot;);        <br>    $session-&gt;execute(&quot;set&quot;, &quot;ignore_early_media=false&quot;); <br>    $session-&gt;execute(&quot;set&quot;, &quot;call_timeout=60&quot;);                            <br>
   
 $session-&gt;execute(&quot;set&quot;, &quot;progress_timeout=15&quot;);<br>    $session-&gt;execute(&quot;set&quot;, &quot;origination_caller_id_number=$caller_id&quot;);<br>    $session-&gt;execute(&quot;set&quot;, &quot;continue_on_fail=false&quot;);<br>
    $session-&gt;execute(&quot;bridge&quot;, &quot;sofia/gateway/provider1/$destination_number&quot;);<br>     <br>    $fs-&gt;sendRecv(&quot;event plain ALL&quot;);<br>    $fs-&gt;send(&quot;linger&quot;);<br>    <br>    while($fs-&gt;connected())<br>
    {<br>        $data = $fs-&gt;recvEvent();<br>        <br>        if ( $data =~ m/Answered-State: (\w+)/m ) <br>        {<br>           my $state = $1;<br>        <br>           #print
 &quot;Channel state is $state\n&quot;;<br>        <br>           if ( $state eq &#39;answered&#39; ) {<br>        <br>             freeswitch::consoleLog(&quot;INFO&quot;, &quot;CALL ANSWERED\n&quot;);<br>        <br>           }<br>
           else<br>           {<br>                freeswitch::consoleLog(&quot;INFO&quot;, &quot;NO CALLS ANSWERED\n&quot;);<br>           }<br>         }    <br>    }<br>}<br>   <br>$session-&gt;hangup();<br> <br>return 1;<div class="im">
<br><br>--- On <b>Fri, 7/22/11, Hector Geraldino
 <i>&lt;<a href="mailto:Hector.Geraldino@ip-soft.net" target="_blank">Hector.Geraldino@ip-soft.net</a>&gt;</i></b> wrote:<br></div><blockquote style="border-left:2px solid rgb(16, 16, 255);margin-left:5px;padding-left:5px">
<div class="im"><br>From: Hector Geraldino &lt;<a href="mailto:Hector.Geraldino@ip-soft.net" target="_blank">Hector.Geraldino@ip-soft.net</a>&gt;<br>Subject: Re: [Freeswitch-users] Asterisk dial status<br>To: &quot;FreeSWITCH Users Help&quot; &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>&gt;<br>
</div>Date: Friday, July 22, 2011, 2:28 PM<div><div></div><div class="h5"><br><br><div><div><p><span style="font-size:11.0pt;color:#1F497D">It does.</span></p><p><span style="font-size:11.0pt;color:#1F497D">  </span></p><p>
<span style="font-size:11.0pt;color:#1F497D">You can check the events by connecting to FS on inbound mode, or using FS outbound socket connection to an application designed by you. </span></p><p><span style="font-size:11.0pt;color:#1F497D">  </span></p>
<p><span style="font-size:11.0pt;color:#1F497D">As you already have a perl script to interact with FS, you can modify it to connect to FS (inbound mode) and listen for events. You can subscribe to the
 events of a particular call, or filter an specific set of events. I haven’t used Asterisk before so I’m not sure how the AGI fits on the FS architecture.</span></p><p><span style="font-size:11.0pt;color:#1F497D">  </span></p>
<p><span style="font-size:11.0pt;color:#1F497D">You can get more info at:</span></p><p><span style="font-size:11.0pt;color:#1F497D"><a rel="nofollow" href="http://wiki.freeswitch.org/wiki/Mod_event_socket" target="_blank">http://wiki.freeswitch.org/wiki/Mod_event_socket</a></span></p>
<p><span style="font-size:11.0pt;color:#1F497D">  </span></p><p><span style="font-size:11.0pt;color:#1F497D">And a
 working demo at:</span></p><p><span style="font-size:11.0pt;color:#1F497D"> <a rel="nofollow" href="http://wiki.freeswitch.org/wiki/Perl_freeswitch_client_example" target="_blank">http://wiki.freeswitch.org/wiki/Perl_freeswitch_client_example</a></span></p>
<p><span style="font-size:11.0pt;color:#1F497D">  </span></p><p><span style="font-size:11.0pt;color:#1F497D">  </span></p><p><span style="font-size:11.0pt;color:#1F497D">  </span></p><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>On Behalf Of </b>Sam<br>
<b>Sent:</b> Friday, July 22, 2011 4:23 PM<br><b>To:</b> FreeSWITCH Users Help<br><b>Subject:</b> Re: [Freeswitch-users] Asterisk dial status</span></p></div><p>  </p><table border="0" cellpadding="0" cellspacing="0"><tbody><tr>
<td style="padding:0in 0in 0in 0in" valign="top"><p>Sam,<br><br>Does this require event sockets? Or how would I check these events?<br><br>--- On <b>Fri, 7/22/11, Hector Geraldino <i>&lt;<a href="mailto:Hector.Geraldino@ip-soft.net" target="_blank">Hector.Geraldino@ip-soft.net</a>&gt;</i></b> wrote:</p>
<p style="margin-bottom:12.0pt"><br>From: Hector Geraldino &lt;<a href="mailto:Hector.Geraldino@ip-soft.net" target="_blank">Hector.Geraldino@ip-soft.net</a>&gt;<br>Subject: Re: [Freeswitch-users] Asterisk dial status<br>
To: &quot;FreeSWITCH Users Help&quot;
 &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a>&gt;<br>Date: Friday, July 22, 2011, 11:57 AM</p><div><div><p><span style="font-size:11.0pt;color:#1F497D">Hi Sam,</span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p><p><span style="font-size:11.0pt;color:#1F497D">My guess is that you can subscribe to the events of the channel and evaluate the channel events. Look at:</span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p><p><span style="font-size:11.0pt;color:#1F497D"><a rel="nofollow" href="http://wiki.freeswitch.org/wiki/Event_List" target="_blank">http://wiki.freeswitch.org/wiki/Event_List</a></span></p>
<p><span style="font-size:11.0pt;color:#1F497D"> </span></p><p><span style="font-size:11.0pt;color:#1F497D">specifically the channel events list.</span></p><p><span style="font-size:11.0pt;color:#1F497D"> </span></p><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b>On Behalf Of </b>Sam<br>
<b>Sent:</b> Friday, July 22, 2011 2:32
 PM<br><b>To:</b> <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br><b>Subject:</b> [Freeswitch-users] Asterisk dial status</span></p></div><p> </p><table border="0" cellpadding="0" cellspacing="0">
<tbody><tr><td style="padding:0in 0in 0in 0in" valign="top"><p>Hi,<br><br>I am trying to port over an Asterisk AGI script that does a call bridge to Freeswitch using perl, I wanted to know what is the equivalent of the asterisk dial status like: ANSWER, NO_ANSWER, CANCEL, BUSY, CONGESTION, CHANUNAVAIL ? I wanted to know if what methods can be used to gets these statues?</p>
</td></tr></tbody></table><p><span style="font-size:10.0pt"> </span></p></div></div><p style="margin-bottom:12.0pt"><br>-----Inline Attachment Follows-----</p><div><p>_______________________________________________<br>Join us at ClueCon 2011, Aug 9-11, Chicago<br>
<a rel="nofollow" href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a> 877-7-4ACLUE<br><br>FreeSWITCH-users mailing list<br><a rel="nofollow">FreeSWITCH-users@lists.freeswitch.org</a><br><a rel="nofollow" href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a rel="nofollow" href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br><a rel="nofollow" href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></p>
</div></td></tr></tbody></table><p><span style="font-size:10.0pt">  </span></p></div></div><br>-----Inline
 Attachment Follows-----<br><br><div>_______________________________________________<br>Join us at ClueCon 2011, Aug 9-11, Chicago<br><a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a> 877-7-4ACLUE<br>
<br>FreeSWITCH-users mailing list<br><a href="http://mc/compose?to=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>
</div></div></div></blockquote></td></tr></tbody></table><br>_______________________________________________<br>
Join us at ClueCon 2011, Aug 9-11, Chicago<br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a> 877-7-4ACLUE<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></div>