Page 1 of 1

Auto answer and play message

PostPosted: Thu Apr 02, 2015 1:48 pm
by jtm13126
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.

Re: Auto answer and play message

PostPosted: Thu Apr 02, 2015 3:13 pm
by malcolmd
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:
http://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:

Code: Select all
;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:

Code: Select all
<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:

Code: Select all
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:

Code: Select all
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=<myfancyalert> header onto the outgoing INVITE to the phone.