我有extensions.conf
:
[users]
exten=>111,1,Dial(SIP/demo-alice,5)
exten=>111,n,UserEvent(TestResult,result:pass)
exten=>222,1,Dial(SIP/demo-bob,5)
它的工作原理,电话可以互相拨号。在python测试中:
df = ami.originate(
channel = "Local/222@users",
exten = "111",
priority = "1",
context = "users")
启动测试时,它失败并给我一个警告:
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/starpy/manager.py", line 153, in lineReceived
self.dispatchIncoming() # does dispatch and clears cache
File "/usr/lib/python2.7/dist-packages/starpy/manager.py", line 241, in dispatchIncoming
callback(message)
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 362, in callback
self._startRunCallbacks(result)
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 458, in _startRunCallbacks
self._runCallbacks()
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 545, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/usr/lib/python2.7/dist-packages/starpy/manager.py", line 347, in errorUnlessResponse
raise error.AMICommandFailure(message)
starpy.error.AMICommandFailure: {'message': 'Originate failed', 'response': 'Error', 'actionid': 'VirtATS3-36015280-2'}
通过 CLI 发起的工作正常:
channel originate Local/222@users extension 111@users
222响铃,接听电话后111开始响铃。
更新
弄清楚我如何发送 SIP 标头ami.originate()
。在这里找到。它不起作用的坏事 - 起源失败,就像上面记录的错误一样。在拨号方案中发送标头也不是解决方案。有什么帮助吗?
df = ami.originate(
channel = "Local/222@users",
exten = "111",
priority = "1",
context = "users",
variable = {
"SIPAddHeader":"Call-Info: answer-after=0"
})