I have extensions.conf
as:
[users]
exten=>111,1,Dial(SIP/demo-alice,5)
exten=>111,n,UserEvent(TestResult,result:pass)
exten=>222,1,Dial(SIP/demo-bob,5)
It works, phones can dial each other. In python test:
df = ami.originate(
channel = "Local/222@users",
exten = "111",
priority = "1",
context = "users")
While launching the test, it failes and gives me a warning:
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'}
Originating through CLI works as it should:
channel originate Local/222@users extension 111@users
222 rings, after answering the call 111 begins to ring.
UPDATE
Figured out how that I can send SIP headers in ami.originate()
. Found here. The bad thing that it is not working - originate fails like in a error logged above. Sending headers in dialplan is not a solution either. Any help?
df = ami.originate(
channel = "Local/222@users",
exten = "111",
priority = "1",
context = "users",
variable = {
"SIPAddHeader":"Call-Info: answer-after=0"
})