Variable monitor early media ring

From FreeSWITCH Wiki
Jump to: navigation, search

("ABOVE IS WRONG" section archived on Talk page 2012.01.29)


Work in progress below...

monitor_early_media_ring

Monitors early media for a user-specific ring tone. Each time the tone is heard, the switch will increment an internal counter for that leg. Once the counter reaches monitor_early_media_ring_total (or this variable has not been set) then the early media will be sent.

The syntax is a series of ! delimited early media conditions in the following format:

condition_name:number_of_hits:tone_detect_frequencies

condition_name

Optional? user-defined name for the error condition

number_of_hits

the number frequencies for the tone detector to find before considering it a hit. 1:400.0+480.0 means the ring count is incremented if 400hz OR 480hz is detected. 2:400.0+480.0 means the ring count is incremented if 400 hz AND 480 hz are detected.

tone_detect_frequencies

the frequencies to listen for (delimited by + instead of ,). Examples are 400.0+480.0 [for a US Ring] See tone_detect

NOTE: this variable only works when ignore_early_media is not present.


Usage:

<action application="bridge" data="{monitor_early_media_ring_total=3,monitor_early_media_ring=usring:1:440.0+480.0!ukring:2:400+450}sofia/gateway/yourgateway/1239@conference.freeswitch.org"/>

This will bridge to a special conference that rings (US_RING) 10 times, and then plays the Star Wars Imperial March. You may optionally call 1239a@conference.freeswitch.org to test a UK_RING. A successful log looks like:

2010-10-22 10:26:53.975865 [DEBUG] switch_ivr_originate.c:614 sofia/internal/1239@conference.freeswitch.org setting ring total to 3
2010-10-22 10:26:55.007970 [DEBUG] switch_rtp.c:2544 Correct ip/port confirmed.
2010-10-22 10:26:56.427869 [DEBUG] switch_ivr_async.c:2424 TONE monitor_early_media_ring_2 HIT 1/2
2010-10-22 10:27:01.707869 [DEBUG] switch_ivr_async.c:2424 TONE monitor_early_media_ring_2 HIT 1/2
2010-10-22 10:27:02.667868 [DEBUG] switch_ivr_async.c:2424 TONE monitor_early_media_ring_2 HIT 2/2
2010-10-22 10:27:02.667868 [DEBUG] switch_ivr_async.c:2430 TONE monitor_early_media_ring_2 DETECTED
2010-10-22 10:27:02.667868 [DEBUG] switch_ivr_originate.c:352 Ring 1/3
2010-10-22 10:27:02.667868 [DEBUG] switch_ivr_async.c:2436 Re-enabling monitor_early_media_ring_2
2010-10-22 10:27:07.767869 [DEBUG] switch_ivr_async.c:2424 TONE monitor_early_media_ring_2 HIT 1/2
2010-10-22 10:27:13.487868 [DEBUG] switch_ivr_async.c:2424 TONE monitor_early_media_ring_2 HIT 1/2
2010-10-22 10:27:14.027868 [DEBUG] switch_ivr_async.c:2424 TONE monitor_early_media_ring_2 HIT 2/2
2010-10-22 10:27:14.027868 [DEBUG] switch_ivr_async.c:2430 TONE monitor_early_media_ring_2 DETECTED
2010-10-22 10:27:14.027868 [DEBUG] switch_ivr_originate.c:352 Ring 2/3
2010-10-22 10:27:14.027868 [DEBUG] switch_ivr_async.c:2436 Re-enabling monitor_early_media_ring_2
2010-10-22 10:27:20.147869 [DEBUG] switch_ivr_async.c:2424 TONE monitor_early_media_ring_2 HIT 1/2
2010-10-22 10:27:20.907868 [DEBUG] switch_ivr_async.c:2424 TONE monitor_early_media_ring_2 HIT 2/2
2010-10-22 10:27:20.907868 [DEBUG] switch_ivr_async.c:2430 TONE monitor_early_media_ring_2 DETECTED
2010-10-22 10:27:20.907868 [DEBUG] switch_core_media_bug.c:441 Removing BUG from sofia/internal/1239@conference.freeswitch.org
2010-10-22 10:27:20.911864 [INFO] switch_ivr_originate.c:3290 Sending early media

The last line is most important. The call continues, but early media is delayed from sending until monitor_early_media_ring_total is matched. If monitor_early_media_ring_total is not met, then the call will timeout.

anthm had the following to say in IRC

<anthm> The point of the feature is because of problems with providers who send a 183 then play a busy tone and do not indicate fail over sip 
<anthm> so it looks like a good call. 
<anthm> so the monitor is to confirm that it is a ring tone as expected.
<anthm>	monitor_early_media_ring stops the default behavior to have originate return when it hears a ring
<anthm>	well when it gets 183
<anthm>	cos you don't know if its a ring
<anthm>	so it listens for one
<anthm>	when it really hears one, it lets the channel accept the 183

See also:


Implemented By:

Module Name Source FileLast Revised
coreswitch_ivr_originate.c 11295