Asterisk : automatically answer call after originate

Mykeul picture Mykeul · Aug 15, 2014 · Viewed 10.7k times · Source

I have an asterisk 1.8.13 running quite well, and thanks to stackoverflow's questions, I am now able to originate a call via AMI. When the call is originated, the SIP phone is ringing, and when I manually answer, it calls the extension.

I REALLY would like to do the same thing but without the need to answer myself on the SIP phone. (Not only a 'Async: yes' that would call the extension at the same time)

The goal is that when I send a command to AMI, my SIP phone is automatically answered and the extension called, no need to touch the phone physically.

I already checked :

Originate a call with Asterisk - without the originating extension ringing

Asterisk AMI - pickup call

But both do not work on my configuration (maybe due to me obviously).

Here my extensions.conf :

(...)
[globalcontext](!)
include => parkedcalls
exten => _X.,1,AGI(agi:async)

exten => _1XX,1,Dial(SIP/${EXTEN},20,tT)
exten => _1XX,2,VoiceMail(${EXTEN}@test)

[nol](globalcontext)
exten => _0XXXXXXXXX,1,Dial(SIP/to-ovh/${EXTEN})
(...)

Here is my sip.conf :

[template](!)
type=friend
host=dynamic
dtmfmode=rfc2833
disallow=all
allow=ulaw

[102](template)
fullname = John Doe
defaultuser = john
secret = sippass
context = nol

Here is my working AMI session for originating call from SIP phone 102 to ext 0101010101:

Action: Login
Username: admin
Secret: mypassword

Action: Originate
Channel: SIP/102
Context: nol
Exten: 0101010101
Priority: 1
Callerid: 0101010101
Timeout: 15000
ActionID: b4646a6465e546f

I hope it will be clear enough.

Regards

Answer

Mykeul picture Mykeul · Aug 19, 2014

Thanks to arheops' answers, I finally found the solution for my Cisco SPA525G2 & 504G SIP phones, via AMI telnet connection. I just had to add the header via a variable to tell the phones to auto-answer :

Action: Originate
Channel: SIP/102
Context: nol
Exten: 0101010101
Priority: 1
Variable: __SIPADDHEADER51=Call-Info: <sip:192.168.0.10>\;answer-after=0
Callerid: 0101010101
Timeout: 15000
ActionID: b4646a6465e546f

Where 192.168.0.10 is the IP of my asterisk server.

References are :

Thank you !