<div dir="ltr">Hi,<br>&nbsp;&nbsp;&nbsp; By giving events all command in a php socket program&nbsp; i get all the events in the GUI itself. But i need to pickup only Answer state from the output. <br><br>&nbsp;&nbsp;&nbsp; $status1 = &quot;events all \r\n\r\n&quot;;<br>
&nbsp;&nbsp;&nbsp; echo &quot;command is $status1&quot;;<br>&nbsp;&nbsp;&nbsp; fwrite($handle, $status1);<br>&nbsp;&nbsp;&nbsp; $response = fread($handle, 10240);<br>&nbsp;&nbsp;&nbsp; echo &quot;command sent, got response:&lt;br&gt; $response&lt;br&gt;&quot;;<br><br>&nbsp;&nbsp; I get the Answer state in Perl script please some one help in through php script<br>
&nbsp;&nbsp; <br>&nbsp;&nbsp; I have see the script in the above mail list but i cant get in php script please some one help me to get Answer state event .<br><br><div class="gmail_quote">2008/10/5 Michael S Collins <span dir="ltr">&lt;<a href="mailto:msc@freeswitch.org">msc@freeswitch.org</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div bgcolor="#FFFFFF"><div>I don&#39;t know PHP. If no one else here does either then you&#39;ll need to ask this question on a PHP list or IRC channel.&nbsp;</div>
<div><br></div><div>-MC<br><br>Sent from my iPhone</div><div><div></div><div class="Wj3C7c"><div><br>On Oct 4, 2008, at 6:15 AM, &quot;Gopal krishnan&quot; &lt;<a href="mailto:saigop@gmail.com" target="_blank">saigop@gmail.com</a>&gt; wrote:<br>
<br></div><div></div><blockquote type="cite"><div><div dir="ltr">Hi,<div><br></div><div>&nbsp;&nbsp;We tried to execute with perl program itself, attached is the perl program and we can get the output, but in PHP program we cant. Thanks<br>
<br><div class="gmail_quote">On Sat, Oct 4, 2008 at 12:51 AM, Michael Collins <span dir="ltr">&lt;<a href="mailto:mcollins@fcnetwork.com" target="_blank"></a><a href="mailto:mcollins@fcnetwork.com" target="_blank">mcollins@fcnetwork.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 link="blue" vlink="blue" lang="EN-US">

<div>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Before I go any further I need to ask… do
you have support for the preg functions in your PHP version? If not then you&#39;ll
need it for this to work.</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">-MC</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<div style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; border-width: medium medium medium 1.5pt; padding: 0in 0in 0in 4pt;">

<div>

<div style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">

<hr size="2" width="100%" align="center">

</span></font></div>

<p><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;">
<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank"></a><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"></a><a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b><span style="font-weight: bold;">On Behalf Of </span></b>Gopal krishnan<br>

<b><span style="font-weight: bold;">Sent:</span></b> Friday, October 03, 2008
11:07 AM<div><div></div><div><br>
<b><span style="font-weight: bold;">To:</span></b> <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a><br>

<b><span style="font-weight: bold;">Subject:</span></b> Re: [Freeswitch-users]
get channel status</div></div></span></font></p>

</div><div><div></div><div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<div>

<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Please find the attached
PHP file</span></font></p>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">On Fri, Oct 3, 2008 at 11:29 PM, Michael
 Collins &lt;<a href="mailto:mcollins@fcnetwork.com" target="_blank"></a><a href="mailto:mcollins@fcnetwork.com" target="_blank">mcollins@fcnetwork.com</a>&gt;
wrote:</span></font></p>

<div link="blue" vlink="blue">

<div>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">You need to handle each response from the server, no? Can you
post your PHP code here?</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">In Perl I would do something like this.</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"><br>
</span></font><font size="2" color="navy" face="Courier New"><span style="font-size: 10pt; color: navy;"># $data contains
CHANNEL_ANSWER event stuff</span></font></p>

<p><font size="2" color="navy" face="Courier New"><span style="font-size: 10pt; color: navy;">if ( $data =~ m/Answered-State: (\w+)/m )
{</span></font></p>

<p><font size="2" color="navy" face="Courier New"><span style="font-size: 10pt; color: navy;">&nbsp; my $state = $1;</span></font></p>

<p><font size="2" color="navy" face="Courier New"><span style="font-size: 10pt; color: navy;">&nbsp; print &quot;Channel state is
$state\n&quot;;</span></font></p>

<p><font size="2" color="navy" face="Courier New"><span style="font-size: 10pt; color: navy;">&nbsp; if ( $state eq &#39;answered&#39; ) {</span></font></p>

<p><font size="2" color="navy" face="Courier New"><span style="font-size: 10pt; color: navy;">&nbsp;&nbsp;&nbsp; # do whatever U need
to do on an answer event</span></font></p>

<p><font size="2" color="navy" face="Courier New"><span style="font-size: 10pt; color: navy;">&nbsp; }</span></font></p>

<p><font size="2" color="navy" face="Courier New"><span style="font-size: 10pt; color: navy;">}</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">-MC</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">P.S. – I tested the regex with the data file you posted and
it worked perfectly for me in Perl 5. Since PHP is a Perl derivative I think
you should be able to do this without too much hassle as long as you have a
means of reading the socket data reliably and acting accordingly.</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<div style="border-style: none none none solid; border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color blue; border-width: medium medium medium 1.5pt; padding: 0in 0in 0in 4pt;">

<div>

<div style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">

<hr size="2" width="100%" align="center">

</span></font></div>

<p><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank"></a><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"></a><a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank">freeswitch-users-bounces@lists.freeswitch.org</a>] <b><span style="font-weight: bold;">On Behalf Of </span></b>Gopal krishnan<br>

<b><span style="font-weight: bold;">Sent:</span></b> Friday, October 03, 2008
10:33 AM</span></font></p>

<div>

<p><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"><br>
<b><span style="font-weight: bold;">To:</span></b> <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank">freeswitch-users@lists.freeswitch.org</a></span></font></p>


</div>

<p><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">Subject:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> Re:
[Freeswitch-users] get channel status</span></font></p>

</div>

<div>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Hi,</span></font></p>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;</span></font></p>

</div>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;&nbsp;I
am trying to get thru a PHP file but i get the output as ,</span></font></p>

</div>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;</span></font></p>

</div>

<div>

<div>

<p><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">authMessage sent, got response:</span></font></b></p>

</div>

<div>

<p><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">Content-Type: command/reply Reply-Text: +OK accepted</span></font></b></p>

</div>

<div>

<p><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">command is api originate sofia/default/<a href="mailto:9894929942@172.20.176.254" target="_blank"></a><a href="mailto:9894929942@172.20.176.254" target="_blank">9894929942@172.20.176.254</a>
1001 command sent, got response:</span></font></b></p>

</div>

<div>

<p><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">Content-Type: api/response Content-Length: 41</span></font></b></p>

</div>

<div>

<p><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">command sent, got response:</span></font></b></p>

</div>

<div>

<p><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">+OK c5df1f4c-02ae-4353-b709-ad791ca332a1</span></font></b></p>

</div>

<div>

<p><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">command is bgapi originate sofia/default/<a href="mailto:1001@172.20.176.254" target="_blank"></a><a href="mailto:1001@172.20.176.254" target="_blank">1001@172.20.176.254</a> 1001
&amp;park command sent, got response:</span></font></b></p>

</div>

<div>

<p><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">Content-Type: command/reply Reply-Text: +OK Job-UUID:
d5270c3d-872e-46b6-b556-74bc373b1fe4 Job-UUID:
d5270c3d-872e-46b6-b556-74bc373b1fe4</span></font></b></p>

</div>

<div>

<p><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">command is event channel_answer command sent, got response:</span></font></b></p>

</div>

<div>

<p><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">Content-Type: command/reply Reply-Text: +OK event listener
enabled plain&nbsp;</span></font></b></p>

</div>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;</span></font></p>

</div>

<div>

<p><font size="3" color="red" face="Times New Roman"><span style="font-size: 12pt; color: red;">So I need to run the event channel_answer as
a&nbsp;separate&nbsp;program with autorefreshing?</span></font></p>

</div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">On Fri,
Oct 3, 2008 at 10:49 PM, Brian West &lt;<a href="mailto:brian@freeswitch.org" target="_blank"></a><a href="mailto:brian@freeswitch.org" target="_blank">brian@freeswitch.org</a>&gt; wrote:</span></font></p>

<div style="">

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Yes if
you parse the event using something like perl, ruby, php and get it...</span></font></p>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;</span></font></p>

</div>

<div>

<p><font size="3" color="#888888" face="Times New Roman"><span style="font-size: 12pt; color: rgb(136, 136, 136);">/b</span></font></p>

</div>

<div>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<div>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">On Oct 3,
2008, at 12:10 PM, Gopal krishnan wrote:</span></font></p>

</div>

<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;</span></font></p>

<p style="margin-bottom: 12pt;"><font size="1" color="black" face="Helvetica"><span style="font-size: 9pt; font-family: Helvetica; color: black;"><span style="word-spacing: 0px;">File attached</span></span></font></p>


<div>

<p><font size="1" color="black" face="Helvetica"><span style="font-size: 9pt; font-family: Helvetica; color: black;">On Fri, Oct 3, 2008 at 10:36 PM, Gopal
krishnan&nbsp;&lt;<a href="mailto:saigop@gmail.com" target="_blank"></a><a href="mailto:saigop@gmail.com" target="_blank">saigop@gmail.com</a>&gt;&nbsp;wrote:</span></font></p>

<div>

<p><font size="1" color="black" face="Helvetica"><span style="font-size: 9pt; font-family: Helvetica; color: black;">Hi,</span></font></p>

<div>

<p><font size="1" color="black" face="Helvetica"><span style="font-size: 9pt; font-family: Helvetica; color: black;">&nbsp;</span></font></p>

</div>

<div>

<p><font size="1" color="black" face="Helvetica"><span style="font-size: 9pt; font-family: Helvetica; color: black;">&nbsp;&nbsp;By giving event channel_answer
in telnet console I get lots of variables, I am attaching it as a text file
with this email. And my query is for example If I want to pickup only Answer
state from that output, &nbsp;is that possible?</span></font></p>

<div>

<p><font size="1" color="black" face="Helvetica"><span style="font-size: 9pt; font-family: Helvetica; color: black;">&nbsp;</span></font></p>

</div>

</div>

</div>

</div>

</div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">&nbsp;</span></font></p>

</div>

</div>

</div>

<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank"></a><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"></a><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"></a><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"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></span></font></p>

</div>

<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
<br clear="all">
<br>
-- <br>
Thank you &nbsp;with regards,<br>
Gopal,</span></font></p>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank"></a><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"></a><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"></a><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"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></span></font></p>

</div>

<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
<br clear="all">
<br>
-- <br>
Thank you &nbsp;with regards,<br>
Gopal,</span></font></p>

</div>

</div></div></div>

</div>

</div>


<br>_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank"></a><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"></a><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"></a><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"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Thank you &nbsp;with regards,<br>Gopal,<br><br>
</div></div>
</div></blockquote></div></div><blockquote type="cite"><div>&lt;event.php&gt;</div></blockquote><div class="Ih2E3d"><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Freeswitch-users mailing list</span><br>
<span><a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank">Freeswitch-users@lists.freeswitch.org</a></span><br><span><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></span><br>
<span>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></span><br>
<span><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></span><br></div></blockquote></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><br clear="all"><br>-- <br>Warm Regards,<br>N.Baskar<br><br>
</div>