<html><body bgcolor="#FFFFFF"><div>I don't know PHP. If no one else here does either then you'll need to ask this question on a PHP list or IRC channel. </div><div><br></div><div>-MC<br><br>Sent from my iPhone</div><div><br>On Oct 4, 2008, at 6:15 AM, "Gopal krishnan" <<a href="mailto:saigop@gmail.com">saigop@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><div dir="ltr">Hi,<div><br></div><div> 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"><<a href="mailto:mcollins@fcnetwork.com"><a href="mailto:mcollins@fcnetwork.com">mcollins@fcnetwork.com</a></a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-US" link="blue" vlink="blue">
<div>
<p><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;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'll
need it for this to work.</span></font></p>
<p><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy">-MC</span></font></p>
<p><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy"> </span></font></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div align="center" style="text-align:center"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">
<hr size="2" width="100%" align="center">
</span></font></div>
<p><b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma">
<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank"><a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a></a>
[mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank"><a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a></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 class="Wj3C7c"><br>
<b><span style="font-weight:bold">To:</span></b> <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank"><a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a></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 class="Wj3C7c">
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> </span></font></p>
<div>
<p style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Please find the attached
PHP file</span></font></p>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt">On Fri, Oct 3, 2008 at 11:29 PM, Michael
Collins <<a href="mailto:mcollins@fcnetwork.com" target="_blank"><a href="mailto:mcollins@fcnetwork.com">mcollins@fcnetwork.com</a></a>>
wrote:</span></font></p>
<div link="blue" vlink="blue">
<div>
<p><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;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:10.0pt;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:10.0pt;font-family:Arial;color:navy"><br>
</span></font><font size="2" color="navy" face="Courier New"><span style="font-size:10.0pt;color:navy"># $data contains
CHANNEL_ANSWER event stuff</span></font></p>
<p><font size="2" color="navy" face="Courier New"><span style="font-size:10.0pt;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:10.0pt;color:navy"> my $state = $1;</span></font></p>
<p><font size="2" color="navy" face="Courier New"><span style="font-size:10.0pt;color:navy"> print "Channel state is
$state\n";</span></font></p>
<p><font size="2" color="navy" face="Courier New"><span style="font-size:10.0pt;color:navy"> if ( $state eq 'answered' ) {</span></font></p>
<p><font size="2" color="navy" face="Courier New"><span style="font-size:10.0pt;color:navy"> # 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:10.0pt;color:navy"> }</span></font></p>
<p><font size="2" color="navy" face="Courier New"><span style="font-size:10.0pt;color:navy">}</span></font></p>
<p><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy"> </span></font></p>
<p><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy">-MC</span></font></p>
<p><font size="2" color="navy" face="Arial"><span style="font-size:10.0pt;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:10.0pt;font-family:Arial;color:navy"> </span></font></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div align="center" style="text-align:center"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">
<hr size="2" width="100%" align="center">
</span></font></div>
<p><b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma"> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank"><a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a></a>
[mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank"><a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a></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:10.0pt;font-family:Tahoma"><br>
<b><span style="font-weight:bold">To:</span></b> <a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank"><a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a></a></span></font></p>
</div>
<p><b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">Subject:</span></font></b><font size="2" face="Tahoma"><span style="font-size:10.0pt;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:12.0pt"> </span></font></p>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Hi,</span></font></p>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> </span></font></p>
</div>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> 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:12.0pt"> </span></font></p>
</div>
<div>
<div>
<p><b><font size="3" face="Times New Roman"><span style="font-size:12.0pt;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:12.0pt;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:12.0pt;font-weight:bold">command is api originate sofia/default/<a href="mailto:9894929942@172.20.176.254" target="_blank"><a href="mailto:9894929942@172.20.176.254">9894929942@172.20.176.254</a></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:12.0pt;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:12.0pt;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:12.0pt;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:12.0pt;font-weight:bold">command is bgapi originate sofia/default/<a href="mailto:1001@172.20.176.254" target="_blank"><a href="mailto:1001@172.20.176.254">1001@172.20.176.254</a></a> 1001
&park command sent, got response:</span></font></b></p>
</div>
<div>
<p><b><font size="3" face="Times New Roman"><span style="font-size:12.0pt;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:12.0pt;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:12.0pt;font-weight:bold">Content-Type: command/reply Reply-Text: +OK event listener
enabled plain </span></font></b></p>
</div>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> </span></font></p>
</div>
<div>
<p><font size="3" color="red" face="Times New Roman"><span style="font-size:12.0pt;color:red">So I need to run the event channel_answer as
a separate program with autorefreshing?</span></font></p>
</div>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> </span></font></p>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt">On Fri,
Oct 3, 2008 at 10:49 PM, Brian West <<a href="mailto:brian@freeswitch.org" target="_blank"><a href="mailto:brian@freeswitch.org">brian@freeswitch.org</a></a>> wrote:</span></font></p>
<div style="word-wrap:break-word">
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt">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:12.0pt"> </span></font></p>
</div>
<div>
<p><font size="3" color="#888888" face="Times New Roman"><span style="font-size:12.0pt;color:#888888">/b</span></font></p>
</div>
<div>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> </span></font></p>
<div>
<div>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt">On Oct 3,
2008, at 12:10 PM, Gopal krishnan wrote:</span></font></p>
</div>
<p style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> </span></font></p>
<p style="margin-bottom:12.0pt"><font size="1" color="black" face="Helvetica"><span style="font-size:9.0pt;font-family:Helvetica;color:black"><span style="text-align:auto;word-spacing:0px">File attached</span></span></font></p>
<div>
<p><font size="1" color="black" face="Helvetica"><span style="font-size:9.0pt;font-family:Helvetica;color:black">On Fri, Oct 3, 2008 at 10:36 PM, Gopal
krishnan <<a href="mailto:saigop@gmail.com" target="_blank"><a href="mailto:saigop@gmail.com">saigop@gmail.com</a></a>> wrote:</span></font></p>
<div>
<p><font size="1" color="black" face="Helvetica"><span style="font-size:9.0pt;font-family:Helvetica;color:black">Hi,</span></font></p>
<div>
<p><font size="1" color="black" face="Helvetica"><span style="font-size:9.0pt;font-family:Helvetica;color:black"> </span></font></p>
</div>
<div>
<p><font size="1" color="black" face="Helvetica"><span style="font-size:9.0pt;font-family:Helvetica;color:black"> 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, is that possible?</span></font></p>
<div>
<p><font size="1" color="black" face="Helvetica"><span style="font-size:9.0pt;font-family:Helvetica;color:black"> </span></font></p>
</div>
</div>
</div>
</div>
</div>
<p><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> </span></font></p>
</div>
</div>
</div>
<p style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank"><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a><br>
<a href="http://www.freeswitch.org" target="_blank"><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></a></span></font></p>
</div>
<p style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><br>
<br clear="all">
<br>
-- <br>
Thank you with regards,<br>
Gopal,</span></font></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><br>
_______________________________________________<br>
Freeswitch-users mailing list<br>
<a href="mailto:Freeswitch-users@lists.freeswitch.org" target="_blank"><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a><br>
<a href="http://www.freeswitch.org" target="_blank"><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></a></span></font></p>
</div>
<p style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><br>
<br clear="all">
<br>
-- <br>
Thank you 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"><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a><br>
<a href="http://www.freeswitch.org" target="_blank"><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Thank you with regards,<br>Gopal,<br><br>
</div></div>
</div></blockquote><blockquote type="cite"><div><event.php></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Freeswitch-users mailing list</span><br><span><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a></span><br><span><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></span><br><span>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users"><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></a></span><br><span><a href="http://www.freeswitch.org">http://www.freeswitch.org</a></span><br></div></blockquote></body></html>