在Asterisk常见的DTMF问题和解决办法
两个用户在通话的时候怎么获取DTMF按键
Q: I want to know if it is possible in Asterisk to catch a DTMF event sent by one of the phone to trigger an action, for example to play a sound/video clip to one of the phones.
A: Google for features.conf, but you'll need to keep asterisk in the callpath, i.e. canreinvite=no, otherwise the RFC2833 DTMF codes will only be sent between the end points. If you need to reinvite, then you might have to try using SIP-INFO for DTMF instead of RFC2833. 检测DTMF按键音的长度?
Q: Here's the scenario, I am planning to use SIP phone to connect asterisk local extension number where it will connect me to my agiserver. My agiserver(written in java) as of now can detect and prints dtmf tones but not the dtmf done by prolonged key pressed.
A: As of Asterisk 1.4, if you use RFC2833-generated DTMF, then it is possible. It would also be possible in any version with inband DTMF (which requires ulaw or alaw). All other cases, it is only possible to know that the event occurred, not how long the event lasted. 向电话会议用户广播DTMF按键
Q: How can I arrange the ability for MeetMe participants to press DTMF keys on their phone and for the tones to then pass out to the other party(ies)?
A: The pseudo zap channels - that's what all VOIP channels have to use to get into a MeetMe - can't do DTMF with any measure of reliability at all. So what I did was program into app_conference the ability to do DTMF broadcasting of both inband and RFC DTMF.
The broadcast DTMF portion will do a separate send to each of the participants that has the flag set for RFC and for inband flagged participants it will go to a section that will play an audio file of a DTMF tone(to allow for SIP RFC participants to send DTMF to inband Zap participants for example).
It does still have a random double-free memory that I can't find anyone to fix which will crash Asterisk if you use inband DTMF broadcasting a lot, but it has worked for me for periods of time as long as 2 weeks without crashing. (Quote as of Sep 2006)
To do DTMF broadcasting, make sure you read the README which has instructions on the flags for Conference in the dialplan. 修改DTMF 长度
Q: 在哪里调整,怎样才能调整 DTMF长短?
A: main/channel.c, include/asterisk/channel.h: 2007-04-24 21:34 +0000 [r61781-61787] Russell Bryant (Asterisk 1.4.3)
Improve DTMF handling in ast_read() even more in response to a discussion on the asterisk-dev mailing list. I changed the enforced minimum length of a digit from 100ms to 80ms. Furthermore, I made it now enforce a gap of 45ms in between digits. These values are not configurable in a configuration file right now, but they can be easily changed near the top of main/channel.c. 电话会议中的DTMF处理
问题:MeetMe会议可以将一个用户的DTMF按键转发给其他用户吗?
回答: Asterisk 1.4 has introduced a new option 'F' in MeetMe that serves this purpose. 手工提取和发送DTMF数字
Q: I'm trying to make asterisk detect some DTMF digits during a call and post them (can't use WaitExten or Features.conf).
A: I would suggest that you implement that in logger.c and configure a line to send logs to an HTTP POST (via logger.conf), with the pbx_substitute_variables_helper function, using the ${CURL()} function directly. You may need to \=> func_curl.so\in modules.conf, but that will work well. Or use a simple log watcher:
tail -n0 -f /var/log/asterisk/debug | \\ grep 'DTMF digit: [0-9#*]' | \\ your_custum_filter
解决常见故障的办法
* 激活debug模式,让Asterisk CLI能够接到DTMF事件通知。(不知道怎么做?看下面这个问题的回答)
* 录制声音 (使用ztmonitor),在声音文件里确信Asterisk得到了有效的DTMF按键。
问题: 当我从 1.2 升级到 1.4.13之后,CLI 不再显示DTMF了。我需要激活它吗?
答案: 你需要在logger.conf里修改允许DTMF按键,然后在Asterisk CLI里面输入 \reload\来让你的这个修改生效。
在Zap (PRI / E1)上接收一个DTMF字符(Asterisk 1.4) 引用
CLI> core set debug channel Zap/1-1
[Jul 30 13:19:05] << [ TYPE: DTMF Begin (12) SUBCLASS: 5 (53) ] [Zap/1-1] [Jul 30 13:19:05] << [ TYPE: Null Frame (5) SUBCLASS: N/A (0) ] [Zap/1-1] [Jul 30 13:19:05] << [ TYPE: Null Frame (5) SUBCLASS: N/A (0) ] [Zap/1-1] [Jul 30 13:19:05] << [ TYPE: Null Frame (5) SUBCLASS: N/A (0) ] [Zap/1-1] [Jul 30 13:19:05] << [ TYPE: Null Frame (5) SUBCLASS: N/A (0) ] [Zap/1-1] [Jul 30 13:19:05] << [ TYPE: Null Frame (5) SUBCLASS: N/A (0) ] [Zap/1-1] [Jul 30 13:19:05] << [ TYPE: Null Frame (5) SUBCLASS: N/A (0) ] [Zap/1-1] [Jul 30 13:19:06] << [ TYPE: DTMF End (1) SUBCLASS: 5 (53) ] [Zap/1-1]
带内DTMF检测不可靠
* Possible solution: Make sure you have a zaptel timer / timing device, i.e. either 'ztdummy' or some zaptel hardware on your system.
* Another possible solution: If your asterisk isn't reliably recognizing dtmf and you're using a provider that only supports inband dtmf, consider dumping them for another provider that can give you out of band dtmf such as RFC2833. Depending on your situation, this may be an easier fix than some other solutions. Inband dtmf detection seems to be very problematic.
重复收到DTMF按键
* Change the setting relaxdtmf= and see if that helps
* If you appear to be receiving doubled DTMF signals then you are likely to get both inband and RFC2833 or SIP INFO signalling on your Asterisk box; you will want to make the sening party use only one of these two methods.
* Another possible cause would be that your telephony card has hardware-based DMTF detection turned on, coupled with the fact that Asterisk also detects the DTMF signal(s).