[HELP] Need help with auto dialplan script

Dear Asterisk Guru’s,

Introduction:
I’m new to Asterisk and I need some help with finalizing my dial-plan.

Goal:
The goal is to call the technical staff in case of an alarm.
If the first person doesn’t provide a pin-code or hangup the call during the script, or never pickup the call. It should go to the next person in line.
They call should stop hunting when an engineer respond with entering some pincode.

The question:
All works fine, but and I need to know how to dial the next engineer when the first one doesn’t react (no-answer) or (hanged-up) without responding with some digits

So now it only goes to the next engineer when they pickup, listen through the whole script and do nothing. Thats good.

  1. But I don’t know how to go to the next nextfile when the first person pickup and hanged-up the call during the execution of the dialplan.

  2. How to go to the nextfile when the first person is BUSY or doesn’t answer (NO ANSWER) their phone. The problem with the second question is that I cannot build it in the context, because the context only gets pickup when the call is answered.

I hope you guys can shed some light on this problem :question:

This is my config:

.call file where i start the call with

Channel: SIP/mysipprovider-out/xxxnumberfirstengineerxxx
MaxRetries:3
RetryTime:2
WaitTime:40
Context: outboundmsg1
extension:s
Priority: 1

[outboundmsg1]
exten => s,1,Set(nextfile=tmp02)
exten => s,2,Set(TIMEOUT(digit)=4)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,Set(stepcount=0)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n(begin),Background(/home/administrator/sounds/alarm)
exten => s,n(prompt),Background(/home/administrator/sounds/pincode)
exten => s,n,Set(stepcount=$[${stepcount}+1])
exten => s,n,GotoIf($[${stepcount} > 2]?callnext)
exten => s,n,WaitExten(2)
exten => s,n,Goto(s,prompt)
exten => s,n(callnext),System(cp /var/spool/asterisk/${nextfile} /var/spool/asterisk/out$
exten => s,n,Hangup
exten => 1,1,Goto(s,begin)
exten => 2,1,Goto(msgack,s,1)
exten => t,1,Playback(vm-goodbye)
exten => t,2,Hangup

tmp02 .call file

Channel: SIP/mysipprovider-out/xxxnumbersecondengineerxxx
MaxRetries:3
RetryTime:2
WaitTime:40
Context: outboundmsg1
extension:s
Priority: 1

  1. h extension
  2. local channel rather than directly calling the party.

I can’t help but think there must be a simpler way, but those are the minimum changes with your design.

Thx David, I tried h extension right after I posted this and that does the trick. But I tried it only experimental because it says it goes to the h extension when it hangs up, but who hanged up? Seems when the called party hangs up it goes there can you confirm that? Why should local be better?

I’m now looking for a add on so that it only stops calling the next file when someone enters a specific pin code. Now it stops on any digit. Can you help me with that?

h is run when the calling party hangs up or is hungup.
Local is not better. it is the solution to your second question.

Already, thx solved.