Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] get channel status

Goto page Previous  1, 2
 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
saigop at gmail.com
Guest





PostPosted: Fri Oct 03, 2008 1:15 pm    Post subject: [Freeswitch-users] get channel status Reply with quote

Please find the attached PHP file

On Fri, Oct 3, 2008 at 11:29 PM, Michael Collins <mcollins@fcnetwork.com (mcollins@fcnetwork.com)> wrote:
Quote:

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@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 10:33 AM
To: freeswitch-users@lists.freeswitch.org (freeswitch-users@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@172.20.176.254 (9894929942@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@172.20.176.254 (1001@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@freeswitch.org (brian@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@gmail.com (saigop@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@lists.freeswitch.org (Freeswitch-users@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@lists.freeswitch.org (Freeswitch-users@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,
Back to top
mcollins at fcnetwork.com
Guest





PostPosted: Fri Oct 03, 2008 2:29 pm    Post subject: [Freeswitch-users] get channel status Reply with quote

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@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 11:07 AM
To: freeswitch-users@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@fcnetwork.com (mcollins@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@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 10:33 AM

To: freeswitch-users@lists.freeswitch.org (freeswitch-users@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@172.20.176.254 (9894929942@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@172.20.176.254 (1001@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@freeswitch.org (brian@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@gmail.com (saigop@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@lists.freeswitch.org (Freeswitch-users@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@lists.freeswitch.org (Freeswitch-users@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,
Back to top
saigop at gmail.com
Guest





PostPosted: Sat Oct 04, 2008 8:17 am    Post subject: [Freeswitch-users] get channel status Reply with quote

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@fcnetwork.com (mcollins@fcnetwork.com)> wrote:
Quote:

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@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 11:07 AM

To: freeswitch-users@lists.freeswitch.org (freeswitch-users@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@fcnetwork.com (mcollins@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@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 10:33 AM

To: freeswitch-users@lists.freeswitch.org (freeswitch-users@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@172.20.176.254 (9894929942@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@172.20.176.254 (1001@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@freeswitch.org (brian@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@gmail.com (saigop@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@lists.freeswitch.org (Freeswitch-users@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@lists.freeswitch.org (Freeswitch-users@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@lists.freeswitch.org (Freeswitch-users@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,
Back to top
msc at freeswitch.org
Guest





PostPosted: Sat Oct 04, 2008 3:26 pm    Post subject: [Freeswitch-users] get channel status Reply with quote

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.


-MC

Sent from my iPhone

On Oct 4, 2008, at 6:15 AM, "Gopal krishnan" <saigop@gmail.com (saigop@gmail.com)> wrote:



Quote:
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 <[url=mailto:mcollins@fcnetwork.com]mcollins@fcnetwork.com (mcollins@fcnetwork.com)[/url]> wrote:
Quote:

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: [url=mailto:freeswitch-users-bounces@lists.freeswitch.org]freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)[/url] [mailto:[url=mailto:freeswitch-users-bounces@lists.freeswitch.org]freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)[/url]] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 11:07 AM

To: [url=mailto:freeswitch-users@lists.freeswitch.org]freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)[/url]
Subject: Re: [Freeswitch-users] get channel status





Please find the attached PHP file
On Fri, Oct 3, 2008 at 11:29 PM, Michael Collins <[url=mailto:mcollins@fcnetwork.com]mcollins@fcnetwork.com (mcollins@fcnetwork.com)[/url]> 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: [url=mailto:freeswitch-users-bounces@lists.freeswitch.org]freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)[/url] [mailto:[url=mailto:freeswitch-users-bounces@lists.freeswitch.org]freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)[/url]] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 10:33 AM

To: [url=mailto:freeswitch-users@lists.freeswitch.org]freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)[/url]

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/[url=mailto:9894929942@172.20.176.254]9894929942@172.20.176.254 (9894929942@172.20.176.254)[/url] 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/[url=mailto:1001@172.20.176.254]1001@172.20.176.254 (1001@172.20.176.254)[/url] 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 <[url=mailto:brian@freeswitch.org]brian@freeswitch.org (brian@freeswitch.org)[/url]> 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 <[url=mailto:saigop@gmail.com]saigop@gmail.com (saigop@gmail.com)[/url]> 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
[url=mailto:Freeswitch-users@lists.freeswitch.org]Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)[/url]
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
[url=mailto:Freeswitch-users@lists.freeswitch.org]Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)[/url]
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
[url=mailto:Freeswitch-users@lists.freeswitch.org]Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)[/url]
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,




<event.php>
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

Back to top
yudha2008 at gmail.com
Guest





PostPosted: Tue Oct 07, 2008 6:04 am    Post subject: [Freeswitch-users] get channel status Reply with quote

Hi,
By giving events all command in a php socket program i get all the events in the GUI itself. But i need to pickup only Answer state from the output.

$status1 = "events all \r\n\r\n";
echo "command is $status1";
fwrite($handle, $status1);
$response = fread($handle, 10240);
echo "command sent, got response:<br> $response<br>";

I get the Answer state in Perl script please some one help in through php script

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 .

2008/10/5 Michael S Collins <msc@freeswitch.org (msc@freeswitch.org)>
Quote:
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.


-MC

Sent from my iPhone


On Oct 4, 2008, at 6:15 AM, "Gopal krishnan" <saigop@gmail.com (saigop@gmail.com)> wrote:



Quote:
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@fcnetwork.com)mcollins@fcnetwork.com (mcollins@fcnetwork.com)> wrote:
Quote:

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@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto: (freeswitch-users-bounces@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 11:07 AM

To: (freeswitch-users@lists.freeswitch.org)freeswitch-users@lists.freeswitch.org (freeswitch-users@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@fcnetwork.com)mcollins@fcnetwork.com (mcollins@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@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto: (freeswitch-users-bounces@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 10:33 AM

To: (freeswitch-users@lists.freeswitch.org)freeswitch-users@lists.freeswitch.org (freeswitch-users@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@172.20.176.254)9894929942@172.20.176.254 (9894929942@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@172.20.176.254)1001@172.20.176.254 (1001@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@freeswitch.org)brian@freeswitch.org (brian@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@gmail.com)saigop@gmail.com (saigop@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@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org



--
Thank you with regards,
Gopal,








_______________________________________________
Freeswitch-users mailing list
(Freeswitch-users@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org



--
Thank you with regards,
Gopal,






_______________________________________________
Freeswitch-users mailing list
(Freeswitch-users@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org




--
Thank you with regards,
Gopal,




<event.php>
Quote:
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




--
Warm Regards,
N.Baskar
Back to top
saigop at gmail.com
Guest





PostPosted: Mon Oct 13, 2008 1:11 am    Post subject: [Freeswitch-users] get channel status Reply with quote

Hi,

Is it possible to get the answer state like the below by using uuid


Answer state : ringing


Answer state: answered


Answer state: hangup




On Tue, Oct 7, 2008 at 4:32 PM, Baskar <yudha2008@gmail.com (yudha2008@gmail.com)> wrote:
Quote:
Hi,
By giving events all command in a php socket program i get all the events in the GUI itself. But i need to pickup only Answer state from the output.

$status1 = "events all \r\n\r\n";
echo "command is $status1";
fwrite($handle, $status1);
$response = fread($handle, 10240);
echo "command sent, got response:<br> $response<br>";

I get the Answer state in Perl script please some one help in through php script

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 .

2008/10/5 Michael S Collins <msc@freeswitch.org (msc@freeswitch.org)>

Quote:
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.


-MC

Sent from my iPhone


On Oct 4, 2008, at 6:15 AM, "Gopal krishnan" <saigop@gmail.com (saigop@gmail.com)> wrote:



Quote:
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@fcnetwork.com)mcollins@fcnetwork.com (mcollins@fcnetwork.com)> wrote:
Quote:

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@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto: (freeswitch-users-bounces@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 11:07 AM

To: (freeswitch-users@lists.freeswitch.org)freeswitch-users@lists.freeswitch.org (freeswitch-users@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@fcnetwork.com)mcollins@fcnetwork.com (mcollins@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@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto: (freeswitch-users-bounces@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 10:33 AM

To: (freeswitch-users@lists.freeswitch.org)freeswitch-users@lists.freeswitch.org (freeswitch-users@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@172.20.176.254)9894929942@172.20.176.254 (9894929942@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@172.20.176.254)1001@172.20.176.254 (1001@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@freeswitch.org)brian@freeswitch.org (brian@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@gmail.com)saigop@gmail.com (saigop@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@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org



--
Thank you with regards,
Gopal,








_______________________________________________
Freeswitch-users mailing list
(Freeswitch-users@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org



--
Thank you with regards,
Gopal,






_______________________________________________
Freeswitch-users mailing list
(Freeswitch-users@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org




--
Thank you with regards,
Gopal,




<event.php>
Quote:
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org






--
Warm Regards,
N.Baskar



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@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,
Back to top
saigop at gmail.com
Guest





PostPosted: Mon Oct 13, 2008 2:26 am    Post subject: [Freeswitch-users] get channel status Reply with quote

Hi,

I can able to see the events log as I disussed in IRC thru events plain CHANNEL_CREATE CHANNEL_ANSWER CHANNEL_DESTROY


The logs were pasted in http://pastebin.freeswitch.org/5823


But I cant able to get the status of the destination channel.


for example If I am dialing from a extension 1002 (source) to outbound number 9894929942 (Destination) I cant able to get the status of the destination number.


I am using event socket for originating a call.


My final goal is to display the outbound call status in the php program whether the destination call is ringing or answered or hangup.


Any help would be appreciated. Thanks

On Mon, Oct 13, 2008 at 11:26 AM, Gopal krishnan <saigop@gmail.com (saigop@gmail.com)> wrote:
Quote:
Hi,

Is it possible to get the answer state like the below by using uuid


Answer state : ringing


Answer state: answered


Answer state: hangup





On Tue, Oct 7, 2008 at 4:32 PM, Baskar <yudha2008@gmail.com (yudha2008@gmail.com)> wrote:
Quote:
Hi,
By giving events all command in a php socket program i get all the events in the GUI itself. But i need to pickup only Answer state from the output.

$status1 = "events all \r\n\r\n";
echo "command is $status1";
fwrite($handle, $status1);
$response = fread($handle, 10240);
echo "command sent, got response:<br> $response<br>";

I get the Answer state in Perl script please some one help in through php script

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 .

2008/10/5 Michael S Collins <msc@freeswitch.org (msc@freeswitch.org)>

Quote:
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.


-MC

Sent from my iPhone


On Oct 4, 2008, at 6:15 AM, "Gopal krishnan" <saigop@gmail.com (saigop@gmail.com)> wrote:



Quote:
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@fcnetwork.com)mcollins@fcnetwork.com (mcollins@fcnetwork.com)> wrote:
Quote:

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@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto: (freeswitch-users-bounces@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 11:07 AM

To: (freeswitch-users@lists.freeswitch.org)freeswitch-users@lists.freeswitch.org (freeswitch-users@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@fcnetwork.com)mcollins@fcnetwork.com (mcollins@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@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto: (freeswitch-users-bounces@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 10:33 AM

To: (freeswitch-users@lists.freeswitch.org)freeswitch-users@lists.freeswitch.org (freeswitch-users@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@172.20.176.254)9894929942@172.20.176.254 (9894929942@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@172.20.176.254)1001@172.20.176.254 (1001@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@freeswitch.org)brian@freeswitch.org (brian@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@gmail.com)saigop@gmail.com (saigop@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@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org



--
Thank you with regards,
Gopal,








_______________________________________________
Freeswitch-users mailing list
(Freeswitch-users@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org



--
Thank you with regards,
Gopal,






_______________________________________________
Freeswitch-users mailing list
(Freeswitch-users@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org




--
Thank you with regards,
Gopal,




<event.php>
Quote:
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org






--
Warm Regards,
N.Baskar



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@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,








--
Thank you with regards,
Gopal,
Back to top
saigop at gmail.com
Guest





PostPosted: Mon Oct 13, 2008 3:47 am    Post subject: [Freeswitch-users] get channel status Reply with quote

Hi,

Let me explain bit more clear,


I was dialing thru event socket in telnet. The events command I have given is


events plain CHANNEL_CREATE CHANNEL_ANSWER CHANNEL_DESTROY

for the above said command the events are coming only for my internal extensions, when the called outbound number answers the events are not getting parsed inside the telnet.


If I am doing anything wrong?

On Mon, Oct 13, 2008 at 12:55 PM, Gopal krishnan <saigop@gmail.com (saigop@gmail.com)> wrote:
Quote:
Hi,

I can able to see the events log as I disussed in IRC thru events plain CHANNEL_CREATE CHANNEL_ANSWER CHANNEL_DESTROY


The logs were pasted in http://pastebin.freeswitch.org/5823


But I cant able to get the status of the destination channel.


for example If I am dialing from a extension 1002 (source) to outbound number 9894929942 (Destination) I cant able to get the status of the destination number.


I am using event socket for originating a call.


My final goal is to display the outbound call status in the php program whether the destination call is ringing or answered or hangup.


Any help would be appreciated. Thanks


On Mon, Oct 13, 2008 at 11:26 AM, Gopal krishnan <saigop@gmail.com (saigop@gmail.com)> wrote:
Quote:
Hi,

Is it possible to get the answer state like the below by using uuid


Answer state : ringing


Answer state: answered


Answer state: hangup





On Tue, Oct 7, 2008 at 4:32 PM, Baskar <yudha2008@gmail.com (yudha2008@gmail.com)> wrote:
Quote:
Hi,
By giving events all command in a php socket program i get all the events in the GUI itself. But i need to pickup only Answer state from the output.

$status1 = "events all \r\n\r\n";
echo "command is $status1";
fwrite($handle, $status1);
$response = fread($handle, 10240);
echo "command sent, got response:<br> $response<br>";

I get the Answer state in Perl script please some one help in through php script

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 .

2008/10/5 Michael S Collins <msc@freeswitch.org (msc@freeswitch.org)>

Quote:
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.


-MC

Sent from my iPhone


On Oct 4, 2008, at 6:15 AM, "Gopal krishnan" <saigop@gmail.com (saigop@gmail.com)> wrote:



Quote:
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@fcnetwork.com)mcollins@fcnetwork.com (mcollins@fcnetwork.com)> wrote:
Quote:

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@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto: (freeswitch-users-bounces@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 11:07 AM

To: (freeswitch-users@lists.freeswitch.org)freeswitch-users@lists.freeswitch.org (freeswitch-users@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@fcnetwork.com)mcollins@fcnetwork.com (mcollins@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@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto: (freeswitch-users-bounces@lists.freeswitch.org)freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Gopal krishnan
Sent: Friday, October 03, 2008 10:33 AM

To: (freeswitch-users@lists.freeswitch.org)freeswitch-users@lists.freeswitch.org (freeswitch-users@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@172.20.176.254)9894929942@172.20.176.254 (9894929942@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@172.20.176.254)1001@172.20.176.254 (1001@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@freeswitch.org)brian@freeswitch.org (brian@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@gmail.com)saigop@gmail.com (saigop@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@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org



--
Thank you with regards,
Gopal,








_______________________________________________
Freeswitch-users mailing list
(Freeswitch-users@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org



--
Thank you with regards,
Gopal,






_______________________________________________
Freeswitch-users mailing list
(Freeswitch-users@lists.freeswitch.org)Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
[/url][url=http://lists.freeswitch.org/mailman/listinfo/freeswitch-users]http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
[/url][url=http://www.freeswitch.org]http://www.freeswitch.org




--
Thank you with regards,
Gopal,




<event.php>
Quote:
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:[/url][url=http://lists.freeswitch.org/mailman/options/freeswitch-users]http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org






--
Warm Regards,
N.Baskar



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (Freeswitch-users@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,








--
Thank you with regards,
Gopal,








--
Thank you with regards,
Gopal,
PeopleTech Systems Private Limited
www.peopletech.co.in
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services