using APNS with diaplan : throttle a call until a certain condition changes
Hi I am planing to use freeswitch with SIP clients on iPhone and I would like to use APNS to notify clients of incoming calls (so that clients can launch) When I receive an incoming call, I should look up in a DB the extension/phone device id, send a notification to it, waits until client logs on or a timeout is reached, then proceed to bridge the call to the extension. I could put this logic in a python script in the diaplan, that would block the execution of the dialplan. <action application="python" data="send_notification_and_wait.py"/> <action application="bridge" data="user/${user_data(${destination_number}@${domain_name} attr id)}@${domain_name}" /> I am wondering if this implementation would be acceptable regarding freeswitch design, or if diaplan/freeswitch offer cleaner ways to implement it. Regards. John
On Fri, Jun 8, 2012 at 2:31 AM, John Gathm <john.gathm@gmail.com> wrote:
I am wondering if this implementation would be acceptable regarding freeswitch design, or if diaplan/freeswitch offer cleaner ways to implement it.
What if you used your dialplan to try to call the phone and if you do NOT find it, park the call. Then you might use the event socket to watch for the parking of the call so you can send your notification. Next, use the event socket to watch for sofia registrations to know when the app has received the notification, launched and is ready to take calls. Once you get that event, unpark the call and send it on its way. Best, Gabe P.S. go python!
Hi Gabriel, Thanks for your answer so to summarize, I should (I did tome tries) 1) kind of park if failure - kind of replace the voicemail <action application="bridge" data="user/${user_data(${destination_number}@${domain_name} attr id)}@${domain_name}" /> <action application="answer" /> <action application="park"/> <!--<action application="sleep" data="1000" /> <action application="voicemail" data="default ${domain_name} ${dialed_extension}" />--> 2) subscribe to "event xml CHANNEL_PARK" Then I can get <Core-UUID>7e4fd02a-b260-11e1-9687-c13084909128</Core-UUID> <variable_dialed_user>1234</variable_dialed_user> (there the extension my dialplan initially transfered the call to) <Unique-ID>43cca2b4-b311-11e1-a4d1-c13084909128</Unique-ID> <Channel-Call-UUID>43cca2b4-b311-11e1-a4d1-c13084909128</Channel-Call-UUID> ==> which UDID is the one I should watch to be able to unpark the call ? ==> which command from mod_command should I then use to "resume" the call ? or transfer/bridge again to extension 1234 Regards, John On Sat, Jun 9, 2012 at 3:16 AM, Gabriel Gunderson <gabe@gundy.org> wrote:
On Fri, Jun 8, 2012 at 2:31 AM, John Gathm <john.gathm@gmail.com> wrote:
I am wondering if this implementation would be acceptable regarding freeswitch design, or if diaplan/freeswitch offer cleaner ways to implement it.
What if you used your dialplan to try to call the phone and if you do NOT find it, park the call. Then you might use the event socket to watch for the parking of the call so you can send your notification. Next, use the event socket to watch for sofia registrations to know when the app has received the notification, launched and is ready to take calls. Once you get that event, unpark the call and send it on its way.
Best, Gabe
P.S. go python!
_________________________________________________________________________ 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
Join Us At ClueCon - Aug 7-9, 2012
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
On Sun, Jun 10, 2012 at 1:48 PM, John Gathm <john.gathm@gmail.com> wrote:
so to summarize, I should (I did tome tries)
Keep in mind, I was just sharing ideas about a general approach, not a specific solution... so you may have to tinker a bit.
1) kind of park if failure - kind of replace the voicemail
More or less.
2) subscribe to "event xml CHANNEL_PARK" ==> which UDID is the one I should watch to be able to unpark the call ?
Check this against the 'show channels'
==> which command from mod_command should I then use to "resume" the call ? or transfer/bridge again to extension 1234
There are a number of ways you could do it. Bridging once you have both UUIDs is an option. http://wiki.freeswitch.org/wiki/Mod_commands#uuid_bridge Good luck, Gabe
participants (2)
-
Gabriel Gunderson
-
John Gathm