<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><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?<o:p></o:p></span></font></p>
<p class=MsoNormal><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.<o:p></o:p></span></font></p>
<p class=MsoNormal><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;font-family:"Courier New";color:navy'># $data contains
CHANNEL_ANSWER event stuff<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'>if ( $data =~
m/Answered-State: (\w+)/m ) {<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'> my $state = $1;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'> print “Channel
state is $state\n”;<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'> if ( $state eq ‘answered’
) {<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'> # do whatever
U need to do on an answer event<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'> }<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:navy'>}<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>-MC<o:p></o:p></span></font></p>
<p class=MsoNormal><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.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>
<div>
<div class=MsoNormal 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 tabindex=-1>
</span></font></div>
<p class=MsoNormal><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'>
freeswitch-users-bounces@lists.freeswitch.org
[mailto:freeswitch-users-bounces@lists.freeswitch.org] <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<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">freeswitch-users@lists.freeswitch.org</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Freeswitch-users]
get channel status</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Hi,<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><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
,<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<div>
<p class=MsoNormal><span class=apple-style-span><b><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-weight:bold'>authMessage
sent, got response:</span></font></b></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><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></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><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">9894929942@172.20.176.254</a>
1001 command sent, got response:</span></font></b></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><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></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><b><font size=3
face="Times New Roman"><span style='font-size:12.0pt;font-weight:bold'>command
sent, got response:</span></font></b></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><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></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><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">1001@172.20.176.254</a>
1001 &park command sent, got response:</span></font></b></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><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></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><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></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><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></span><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><span class=apple-style-span><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></span><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal><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">brian@freeswitch.org</a>> wrote:<o:p></o:p></span></font></p>
<div style='word-wrap:break-word'>
<p class=MsoNormal><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...<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#888888" face="Times New Roman"><span
style='font-size:12.0pt;color:#888888'>/b<o:p></o:p></span></font></p>
</div>
<div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>On Oct 3, 2008, at 12:10 PM, Gopal krishnan wrote:<o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br>
<o:p></o:p></span></font></p>
<p class=MsoNormal 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<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><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">saigop@gmail.com</a>> wrote:<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=1 color=black face=Helvetica><span
style='font-size:9.0pt;font-family:Helvetica;color:black'>Hi,<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=1 color=black face=Helvetica><span
style='font-size:9.0pt;font-family:Helvetica;color:black'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><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?<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=1 color=black face=Helvetica><span
style='font-size:9.0pt;font-family:Helvetica;color:black'><o:p> </o:p></span></font></p>
</div>
</div>
</div>
</div>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'></span><o:p> </o:p></span></font></p>
</div>
</div>
</div>
<p class=MsoNormal 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">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><o:p></o:p></span></font></p>
</div>
<p class=MsoNormal 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,<o:p></o:p></span></font></p>
</div>
</div>
</div>
</div>
</body>
</html>