[Freeswitch-users] get channel status

Gopal krishnan saigop at gmail.com
Sat Oct 4 06:15:37 PDT 2008


Hi,
  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

On Sat, Oct 4, 2008 at 12:51 AM, Michael Collins <mcollins at fcnetwork.com>wrote:

>  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.
>
> -MC
>
>
>   ------------------------------
>
> *From:* freeswitch-users-bounces at lists.freeswitch.org [mailto:
> freeswitch-users-bounces at lists.freeswitch.org] *On Behalf Of *Gopal
> krishnan
> *Sent:* Friday, October 03, 2008 11:07 AM
>
> *To:* freeswitch-users at lists.freeswitch.org
> *Subject:* Re: [Freeswitch-users] get channel status
>
>
>
> Please find the attached PHP file
>
> On Fri, Oct 3, 2008 at 11:29 PM, Michael Collins <mcollins at fcnetwork.com>
> wrote:
>
> You need to handle each response from the server, no? Can you post your PHP
> code here?
>
> In Perl I would do something like this.
>
>
> # $data contains CHANNEL_ANSWER event stuff
>
> if ( $data =~ m/Answered-State: (\w+)/m ) {
>
>   my $state = $1;
>
>   print "Channel state is $state\n";
>
>   if ( $state eq 'answered' ) {
>
>     # do whatever U need to do on an answer event
>
>   }
>
> }
>
>
>
> -MC
>
> 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.
>
>
>   ------------------------------
>
> *From:* freeswitch-users-bounces at lists.freeswitch.org [mailto:
> freeswitch-users-bounces at lists.freeswitch.org] *On Behalf Of *Gopal
> krishnan
> *Sent:* Friday, October 03, 2008 10:33 AM
>
>
> *To:* freeswitch-users at lists.freeswitch.org
>
> *Subject:* Re: [Freeswitch-users] get channel status
>
>
>
> Hi,
>
>
>
>   I am trying to get thru a PHP file but i get the output as ,
>
>
>
> *authMessage sent, got response:*
>
> *Content-Type: command/reply Reply-Text: +OK accepted*
>
> *command is api originate sofia/default/9894929942 at 172.20.176.254 1001
> command sent, got response:*
>
> *Content-Type: api/response Content-Length: 41*
>
> *command sent, got response:*
>
> *+OK c5df1f4c-02ae-4353-b709-ad791ca332a1*
>
> *command is bgapi originate sofia/default/1001 at 172.20.176.254 1001 &park
> command sent, got response:*
>
> *Content-Type: command/reply Reply-Text: +OK Job-UUID:
> d5270c3d-872e-46b6-b556-74bc373b1fe4 Job-UUID:
> d5270c3d-872e-46b6-b556-74bc373b1fe4*
>
> *command is event channel_answer command sent, got response:*
>
> *Content-Type: command/reply Reply-Text: +OK event listener enabled plain
> *
>
>
>
> So I need to run the event channel_answer as a separate program with
> autorefreshing?
>
>
>
> On Fri, Oct 3, 2008 at 10:49 PM, Brian West <brian at freeswitch.org> wrote:
>
> Yes if you parse the event using something like perl, ruby, php and get
> it...
>
>
>
> /b
>
>
>
> On Oct 3, 2008, at 12:10 PM, Gopal krishnan wrote:
>
>
>
> File attached
>
> On Fri, Oct 3, 2008 at 10:36 PM, Gopal krishnan <saigop at gmail.com> wrote:
>
> Hi,
>
>
>
>   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?
>
>
>
>
>
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
>
>
> --
> Thank you  with regards,
> Gopal,
>
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
>
>
> --
> Thank you  with regards,
> Gopal,
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>


-- 
Thank you  with regards,
Gopal,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20081004/bc69ae61/attachment-0002.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: event.php
Type: application/octet-stream
Size: 1299 bytes
Desc: not available
Url : http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20081004/bc69ae61/attachment-0002.obj 


More information about the FreeSWITCH-users mailing list