我正在使用 python 和 pyst 将 DTMF 发送到 Asterisk。代码是:
def playDTMF(self, channel, digit):
print "DTMF: Sending %s to %s" % (digit, channel)
response = self.manager.send_action({
"Action" : "PlayDTMF",
"Channel" : channel,
"Digit" : digit
})
print "DTMF: %s - %s" % (response['Response'], response['Message'])
脚本的输出很好:
DTMF: Sending 1 to SIP/S3bc9c3c-00000081
DTMF: Success - DTMF successfully queued
但是 Asterisk 对它的反应是这样的:
[Jul 2 17:48:53] DEBUG[6967] manager.c: Running action 'PlayDTMF'
[Jul 2 17:48:53] DEBUG[6967] channel.c: Set channel SIP/S3bc9c3c-00000081 to write format slin
[Jul 2 17:48:53] DEBUG[6967] channel.c: Scheduling timer at (50 requested / 50 actual) timer ticks per second
[Jul 2 17:48:53] DEBUG[6967] channel.c: Thread 140629726328576 Blocking 'SIP/S3bc9c3c-00000081', already blocked by thread 140628353554176 in procedure ast_
waitfor_nandfds
有趣的是,这只发生在 SIP 通道上。在“本地”频道上,它按预期工作:
[Jul 2 18:00:07] DTMF[7951]: channel.c:4083 __ast_read: DTMF begin '1' received on Local/901@AC000001-19ca;1
[Jul 2 18:00:07] DTMF[7951]: channel.c:4093 __ast_read: DTMF begin passthrough '1' on Local/901@AC000001-19ca;1
如何让 DTMF 在 SIP 频道上正常播放?
UPD
在 Asterisk bugtracker 上找到这个:https ://issues.asterisk.org/jira/browse/ASTERISK-13224
似乎如果我将 DTMF 发送到 SIP 通道电话只是为自己播放,它不会进一步发送到 Asterisk。有没有办法处理它?