Auto answer and play message

I am trying to provide pre-recorded emergency messages to the phones. I am having trouble getting the phones to answer however. How can I fix this so that the digium phones auto answer a call that is from a script.

Howdy,

I can think of a couple of ways.

First, if you’re using a custom app to do it, you want to look into digium.phone.answer:
phones.digium.com/phone-api/refe … honeanswer

Or, you could add an alert to a phone where the ring_type is set to answer, and then make sure that the inbound call to the phone has the alert info header that you specified for the alert.

in DPMA land, that’d be something like:

;make an alert
[myfancyalert]
type=alert
alert_info=autoanswer
ring_type=answer

[myphone]
type=phone
...
alert=myfancyalert ;load the alert onto your phone
...

in XML land you’d do:

<ringtones>
        <alerts>
            <alert alert_info="myfancyalert" ringtone_id="" ring_type="answer" />
        </alerts>
</ringtones>

Then when calling into the phone, if it’s from Asterisk, it’d be something like:

exten => 100,1,Dial(PJSIP/myendpoint,,b(normal-ringer^addheader^1))

[normal-ringer]
exten => addheader,1,Set(PJSIP_HEADER(add,Alert-Info)=<myfancyalert>)

for chan_pjsip, where you’re doing a predial handler

or:

exten => 100,1,SIPAddHeader("Alert-Info: <myfancyalert>")
exten => 100,n,Dial(SIP/mypeer)

for chan_sip, where you’re calling the SIPAddHeader dialplan application

…in order to add the Alert-Info= header onto the outgoing INVITE to the phone.