[Freeswitch-users] Difference between ESL execute() andexecuteAsync()

Anthony Minessale anthony.minessale at gmail.com
Mon Dec 21 07:42:30 PST 2009


if you run the socket in async mode, every call to execute is async
if you don't specify async in the socket app in FS all calls are synchronous
but you can send async calls with te asyncExecute


On Sat, Dec 19, 2009 at 9:16 PM, Ron McLeod <ron.freeswitch at mcleodnet.com>wrote:

> Here's the ES network trace:
>
> Content-Length: 1502
> Content-Type: text/event-plain
> Event-Name: CHANNEL_STATE
> Core-UUID: bb9ea62a-ed02-11de-91b1-8b7cb185f66f
> FreeSWITCH-Hostname: ron-laptop
> FreeSWITCH-IPv4: 192.168.100.132
> FreeSWITCH-IPv6: %3A%3A1
> Event-Date-Local: 2009-12-19%2019%3A12%3A09
> Event-Date-GMT: Sun,%2020%20Dec%202009%2003%3A12%3A09%20GMT
> Event-Date-Timestamp: 1261278729767397
> Event-Calling-File: switch_channel.c
> Event-Calling-Function: switch_channel_perform_set_running_state
> Event-Calling-Line-Number: 1024
> Channel-State: CS_ROUTING
> Channel-State-Number: 2
> Channel-Name: sofia/internal/699%40192.168.100.132
> Unique-ID: 76021ab2-ed15-11de-91b1-8b7cb185f66f
> Call-Direction: inbound
> Presence-Call-Direction: inbound
> Answer-State: ringing
> Channel-Read-Codec-Name: PCMU
> Channel-Read-Codec-Rate: 8000
> Channel-Write-Codec-Name: PCMU
> Channel-Write-Codec-Rate: 8000
> Caller-Username: 699
> Caller-Dialplan: XML
> Caller-Caller-ID-Name: Ron%20Soft%20Phone
> Caller-Caller-ID-Number: 699
> Caller-Network-Addr: 192.168.100.3
> Caller-Destination-Number: 444
> Caller-Unique-ID: 76021ab2-ed15-11de-91b1-8b7cb185f66f
> Caller-Source: mod_sofia
> Caller-Context: mytest
> Caller-Channel-Name: sofia/internal/699%40192.168.100.132
> Caller-Profile-Index: 1
> Caller-Profile-Created-Time: 1261278729764077
> Caller-Channel-Created-Time: 1261278729764077
> Caller-Channel-Answered-Time: 0
> Caller-Channel-Progress-Time: 0
> Caller-Channel-Progress-Media-Time: 0
> Caller-Channel-Hangup-Time: 0
> Caller-Channel-Transfer-Time: 0
> Caller-Screen-Bit: true
> Caller-Privacy-Hide-Name: false
> Caller-Privacy-Hide-Number: false
>
>
> sendmsg 76021ab2-ed15-11de-91b1-8b7cb185f66f
> call-command: execute
> execute-app-name: answer
> execute-app-arg:
>
>
> Content-Type: command/reply
> Reply-Text: +OK
>
>
> sendmsg 76021ab2-ed15-11de-91b1-8b7cb185f66f
> call-command: execute
> execute-app-name: playback
> execute-app-arg: /tmp/ann.wav
>
>
> Content-Type: command/reply
> Reply-Text: +OK
>
>
> > -----Original Message-----
> > From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-
> > users-bounces at lists.freeswitch.org] On Behalf Of Ron McLeod
> > Sent: Saturday, December 19, 2009 5:30 PM
> > To: freeswitch-users at lists.freeswitch.org
> > Subject: [Freeswitch-users] Difference between ESL execute()
> > andexecuteAsync()
> >
> > I don't notice any different in behavior between execute() and
> > executeAsync().  I was expecting that executeAsync() would return
> > right-away, and that execute() would only return after the specified
> > application runs to completion (CHANNEL_EXECUTE_COMPLETE event).
> >
> > Running the sample app below, I see the "About to call execute(playback)"
> > and "returned" displayed one right-after the other, even though the file
> > being played takes about 4 minutes to play-out.
> >
> > Do I have this wrong, or is there something incorrect in my app?
> >
> > APP:
> > #!/usr/bin/php
> > <?php
> > require_once "ESL.php";
> >
> > $eventSocket = New ESLconnection('192.168.100.132', '8021', 'ClueCon');
> > $eventSocket->events('plain', 'CHANNEL_STATE');
> > $eventSocket->filter('channel-state', 'CS_ROUTING');
> >
> > // Wait for new call attempts
> > while($eventSocket->connected()){
> >     $event = $eventSocket->recvEvent();
> >     $serializedBody = $event->serialize();
> >     $listOfLines = toArrayOfLines($serializedBody);
> >     $nameValuePairs = toArrayOfNameValuePairs($listOfLines);
> >
> >     $uuid = $nameValuePairs['Caller-Unique-ID'];
> >     printf("New call from uuid: $uuid\n");
> >
> >     // answer the caller and play announcement
> >     $eventSocket->execute('answer', Null ,$uuid);
> >
> >     printf("About to call execute(playback)\n");
> >     $eventSocket->execute('playback', '/tmp/ann.wav', $uuid);
> >     printf("returned\n");
> > }
> > ?>
> >
> >
> > DIALPLAN:
> > <?xml version="1.0" encoding="utf-8"?>
> > <include>
> >   <context name="mytest">
> >     <extension name="mytest">
> >       <condition field="destination_number" expression="^.*$">
> >         <action application="park"/>
> >       </condition>
> >     </extension>
> >   </context>
> > </include>
> >
> >
> > _______________________________________________
> > 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
> >
> > --
> > This email was Anti Virus checked by Astaro Security Gateway.
> > http://www.astaro.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
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20091221/c369e10a/attachment-0002.html 


More information about the FreeSWITCH-users mailing list