I want to originate call from MicroSIP soft phone to SIP trunk. When i call /channels/{id}, MicroSip shows dialog to accept call. In MicroSIP configuration i have turned on Auto answer on header “X-AUTOANSWER: TRUE”
Is there way how to send header to MicroSIP? I have tried put to variables this
{“SIPADDHEADER1”: “X-AUTOANSWER:TRUE”} but no effect.
Why, especially as a newbie, are you using ARI for this? People have been doing click to call since long before ARI ever existed, and there must be many worked examples available.
I would originate to a local channel and use the officially documented, channel driver specific, APIs, to add the header.
The PJSIP_HEADER dialplan function[1] is used to set headers for PJSIP channels to send on the INVITE. It can be used the same way normal variables are.
Thanks for advice. I have now PJSIP/6001 - MicroSIP phone and PJSIP/trunk.
extension.conf
[add-header]
exten => s,1,NoOp(setting-header)
same => n,Set(PJSIP_HEADER(add,X-AUTOANSWER)=“TRUE”)
same => n,Return
[default]
exten => 6001,1,NoOp(sip-6001)
same => n,Wait(1)
same => n,Dial(PJSIP/6001,b(add-header^s^1))
exten => _777XXXXXX,1,NoOp(make-outgoing-call)
same => n,Dial(PJSIP/${EXTEN}@trunk)
So when I call
/ari/channels/channid
?endpoind=PJSIP/777454545@trunk
&extension=6001
&callerId=TEST
&timeout=30
&api_key=user:password
Everything works, it will dial 777454545 and when phone answer, Asterisk connects to PJSIP/6001, header is properly set, so AutoAnswer works.
But I need first dial PJSIP/6001, set AutoAnswer header and after dial 777454545. When I call
/ari/channels/channid
?endpoind=PJSIP/6001
&extension=777454545
&callerId=TEST
&timeout=30
&api_key=user:password
MicroSIP don’t get AutoAnswer header, subroutine [add-header] is not executed.