Notify me when the call is answered

Home » Asterisk Users » Notify me when the call is answered
Asterisk Users 2 Comments

Hi

I want to have some signal when a call is answered.
I can watch the asterisk debug or logs and see when a call is answered
of course but I want a sound notification.

I tried this:
[macro-notifymobile]
exten => s,1,Dial(SIP/foobar,10)

exten => _0031.,n,Dial(SIP/foobar2/${EXTEN},60,wM(notifymobile))

But this results in:

[Mar 17 13:41:46] — IAX2/4506-102 answered IAX2/4506-35
[Mar 17 13:41:46] — Executing [s@macro-notifymobile:1] Dial(“IAX2/4506-102”, “SIP/foobar|10”) in new stack
[Mar 17 13:41:46] — Called foobar
[Mar 17 13:41:46] — IAX2/4506-102 requested special control 20, passing it to SIP/foobar-b760dd78
[Mar 17 13:41:46] — SIP/foobar-b760dd78 is ringing
[Mar 17 13:41:46] — IAX2/4506-102 requested special control 20, passing it to SIP/foobar-b760dd78

I think it is passing the call to the extension SIP/foobar (my wifi mobile device) which rings.
I want the call to stay connected to the original extension.

How would I achieve a notification this way or another way?

And is it possible to Dial() and only connect to your extension when someone answers the call?

2 thoughts on - Notify me when the call is answered

  • You want both phones to ring? then why don’t you just create a group so your
    mobile also rings at the same time as the other extensions…. just don’t answer
    your mobile.
     
    CS
     

    Christian Savinovich
    Telecom & Telephony Consulting
    646.982.3572
    c.savinovich@itntelecom.com

  • I would use the same premise- below is not tested,

    exten => _0031.,n,Dial(SIP/foobar2/${EXTEN},60,wM(notifymobile))

    [macro-notifymobile]
    exten => s,1,Set(STRIPPED=${CHANNEL:4})
    exten => s,n,Set(XTN=${CUT(STRIPPED,-,1)})
    exten => s,n,Set(TEXT=Extension $XTN answer call from ${CALLERID(num)})
    exten => s,n,System(/opt/swift/bin/swift -o /tmp/$XTN.wav “$TEXT”)
    exten => s,n,Page(SIP/foobar,iqA(/tmp/$XTN.wav))

    alternatively, what I actually do:

    [macro-AnswerLog]
    exten => s,1,Set(STRIPPED=${CHANNEL:4})
    exten => s,n,Set(XTN=${CUT(STRIPPED,-,1)})
    exten => s,n,Macro(Jabber,x${XTN} answered ${CALLERID(num)})

    [macro-Jabber]
    ; ${ARG1} – message
    exten => s,1,Jabbersend(me@example.com,me1@example.org,${ARG1})
    exten => s,n,Jabbersend(me@example.com,me2@example.net,${ARG1})