I'm with Jerris on the reliability issue, but if you can't switch carriers and they won't budge on sending the audio inline then you're pretty much stuck with what you've got. I do know that the tone_detect app works well. It's been years since I've done anything with it so I'm a bit rusty. In your case what I would do is use the execute_on_tone_detect to issue an info app. I think you might have a value in there somewhere that will help you differentiate between whether busy or ring was detected.

I wish you well. This is not a fun endeavor...

-MC


On Mon, Jan 5, 2015 at 12:32 PM, Bunea Lucian <lucibunea@gmail.com> wrote:
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:

http://lists.freeswitch.org/pipermail/freeswitch-users/2014-March/103645.html



-------- Original Message --------
Subject: Re: [Freeswitch-users] Detecting multiple tones with freeswitch
From: Michael Jerris <mike@jerris.com>
To: FreeSWITCH Users Help <freeswitch-users@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@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 
SUBSCRIBER_ABSENT"/>

<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@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@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@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org