Make a call with Perl
Hi All I try to make a Perl Script which calls a certain external Phone number. It then should wait until someone picks up and play a sound file The user on the other end then needs to confirm the call with a pin Then another sound file should be played and the the call should be terminated. I tried several ways with ESL and originate. But I allays end up with a call I have no control over. I can read DTMF but can not hang up the call or play a second file. I think I am going in to a wrong direction. Any hints ? Regards Matthias -- Matthias Cramer / mc322-ripe Senior Network & Security Engineer iway AG Phone +41 43 500 1111 Badenerstrasse 569 Fax +41 44 271 3535 CH-8048 Zürich http://www.iway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250
You could try out Adhearsion (http://adhearsion.com). Everything you mention is easily done there. Regards, Ben Langfeld On 21 January 2013 15:19, Matthias Cramer <matthias.cramer@iway.ch> wrote:
Hi All
I try to make a Perl Script which calls a certain external Phone number. It then should wait until someone picks up and play a sound file The user on the other end then needs to confirm the call with a pin Then another sound file should be played and the the call should be terminated.
I tried several ways with ESL and originate. But I allays end up with a call I have no control over. I can read DTMF but can not hang up the call or play a second file.
I think I am going in to a wrong direction.
Any hints ?
Regards
Matthias
-- Matthias Cramer / mc322-ripe Senior Network & Security Engineer iway AG Phone +41 43 500 1111 Badenerstrasse 569 Fax +41 44 271 3535 CH-8048 Zürich http://www.iway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
If you have the FS Cookbook <http://link.packtpub.com/nuIOlX> then check out chapter 4, page 81. If you don't have the FS Cookbook then *SHAME* on you! :D Tip: you can download the examples from both books at the Packt Publishing website. The only caveat as far as I can tell is that you need to create a login account. Grab the examples for the Cookbook and look at chapter 4. The recipe is called "Launching a call with an inbound event socket connect" and it's written in - you guessed it - Perl. :) -MC On Mon, Jan 21, 2013 at 7:19 AM, Matthias Cramer <matthias.cramer@iway.ch>wrote:
Hi All
I try to make a Perl Script which calls a certain external Phone number. It then should wait until someone picks up and play a sound file The user on the other end then needs to confirm the call with a pin Then another sound file should be played and the the call should be terminated.
I tried several ways with ESL and originate. But I allays end up with a call I have no control over. I can read DTMF but can not hang up the call or play a second file.
I think I am going in to a wrong direction.
Any hints ?
Regards
Matthias
-- Matthias Cramer / mc322-ripe Senior Network & Security Engineer iway AG Phone +41 43 500 1111 Badenerstrasse 569 Fax +41 44 271 3535 CH-8048 Zürich http://www.iway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
-- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org http://www.ClueCon.com http://www.OSTAG.org
Hi Michael On 21/01/13 20:50, Michael Collins wrote:
If you have the FS Cookbook <http://link.packtpub.com/nuIOlX> then check out chapter 4, page 81. If you don't have the FS Cookbook then *SHAME* on you! :D
I've ordered the book, but it has not yet arrived... :-(
Tip: you can download the examples from both book at the Packt Publishing website. The only caveat as far as I can tell is that you need to create a login account.
You do not need a login... Could download them without one.
Grab the examples for the Cookbook and look at chapter 4. The recipe is called "Launching a call with an inbound event socket connect" and it's written in - you guessed it - Perl. :)
I started exactly with that example, I do an originate with &playback(). But I do not have real control over the call. I can not play anything else in the audio stream. And if the playback is finished the call hangs up ... Attached is the script I came up with so far ... Regards Matthias -- Matthias Cramer / mc322-ripe Senior Network & Security Engineer iway AG Phone +41 43 500 1111 Badenerstrasse 569 Fax +41 44 271 3535 CH-8048 Zürich http://www.iway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250
Hi Matthias, You ca use 2 scripts for More control Like 1. will Orginate the call 2. IVR Control #!/usr/bin/perl use DBI; require ESL; my $ph = "1000"; my $dialstr = "jagan.pl"; my $con = new ESL::ESLconnection("localhost", "8021", "ClueCon"); $con->api("perlrun", "$dialstr $ph"); 1; In jagan.pl You can Control your IVR and what ever you want I hope this will help you Thanks Jagadish On 22 January 2013 14:51, Matthias Cramer <matthias.cramer@iway.ch> wrote:
Hi Michael
On 21/01/13 20:50, Michael Collins wrote:
If you have the FS Cookbook <http://link.packtpub.com/nuIOlX> then check out chapter 4, page 81. If you don't have the FS Cookbook then *SHAME* on you! :D
I've ordered the book, but it has not yet arrived... :-(
Tip: you can download the examples from both book at the Packt Publishing website. The only caveat as far as I can tell is that you need to create a login account.
You do not need a login... Could download them without one.
Grab the examples for the Cookbook and look at chapter 4. The recipe is called "Launching a call with an inbound event socket connect" and it's written in - you guessed it - Perl. :)
I started exactly with that example, I do an originate with &playback(). But I do not have real control over the call. I can not play anything else in the audio stream.
And if the playback is finished the call hangs up ...
Attached is the script I came up with so far ...
Regards
Matthias
-- Matthias Cramer / mc322-ripe Senior Network & Security Engineer iway AG Phone +41 43 500 1111 Badenerstrasse 569 Fax +41 44 271 3535 CH-8048 Zürich http://www.iway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
I think you need to &park() the call and then send any other commands you want. If you do an originate + playback what will happen is that, once the call is answered, the playback is executed and then there's nothing else on the 'dialplan', so call gets dropped. Do an originate + park (or just originate), then using the uuid do an uuid_playback. The while/loop will also be executed. Finally, you have the option to use an api call (instead of a bgapi) so you don't move to the next action until the call is actually answered (blocking mode) -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Matthias Cramer Sent: Tuesday, January 22, 2013 4:21 AM To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] Make a call with Perl Hi Michael On 21/01/13 20:50, Michael Collins wrote:
If you have the FS Cookbook <http://link.packtpub.com/nuIOlX> then check out chapter 4, page 81. If you don't have the FS Cookbook then *SHAME* on you! :D
I've ordered the book, but it has not yet arrived... :-(
Tip: you can download the examples from both book at the Packt Publishing website. The only caveat as far as I can tell is that you need to create a login account.
You do not need a login... Could download them without one.
Grab the examples for the Cookbook and look at chapter 4. The recipe is called "Launching a call with an inbound event socket connect" and it's written in - you guessed it - Perl. :)
I started exactly with that example, I do an originate with &playback(). But I do not have real control over the call. I can not play anything else in the audio stream. And if the playback is finished the call hangs up ... Attached is the script I came up with so far ... Regards Matthias -- Matthias Cramer / mc322-ripe Senior Network & Security Engineer iway AG Phone +41 43 500 1111 Badenerstrasse 569 Fax +41 44 271 3535 CH-8048 Zürich http://www.iway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250
I'm not a perl expert, but in general I think you need to follow this pattern: 1) Establish the connection to FreeSWITCH, you'll be using the event socket on inbound mode 2) Start listening for the events you want to capture (send the 'event plain all' or 'event plain CHANNEL_ANSWER DTMF CHANNEL_HANGUP ...' command) 3) Create an uuid (by sending the create_uuid command) so you can identify which call you'll be listening events for 4) Add a filter for this uuid, so you'll only receive events for this call over this connection (filter Unique-ID + uuid) 5) originate the call: {origination_uuid= + uuid}sofia/internal/NXX@GATEWAY Check this simple perl example: http://wiki.freeswitch.org/wiki/Event_Socket_Library#Simple_Perl_Example -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Matthias Cramer Sent: Monday, January 21, 2013 10:20 AM To: freeswitch-users@lists.freeswitch.org Subject: [Freeswitch-users] Make a call with Perl Hi All I try to make a Perl Script which calls a certain external Phone number. It then should wait until someone picks up and play a sound file The user on the other end then needs to confirm the call with a pin Then another sound file should be played and the the call should be terminated. I tried several ways with ESL and originate. But I allays end up with a call I have no control over. I can read DTMF but can not hang up the call or play a second file. I think I am going in to a wrong direction. Any hints ? Regards Matthias -- Matthias Cramer / mc322-ripe Senior Network & Security Engineer iway AG Phone +41 43 500 1111 Badenerstrasse 569 Fax +41 44 271 3535 CH-8048 Zürich http://www.iway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250
Or the awesome example from the FreeSWITCH Cookbook... ;) -MC On Mon, Jan 21, 2013 at 2:17 PM, Hector Geraldino < Hector.Geraldino@ipsoft.com> wrote:
I'm not a perl expert, but in general I think you need to follow this pattern:
1) Establish the connection to FreeSWITCH, you'll be using the event socket on inbound mode 2) Start listening for the events you want to capture (send the 'event plain all' or 'event plain CHANNEL_ANSWER DTMF CHANNEL_HANGUP ...' command) 3) Create an uuid (by sending the create_uuid command) so you can identify which call you'll be listening events for 4) Add a filter for this uuid, so you'll only receive events for this call over this connection (filter Unique-ID + uuid) 5) originate the call: {origination_uuid= + uuid}sofia/internal/NXX@GATEWAY
Check this simple perl example:
http://wiki.freeswitch.org/wiki/Event_Socket_Library#Simple_Perl_Example
-----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Matthias Cramer Sent: Monday, January 21, 2013 10:20 AM To: freeswitch-users@lists.freeswitch.org Subject: [Freeswitch-users] Make a call with Perl
Hi All
I try to make a Perl Script which calls a certain external Phone number. It then should wait until someone picks up and play a sound file The user on the other end then needs to confirm the call with a pin Then another sound file should be played and the the call should be terminated.
I tried several ways with ESL and originate. But I allays end up with a call I have no control over. I can read DTMF but can not hang up the call or play a second file.
I think I am going in to a wrong direction.
Any hints ?
Regards
Matthias
-- Matthias Cramer / mc322-ripe Senior Network & Security Engineer iway AG Phone +41 43 500 1111 Badenerstrasse 569 Fax +41 44 271 3535 CH-8048 Zürich http://www.iway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
-- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org http://www.ClueCon.com http://www.OSTAG.org
Correctly. This is the general usage for any ESL connection, regardless of the client's language. Setting your own UUID is optional, but does avoid a race condition where you might miss events for the call before you manage to subscribe for them. Just another note: use the originate API and execute it with the bgapi ESL command - the command will return instantly and let you collect the events before the orginate succeeds/fails. Also connect in async mode. If you're initiating multiple calls I also highly recommend you write your system in such a way that worker script(s) connect via ESL and keep persistent connections open. Originate multiple calls through the same socket. It'll result in fewer connections open which'll be better load-wise, and since connections will already be open will save a few ms on starting the call up. On the client it means fewer processes running, so fewer context-switches therefore will scale better client-side as well as server-side. And of course there's a limit on the number of processes too. -Steve On 21 January 2013 22:17, Hector Geraldino <Hector.Geraldino@ipsoft.com>wrote:
I'm not a perl expert, but in general I think you need to follow this pattern:
1) Establish the connection to FreeSWITCH, you'll be using the event socket on inbound mode 2) Start listening for the events you want to capture (send the 'event plain all' or 'event plain CHANNEL_ANSWER DTMF CHANNEL_HANGUP ...' command) 3) Create an uuid (by sending the create_uuid command) so you can identify which call you'll be listening events for 4) Add a filter for this uuid, so you'll only receive events for this call over this connection (filter Unique-ID + uuid) 5) originate the call: {origination_uuid= + uuid}sofia/internal/NXX@GATEWAY
Check this simple perl example:
http://wiki.freeswitch.org/wiki/Event_Socket_Library#Simple_Perl_Example
-----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto: freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Matthias Cramer Sent: Monday, January 21, 2013 10:20 AM To: freeswitch-users@lists.freeswitch.org Subject: [Freeswitch-users] Make a call with Perl
Hi All
I try to make a Perl Script which calls a certain external Phone number. It then should wait until someone picks up and play a sound file The user on the other end then needs to confirm the call with a pin Then another sound file should be played and the the call should be terminated.
I tried several ways with ESL and originate. But I allays end up with a call I have no control over. I can read DTMF but can not hang up the call or play a second file.
I think I am going in to a wrong direction.
Any hints ?
Regards
Matthias
-- Matthias Cramer / mc322-ripe Senior Network & Security Engineer iway AG Phone +41 43 500 1111 Badenerstrasse 569 Fax +41 44 271 3535 CH-8048 Zürich http://www.iway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
if we have limitation on socket it will be the issue while Originating Bulk calls, so in my point there is no need collecting the Information in Single script. if we use 2 scripts for Bulk calls one is for just Origination not collecting any event from ESL, One script will taking care of IVR or what ever we want to perform. This is Working me for. On 23 January 2013 00:16, Steven Ayre <steveayre@gmail.com> wrote:
Correctly. This is the general usage for any ESL connection, regardless of the client's language.
Setting your own UUID is optional, but does avoid a race condition where you might miss events for the call before you manage to subscribe for them.
Just another note: use the originate API and execute it with the bgapi ESL command - the command will return instantly and let you collect the events before the orginate succeeds/fails.
Also connect in async mode.
If you're initiating multiple calls I also highly recommend you write your system in such a way that worker script(s) connect via ESL and keep persistent connections open. Originate multiple calls through the same socket. It'll result in fewer connections open which'll be better load-wise, and since connections will already be open will save a few ms on starting the call up. On the client it means fewer processes running, so fewer context-switches therefore will scale better client-side as well as server-side. And of course there's a limit on the number of processes too.
-Steve
On 21 January 2013 22:17, Hector Geraldino <Hector.Geraldino@ipsoft.com> wrote:
I'm not a perl expert, but in general I think you need to follow this pattern:
1) Establish the connection to FreeSWITCH, you'll be using the event socket on inbound mode 2) Start listening for the events you want to capture (send the 'event plain all' or 'event plain CHANNEL_ANSWER DTMF CHANNEL_HANGUP ...' command) 3) Create an uuid (by sending the create_uuid command) so you can identify which call you'll be listening events for 4) Add a filter for this uuid, so you'll only receive events for this call over this connection (filter Unique-ID + uuid) 5) originate the call: {origination_uuid= + uuid}sofia/internal/NXX@GATEWAY
Check this simple perl example:
http://wiki.freeswitch.org/wiki/Event_Socket_Library#Simple_Perl_Example
-----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Matthias Cramer Sent: Monday, January 21, 2013 10:20 AM To: freeswitch-users@lists.freeswitch.org Subject: [Freeswitch-users] Make a call with Perl
Hi All
I try to make a Perl Script which calls a certain external Phone number. It then should wait until someone picks up and play a sound file The user on the other end then needs to confirm the call with a pin Then another sound file should be played and the the call should be terminated.
I tried several ways with ESL and originate. But I allays end up with a call I have no control over. I can read DTMF but can not hang up the call or play a second file.
I think I am going in to a wrong direction.
Any hints ?
Regards
Matthias
-- Matthias Cramer / mc322-ripe Senior Network & Security Engineer iway AG Phone +41 43 500 1111 Badenerstrasse 569 Fax +41 44 271 3535 CH-8048 Zürich http://www.iway.ch/ GnuPG 1024D/2D208250 = DBC6 65B6 7083 1029 781E 3959 B62F DF1C 2D20 8250
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list 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
participants (6)
-
Ben Langfeld
-
Hector Geraldino
-
Jagadish Thoutam
-
Matthias Cramer
-
Michael Collins
-
Steven Ayre