keywords: FreeSWITCH 忙音检测 呼叫进度检测 信号音检测 detect busy ringing
description: FreeSWITCH忙音信号检测使用方法
categories: FreeSWITCH
FreeSWTICH有2种信号音检测方法一种mod_dptools: tone_detect,还有一个是mod_spandsp Call Progress,我们先介绍第一种。
mod_dptools tone_detect
1
Field Decription examples
key Name of the tone (user defined) busy, fax, mytone
freqs Frequencies to “listen” for 425 - 480,620
flags Which direction to sniff the tones in (r = read (default), w = write) r
timeout Window of time to listen for the tones in (0 = forever, + = milliseconds relative to the time tone_detect is called (now), = time in “epoch” (ie. seconds since January 1, 1970)) +2000 (2 seconds) or 1227132612 (absolute example)
app Optional. Application to call when the tone detect conditions are met transfer, hangup
appdata Optional. Argument to the application specified above ‘1000 XML default’ , ‘normal_clearing’
hits Number of hits needed before calling app/appdata (useful to avoid false positives)
timeout这里特别解析一下,0:一直检测,+毫秒数:需要检测的时间, epoch:绝对时间,比如要检测60秒,就是now()+60
freqs 中国电话信号音标准
拨号音 450±25 -10±3dBm0 <10% 连续信号音
回铃音 450±25 -10±3dBm0 <10% 1S(H)/4S(L)
忙音 450±25 -10±3dBm0 <10% 0.35S(H)/0.35S(L)
拥塞音 450±25 -10±3dBm0 <10% 0.7S(H)/0.7S(L)
如果上面表格中解析看不明白,没事,下面有例子。
下面是一个检测到3声忙音就挂断的例子。
停止信号音检测
mod_spandsp Call Progress
mod_dptools: tone_detect功能比较弱,现在我们介绍第二种吧
通过配置文件可以配置不同信号因频率、持续时间和周期。上面的配置是配置中国忙音,持续3声认为检测成功。
Channels Variables
execute_on_spandsp_tone_detect_XXX 检测到信号执行APP
api_on_spandsp_tone_detect_XXX 检测到信号执行API
Dialplan Applications
spandsp_start_tone_detect
Start background tone detection with cadence.
spandsp_stop_tone_detect
Stop background tone detection with cadence
1
APIs
spandsp_start_tone_detect
Start background tone detection with cadence
spandsp_start_tone_detect
spandsp_stop_tone_detect
Stop background tone detection with cadence
spandsp_stop_tone_detect
Events
DETECTED_TONE
This event is fired when the tone detector detects a tone.
The following headers are set:
Detected-Tone
Unique-ID
The Detected-Tone header will contain the name of the tone, as specified in the configuration file.
The Unique-ID will contain the session UUID.
tone音模拟:<``action
application``=``"playback"
data``=``"tone_stream://%(1850,4150,475,425);loops=-1"
/>
https://freeswitch.org/confluence/display/FREESWITCH/Tone_stream