I’d like to solicit some insight/ideas on the best way to reliably defer the origination of a single call leg when using the bridge command. Our requirement is to ring a sip phone and a mobile app running on iOS. The iOS device can be in one of three states; actively running and registered, backgrounded, or simply not running. We are using Apple’s Call Kit feature to deliver a push notification to the device, which prompts the application to wake up and register to Freeswitch (if it’s not already running and registered).
A few things:
1. We want the user experience to be such that when the mobile application or desk phone is answered, the others stops ringing immediately.
2. We would prefer to use a single bridge command, so we can ensure things like “execute_on_answer” are only executed by the winning extensions and only once.
3. We would prefer to use a single bridge command, so we can control the overall timeout of the ring time (despite any possible differences in call setup latency between legs).
4. The mobile app does not share the same SIP credentials with the SIP phone, so it appears as a separate extension to Freeswitch.
Here’s the idea (using Perl + Event Socket):
send_a_callkit_push_notification();
execute('bridge', "{originate_timeout=60}user/deskphone\@domain,[leg_timeout=10]user/mobileapp\@domain,[leg_delay_start=10]user/mobileapp\@domain");
Given that we want both deskphone and mobileapp to ring, and then try mobileapp again after 10 seconds (along side deskphone, if it's still ringing), we are using a single bridge command. We are trying to defer the third call attempt, but have not found a reliable way to defer it. “leg_delay_start” is close, but when the other two channels are offline, it does not work the way we need.. Other than leg_delay_start, we’ve unsuccessfully tried using various combinations of “originate_delay_start", "originate_retries”, “originate_retry_sleep_ms”, and . We’ve even rolled the dice with the undocumented ”api_on_pre_originate” to see if we can get it to run “sleep 10” :)
At the end of the day, all we’re just looking for is a way to ensure one of the calls legs always waits at least 10 seconds before dialing out, without interfering with other call legs that may be ringing alongside it.. Has anyone encountered this situation? any recommendations?
Thanks!