[Freeswitch-users] Make a call with Perl

Steven Ayre steveayre at gmail.com
Tue Jan 22 21:46:56 MSK 2013


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 at 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 at GATEWAY
>
> Check this simple perl example:
>
> http://wiki.freeswitch.org/wiki/Event_Socket_Library#Simple_Perl_Example
>
>
> -----Original Message-----
> From: freeswitch-users-bounces at lists.freeswitch.org [mailto:
> freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Matthias
> Cramer
> Sent: Monday, January 21, 2013 10:20 AM
> To: freeswitch-users at 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 at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130122/153777f7/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list