Notifying Missed Calls
Hi list!
I have this problem: I’d like to notify the user about missed calls. With “missed call” I mean: the caller calls, wait a while and hangup
_before_ the voicemail starts.
I got it call a script just before the voicemail starts, so:
exten => s,1,Verbose(2,Call for Main – [${CALLERID(num)}])
exten => s,n,Set(CHANNEL(musicclass)=default)
exten => s,n,Dial(SIP/74,39,RcxX)
exten => s,n,Verbose(2,Voicemail for Main)
exten => s,n,Set(CALLERID(name)=)
exten => s,n,Gosub(noanswer,s,1)
exten => s,n,VoiceMail(74,us)
exten => s,n,Hangup
[noanswer]
exten => s,1,NoOp(UID CALL: ${UNIQUEID} / DATE:
${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}))
exten => s,n,System(echo “Verpasster Anruf vom ${CALLERID(NUM)} um
${STRFTIME(${EPOCH},,%H:%M)}” > /tmp/calllog.txt)
exten => s,n,Return()
but if the called hangs up prior the timeout for the voicemail, the Subrouting “noanswer” will not called…
Any ideas?
Thanks Luca Bertoncello
(lucabert@lucabert.de)
—
16 thoughts on - Notifying Missed Calls
You can use the h priority for that.
https://wiki.asterisk.org/wiki/display/AST/Special+Dialplan+Extensions
Doug
—
Am 03.11.2021 um 21:24 schrieb Doug Lytle:
Hi Doug,
could you send me an example?
I tried so:
exten => h,n(hang),Gosub(noanswer,s,1)
exten => h,n,Hangup exten => _xxxxxx,1,Verbose(2,Call for Main – [${CALLERID(num)}])
exten => _xxxxxx,n,Set(CHANNEL(musicclass)=default)
exten => _xxxxxx,n,Dial(SIP/74,39,RcxX)
exten => _xxxxxx,n,Verbose(2,Voicemail for Main)
exten => _xxxxxx,n,Set(CALLERID(name)=)
exten => _xxxxxx,n,Gosub(noanswer,s,1)
exten => _xxxxxx,n,VoiceMail(74,us)
exten => _xxxxxx,n,Hangup
But it does not work…
Thanks Luca Bertoncello
(lucabert@lucabert.de)
—
The n there should be 1, surely?
I would say “remove that line”. The call has already been hung up, so calling Hangup is at best going to go into a recursive loop – it certainly isn’t going to help.
Antony.
—
“The future is already here. It’s just not evenly distributed yet.”
– William Gibson
Please reply to the list;
please *don’t* CC me.
—
Am 03.11.2021 um 21:34 schrieb Antony Stone:
Ach, you’re right!
Now it works!
Thanks a lot Luca Bertoncello
(lucabert@lucabert.de)
—
g: *When the called party hangs up*, continue to execute commands in the current context at the next priority
Hi Luca.
You can use the ${DIALSTATUS} channel variable.
https://www.voip-info.org/asterisk-variable-dialstatus/
GERARDO B
Am 03.11.2021 21:34, schrieb Antony Stone:
Hi again
This is my current configuration:
[cch]
exten => _X.,1,Verbose(2,DEFAULT)
include => internal_calls include => main_incoming include => fax_incoming include => michael_incoming include => myproxy
[noanswer]
exten => s,1,NoOp(UID CALL: ${UNIQUEID} / DATE:
${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}))
exten => s,n,System(echo “Verpasster Anruf vom ${CALLERID(NUM)} um
${STRFTIME(${EPOCH},,%H:%M)}” | mail -s “Verpasster Anruf” info@xxxx.de)
….
[main_incoming]
exten => h,1,GotoIf($[“${DIALSTATUS}” = “ANSWER”]?done)
exten => h,n,Goto(noanswer,s,1)
exten => h,n(done),NoOp()
exten => h,n,HangUp()
…
It works, but I have two problems:
1) The E-Mails will be sent “double”
2) The E-Mails will be sent for outgoing unanswered calls, too.
Do someone has an idea what is wrong in my configuration?
Thanks a lot Luca Bertoncello
(lucabert@lucabert.de)
—
Hallo Luca, Please show logs ( full )
Here my configuration:
[incoming]
; Incoming from Swisscom exten => +4191xxxxxxx,1,NoOp(Call from ${CALLERID(num)})
same => n,Dial(SIP/deskphone,120)
same => n,Hangup()
exten => h,1,GotoIf($[“${DIALSTATUS}” = “ANSWER”]?done)
exten => h,n,System(echo “Missed Call from ${CALLERID(num)}” | mail -s
“Missed Call from ${CALLERID(num)}” my-email@address.here)
exten => h,n(done),NoOp()
—
It sends the first mail by executing “noanswer,2” and a second mail because because of “main-incoming,h,2”
Use the “h” extension only in the context for incoming calls
—
Am 06.11.2021 um 14:43 schrieb Frank Vanoni:
Hi Frank
Really, I can’t understand what you mean… I’m feeling really dumb…
I have just one “h” extension:
[main_incoming]
exten => h,1,GotoIf($[“${DIALSTATUS}” = “ANSWER”]?done)
exten => h,n,Goto(noanswer,s,1)
exten => h,n(done),NoOp()
Could you explain what you mean?
Thanks Luca Bertoncello
(lucabert@lucabert.de)
—
No need to feel dumb. I’m not an expert and when I look to my extensions.conf… well… countless pulling my hairs out, head banging on the keyboard,,, 🙂
The “h” extension is executed whenever a call is hang up in that contexts. In your configuration it executes first the “s” extension (where you GoTo h,1) and once that is executed, the “h” extension is executed again.
Take a look to the example I posted. It’s very basic, but it does the job.
—
Am 06.11.2021 um 15:06 schrieb Frank Vanoni:
Hi Frank
OK, I modified my configuration so:
[main_incoming]
exten => _00493529123456,1,Verbose(2,Call for Main – [${CALLERID(num)}])
exten => _00493529123456,n,Dial(local/123456@main_incoming,,xX)
exten => _03529123456,1,Verbose(2,Call for Main – [${CALLERID(num)}])
exten => _03529123456,n,Dial(local/123456@main_incoming,,xX)
exten => _123456,1,Verbose(2,Call for Main – [${CALLERID(num)}])
exten => _123456,n,Set(CALLERID(num)=${IF($[ “${CALLERID(num):0:3}” =
“+49” ]?0${CALLERID(num):3}:${CALLERID(num)})})
exten => _123456,n,Set(CHANNEL(musicclass)=default)
exten => _123456,n,Dial(SIP/74,39,RcxX)
exten => _123456,n,Verbose(2,Voicemail for Main)
exten => _123456,n,Set(CALLERID(name)=)
exten => _123456,n,VoiceMail(74,us)
exten => _123456,n,Hangup include => fax_incoming include => michael_incoming include => internal_calls
exten => h,1,GotoIf($[“${DIALSTATUS}” = “ANSWER”]?done)
exten => h,n,Goto(noanswer,s,1)
exten => h,n(done),NoOp()
Unfortunately two E-Mails are sent anyway… This is the Asterisk log:
— Executing [00493529123456@michael_incoming:1]
Verbose(“PJSIP/pbxmichael_in-00000418”, “2,Call for Main –
[+493511111111]”) in new stack
== Call for Main – [+493511111111]
— Executing [00493529123456@michael_incoming:2]
Dial(“PJSIP/pbxmichael_in-00000418”, “local/123456@main_incoming,,xX”)
in new stack
— Called local/123456@main_incoming
— Executing [123456@main_incoming:1]
Verbose(“Local/123456@main_incoming-00000268;2”, “2,Call for Main –
[+493511111111]”) in new stack
== Call for Main – [+493511111111]
— Executing [123456@main_incoming:2]
Set(“Local/123456@main_incoming-00000268;2”,
“CALLERID(num)=03511111111”) in new stack
— Executing [123456@main_incoming:3]
Set(“Local/123456@main_incoming-00000268;2”,
“CHANNEL(musicclass)=default”) in new stack
— Executing [123456@main_incoming:4]
Dial(“Local/123456@main_incoming-00000268;2”, “SIP/74,39,RcxX”) in new stack
== Using SIP RTP CoS mark 5
— Called SIP/74
— Local/123456@main_incoming-00000268;1 is ringing
— SIP/74-00000462 is ringing
— Local/123456@main_incoming-00000268;1 is ringing
— SIP/74-00000462 is ringing
— SIP/74-00000462 is ringing
— SIP/74-00000462 is ringing
== Spawn extension (michael_incoming, 00493529123456, 2) exited non-zero on ‘PJSIP/pbxmichael_in-00000418’
— Executing [h@michael_incoming:1]
GotoIf(“PJSIP/pbxmichael_in-00000418”, “0?done”) in new stack
— Executing [h@michael_incoming:2]
Goto(“PJSIP/pbxmichael_in-00000418”, “noanswer,s,1”) in new stack
— Goto (noanswer,s,1)
== Spawn extension (main_incoming, 123456, 4) exited non-zero on
‘Local/123456@main_incoming-00000268;2’
— Executing [h@main_incoming:1]
GotoIf(“Local/123456@main_incoming-00000268;2”, “0?done”) in new stack
— Executing [s@noanswer:1] NoOp(“PJSIP/pbxmichael_in-00000418”,
“UID CALL: 1636222382.6030 / DATE: 20211106-191306)”) in new stack
— Executing [h@main_incoming:2]
Goto(“Local/123456@main_incoming-00000268;2”, “noanswer,s,1”) in new stack
— Goto (noanswer,s,1)
— Executing [s@noanswer:2] System(“PJSIP/pbxmichael_in-00000418”,
“echo “Verpasster Anruf vom +493511111111 um 19:13” | mail -s
“Verpasster Anruf” info@mydomain.de“) in new stack
— Executing [s@noanswer:1]
NoOp(“Local/123456@main_incoming-00000268;2”, “UID CALL: 1636222382.6032
/ DATE: 20211106-191306)”) in new stack
— Executing [s@noanswer:2]
System(“Local/123456@main_incoming-00000268;2”, “echo “Verpasster Anruf vom 03511111111 um 19:13” | mail -s “Verpasster Anruf”
info@mydomain.de“) in new stack
Any other idea?
Thanks Luca Bertoncello
(lucabert@lucabert.de)
—
Hi, strange….
— Goto (noanswer,s,1)
— Executing [s@noanswer:2] System(“PJSIP/pbxmichael_in-00000418”, “echo
“Verpasster Anruf vom +493511111111 um 19:13” | mail -s “Verpasster Anruf”
info@mydomain.de“) in new stack
— Executing [s@noanswer:1] NoOp(“Local/123456@main_incoming-00000268;2”,
“UID CALL: 1636222382.6032/ DATE: 20211106-191306)”) in new stack
— Executing [s@noanswer:2] System(“Local/123456@main_incoming-00000268;2”,
“echo “Verpasster Anrufvom 03511111111 um 19:13” | mail -s “Verpasster Anruf” info@mydomain.de“) in new stack
pls run
asterisk -rx “dialplan show noanswer”
and please check:
[noanswer]
exten => s,1,NoOp(UID CALL: ${UNIQUEID} /
DATE:${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}))
exten => s,n,System(echo “Verpasster Anruf vom ${CALLERID(NUM)} um
${STRFTIME(${EPOCH},,%H:%M)}” | mail -s “Verpasster Anruf” info@xxxx.de)
exten => s,n,Hangup()
LG
Lukasz
Hi 😉
now I see ….
Am 06.11.2021 um 21:15 schrieb Łukasz Grzywański:
Hi Łukasz,
Dziękuję!!!!
You are my hero!
It works as expected!
Thank you very very much!
Luca
—