我正在使用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发送。有没有办法解决它?
答案 0 :(得分:0)
使用SendDTMF应用程序。 SendDTMF(数字[| timeout_ms])
答案 1 :(得分:0)
在您的SIP.CONF中,确保您有
dtmfmode=rfc2833
适用于您的SIP干线。通常使用SIP发送带内(音频)的DTMF并不像您希望的那样好。