Auto answer and play message

Community based support for the Digium Phone Application Programming Interface (API).

Moderators: jwitt, sruffell, malcolmd, Moderator

Auto answer and play message

Postby jtm13126 » Thu Apr 02, 2015 1:48 pm

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.
jtm13126
Newsterisk
 
Posts: 2
Joined: Wed Mar 04, 2015 9:35 am

Re: Auto answer and play message

Postby malcolmd » Thu Apr 02, 2015 3:13 pm

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.
Malcolm Davenport
Digium, Inc. | Senior Product Manager
malcolmd
Moves Like Spencer
 
Posts: 3019
Joined: Wed Aug 03, 2005 3:53 pm
Location: Huntsville, AL, US


Return to Digium Phone API

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest