[Freeswitch-users] Detecting multiple tones with freeswitch

Bunea Lucian lucibunea at gmail.com
Mon Jan 5 23:32:25 MSK 2015

I have a dedicated short number and multiple DIDs. I also have a 
database with customer phone numbers and their corresponding DIDs.
Each field agent has a mobile phone (from the same provider).
When a call comes in freeswitch automatically routes the call to the 
designated field agent via the corresponding DID.
I want to monitor what happens with the call after that, to be able to 
decide what to do with the call next.
So basically, the call never leaves the provider's network.

Btw, I did asked the provider to switch back the settings but the 
feedback was:
"The behavior is normal because for calls made inside Vodafone network, 
we generate tones. Thus, for Busy, we play specific tone and then 
disconnect the call, signaling with SIP 480 (corresponding to the end of 
announcement). If a call comes from another network, User Busy is 
signaled on ISUP and SIP returned as such. The settings can not be 
changed per customer. "
Unofficially, they acknowledged that their PBX behaved differently 
before because it was not correctly configured.

PS: My provider sends the description of the tones using a reason header 
inside the SIP/183 message. But I was unable to find a way to extract it:


-------- Original Message --------
*Subject: *Re: [Freeswitch-users] Detecting multiple tones with freeswitch
*From: *Michael Jerris <mike at jerris.com>
*To: *FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
*Date: *05.01.2015 20:02
> You can never reliably depend on the tones, particularly with international traffic.  This is never going to work reliably unless you get useful sip signaling.  I would be demanding the carrier change settings back.
>> On Jan 3, 2015, at 7:46 AM, Bunea Lucian <lucibunea at gmail.com> wrote:
>> Hello,
>> My SIP provider (Vodafone) decided to make me a Christmas present: they
>> change the configuration of their SIP server.
>> Using the old configuration they were sending SIP codes for decline,
>> busy and unavailable.
>> Now they are sending early media with tones (for decline and busy) and a
>> one minute message for unavailable.
>> Each status is followed by a SIP/480.
>> Since I need to be able to distinguish between different statuses, I
>> have determined the following:
>> - if I don't receive a ring tone within 7 second, the called number is
>> unavailable;
>> - if I receive a busy tone within 4 seconds the called number is busy;
>> - if I receive a busy tone after 4 second the call number has declined
>> the call;
>> This is how I tried to implement it:
>> - after receiving early media (SIP/180 or SIP/183) a timer is started
>> for call hangup (sched_hangup)
>> - if I receive a ring tone within 7 seconds the timer is canceled
>> (sched_cancel);
>> - if I receive a busy tone a lua script is called;
>> <action application="set" data="sip_ignore_remote_cause=true"/>
>> <action application="set" data="execute_on_media=sched_hangup +7
>> <action application="tone_detect" data="busy 425 w +60000 lua
>> 'busy_detected.lua ${uuid} ${created_time}' 2"/>
>> <action application="tone_detect" data="ring 450 w +7000 sched_cancel"/>
>> <action application="bridge"
>> data="sofia/external/${destination_number}@XXX.XXX.XXX.XXX"/>
>> But, for some reason, the tones are detected, but the applications are
>> never called.
>> If I add one of the following lines to the dialplan the corresponding
>> application is called:
>>   <action application="set" data="execute_on_tone_detect=sched_cancel"/>
>> or
>>   <action application="set" data="execute_on_tone_detect=lua
>> busy_detected.lua ${uuid} ${created_time}"/>
>> but I can't tell which tone was detected...
>> What am I missing?
>> PS: Tested with FreeSWITCH Version 1.4.14-1~64bit.
>>   Regards,
>> Lucian
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.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/20150105/0d5fd03f/attachment.html 

Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list