I am trying to make calls between extensions 101 and 102 and is NOT going through. I have the following extensions.conf file
[general]
autofallthrough=no
priorityjumping=yes
static=yes
writeprotect=no
clearglobalvars=yes
[default]
exten => .,1,Hangup()
[inbound-schedule]
; #_#_# Phone Number #_#_#
exten => 7867086699,1,Answer
exten => 7867086699,n,NoOp(Office-ANI-${EXTEN})
exten => 7867086699,n,Set(CDR(userfield)=ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)})
exten => 7867086699,n,MixMonitor(ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}.wav)
exten => 7867086699,n,Goto(schedule,${EXTEN},1)
exten => .,1,Hangup()
[schedule]
exten => _NXXNXXXXXX,1,NoOp(Time-of-Day-Routing)
exten => _NXXNXXXXXX,n,GotoIfTime(8:58-17:02,mon-fri,*,*?inbound,${EXTEN},1)
exten => _NXXNXXXXXX,n,Goto(inbound-closed,${EXTEN},1)
[inbound]
exten => _NXXNXXXXXX,1,NoOp(Office-Open)
exten => _NXXNXXXXXX,n,Set(NUMINVALID=1)
exten => _NXXNXXXXXX,n,Set(TIMEOUT(digit)=3) ; max wait in-between digits seconds
exten => _NXXNXXXXXX,n,Set(TIMEOUT(response)=3) ; max wait for digit entry seconds
exten => _NXXNXXXXXX,n,Ringing
exten => _NXXNXXXXXX,n(menu),Wait(1)
exten => _NXXNXXXXXX,n,Background(custom/open-recording)
exten => _NXXNXXXXXX,n,Wait(3)
exten => _NXXNXXXXXX,n,Background(custom/open-recording)
exten => _NXXNXXXXXX,n,Wait(3)
exten => _NXXNXXXXXX,n,Dial(SIP/101,18)
exten => _NXXNXXXXXX,n,Voicemail(100#default,su)
exten => 0,1,NoOp(Office-Open-Press-Zero)
exten => 0,n,Voicemail(100#default,su)
exten => 2,1,NoOp(Operator-Directory)
exten => 2,n,Directory(default,vm-operator,f)
exten => 200,1,NoOp(External-Voicemail-Dial-From-${CALLERID(num)})
exten => 200,n,Playback(vm-dialout)
exten => 200,n,Wait(1)
exten => 200,n,VoiceMailMain()
exten => _1XX,1,Macro(local-followme,${EXTEN})
exten => t,1,Playback(option-is-invalid)
exten => t,n,Hangup()
exten => i,1,Set(NUMINVALID=$[${NUMINVALID}+1]})
exten => i,n,Playback(option-is-invalid)
exten => i,n,Gotoif($["${NUMINVALID}" < "4"]?:10)
exten => i,n,Goto(_NXXNXXXXXX,menu)
exten => i,10,Playback(vm-goodbye)
exten => i,n,Hangup()
[inbound-closed]
exten => _NXXNXXXXXX,1,NoOp(Office-Closed)
exten => _NXXNXXXXXX,n,Set(NUMINVALID=1)
exten => _NXXNXXXXXX,n,Set(TIMEOUT(digit)=3)
exten => _NXXNXXXXXX,n,Set(TIMEOUT(response)=3)
exten => _NXXNXXXXXX,n,Ringing
exten => _NXXNXXXXXX,n(menu),Wait(1)
exten => _NXXNXXXXXX,n,Background(custom/closed-recording)
exten => _NXXNXXXXXX,n,Wait(3)
exten => _NXXNXXXXXX,n,Background(custom/closed-recording)
exten => _NXXNXXXXXX,n,Wait(3)
exten => _NXXNXXXXXX,n,Dial(SIP/101,18)
exten => _NXXNXXXXXX,n,Voicemail(100#default,su)
exten => 0,1,NoOp(Office-Open-Press-Zero)
exten => 0,n,Voicemail(100#default,su)
exten => 2,1,NoOp(Operator-Directory)
exten => 2,n,Directory(default,vm-operator,f)
exten => 200,1,NoOp(External-Voicemail-Dial-From-${CALLERID(num)})
exten => 200,n,Playback(vm-dialout)
exten => 200,n,Wait(1)
exten => 200,n,VoiceMailMain()
exten => _1XX,1,Macro(local-followme,${EXTEN})
exten => t,1,Playback(option-is-invalid)
exten => t,n,Hangup()
exten => i,1,Set(NUMINVALID=$[${NUMINVALID}+1]})
exten => i,n,Playback(option-is-invalid)
exten => i,n,Gotoif($["${NUMINVALID}" < "4"]?:10)
exten => i,n,Goto(_NXXNXXXXXX,menu)
exten => i,10,Playback(vm-goodbye)
exten => i,n,Hangup()
[outbound]
exten => _NXXNXXXXXX,1,Dial(SIP/${EXTEN}#voip-outbound,120,trwW)
exten => _NXXNXXXXXX,n,Hangup()
exten => .,1,Playback(invalid)
exten => .,n,Hangup()
[internal]
; #_#_#_#_#_#_#_#_# INTERNAL MAIN CONTEXT #_#_#_#_#_#_#_#_#_#
; Extension to Extension Dialing
exten => _1XX,1,Macro(local-followme,${EXTEN})
; Call Pickup
exten => _*971XX,1,SET(GLOBAL(PICKUPMARK)=${EXTEN:2})
exten => _*971XX,n,Pickup(${EXTEN:2}#PICKUPMARK)
; Voicemail Access
exten => 1000,1,VoiceMailMain(${CALLERID(num)}#default)
exten => 2000,1,VoiceMailMain()
; Outbound Dialing
exten => _NXXXXXX,1,Answer
exten => _NXXXXXX,n,Set(CDR(userfield)=ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)})
exten => _NXXXXXX,n,MixMonitor(ob_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}.wav)
exten => _NXXXXXX,n,Set(CALLERID(num)=7867086699)
exten => _NXXXXXX,n,Goto(outbound,310${EXTEN},1)
exten => _NXXNXXXXXX,1,Answer
exten => _NXXNXXXXXX,n,Set(CDR(userfield)=ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)})
exten => _NXXNXXXXXX,n,MixMonitor(ob_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}.wav)
exten => _NXXNXXXXXX,n,Set(CALLERID(num)=7867086699)
exten => _NXXNXXXXXX,n,Goto(outbound,${EXTEN},1)
exten => _1NXXNXXXXXX,1,Answer
exten => _1NXXNXXXXXX,n,Set(CDR(userfield)=ib_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)})
exten => _1NXXNXXXXXX,n,MixMonitor(ob_${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}_${EXTEN}_${CALLERID(num)}.wav)
exten => _1NXXNXXXXXX,n,Set(CALLERID(num)=7867086699)
exten => _1NXXNXXXXXX,n,Goto(outbound,${EXTEN:1},1)
exten => t,1,Playback(invalid)
exten => t,n,Hangup()
exten => i,1,Playback(invalid)
exten => i,n,Hangup()
exten => .,1,Playback(invalid)
exten => .,n,Hangup()
[macro-local-followme]
exten => s,1,GotoIf($[${DB_EXISTS(followme/${ARG1})}=0]?nofollow)
exten => s,n,GotoIf($[${DB_RESULT:0:1}=0]?nofollow:follow)
exten => s,n(follow),Dial(SIP/${ARG1},20)
exten => s,n,Followme(${ARG1},n) ; Removed sa so no name recording
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(nofollow),Dial(SIP/${ARG1},20)
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Voicemail(${ARG1},u) ; If unavailable, send to voicemail
exten => s-BUSY,1,Voicemail(${ARG1},u) ; I changed b to u. If busy, send to voicemail w/ busy ann
exten => _s-.,1,Goto(s-NOANSWER,1)
[outbound-follow-me]
exten => _NXXNXXXXXX,1,NoOp(follow-me-activated-${EXTEN})
exten => _NXXNXXXXXX,n,Set(CALLERID(num)=${IF($[ ${LEN(${CALLERID(num)})} = 3]?7867086699:${CALLERID(num)})})
exten => _NXXNXXXXXX,n,Goto(outbound,${EXTEN},1)
exten => _1NXXNXXXXXX,1,NoOp(follow-me-activated-${EXTEN})
exten => _1NXXNXXXXXX,n,Set(CALLERID(num)=${IF($[ ${LEN(${CALLERID(num)})} = 3]?7867086699:${CALLERID(num)})})
exten => _1NXXNXXXXXX,n,Goto(outbound,${EXTEN:1},1)
exten => _1XX,1,Dial(SIP/${EXTEN},120,t)
exten => _1XX,n,Hangup()
[vm-operator]
exten => o,1,NoOp(operator-zero-out)
exten => o,n,Goto(vm-zero-menu,s,1)
; Direct Extension Dialing
exten => _1XX,1,Macro(local-followme,${EXTEN})
[vm-zero-menu]
exten => s,1,NoOp(operator-asterisk-out)
exten => s,n,Set(TIMEOUT(digit)=3)
exten => s,n,Set(TIMEOUT(response)=3)
exten => s,n,Background(custom/vm-operator-recording)
exten => s,n,Wait(3)
exten => s,n,Voicemail(100#default,su)
exten => 0,1,Voicemail(100#default,su)
exten => 1,1,NoOp(Operator-Directory)
exten => 1,n,Directory(default,vm-operator,f)
exten => 2,1,Voicemail(100#default,su)
exten => 3,1,Voicemail(100#default,su)
exten => 4,1,Voicemail(100#default,su)
exten => 5,1,Voicemail(100#default,su)
exten => 6,1,Voicemail(100#default,su)
exten => 7,1,Voicemail(100#default,su)
exten => 8,1,Voicemail(100#default,su)
exten => 9,1,Voicemail(100#default,su)
; Direct Extension Dialing
exten => _1XX,1,Macro(local-followme,${EXTEN})
exten => t,1,Playback(invalid)
exten => t,n,Hangup()
exten => i,1,Playback(invalid)
exten => i,n,Hangup()
exten => .,1,Playback(invalid)
exten => .,n,Hangup()
I got the following error:
Executing [102#internal:1] Gosub("SIP/101-00000002", "local-followme,s,1(102)") in new stack
[2021-05-18 20:26:16] ERROR[19823][C-0000000a]: app_stack.c:593 gosub_exec: Attempt to reach a non-existent destination for Gosub: (Context:local-followme, Extension:s, Priority:1)
== Spawn extension (internal, 102, 1) exited non-zero on 'SIP/101-00000002'
== Using SIP RTP CoS mark 5
app_stack is loaded apparently, this is what I have with the command "module show like app_stack" on CLI
app_stack.so - Dialplan subroutines (Gosub, Return, etc 0 - Running - core
I will really appreciate any guidance. Thanks.
Confirm if you are reloading the dialplan module by "dialplan reload" command in Asterisk CLI, it seems like what is being executed in the call is GoSub instead of Macro. You can validate dialplan statements loaded in Asterisk by doing "dialplan show" or "dialplan show context-name"
Please, avoid using Macro application, you should use GoSub application instead, Macro is considered deprecated.
Here's a Gosub example:
[internal]
exten => _1XX,1,GoSub(local-followme,s,1(${EXTEN}))
[local-followme]
exten => s,1,Verbose(GoSub executing)
same = n,Verbose(Argument 1: ${ARG1})
same = n,Return()
Situation: Analog phone line -> Asterisk with PSTN card -> Central PBX ->
exten => _1709,1,Set(CALLERID(name)=City_09)
exten => _1709,n,Noop(${CALLERID(name)})
exten => _1709,n,GoTo(incoming-reception,s,1)
Next
[incoming-reception]
include => external-trunk
exten => 0027449999,1,GoTo(incoming-reception,s,1)
exten => anonymous,1,GoTo(incoming-reception,s,1)
;exten => s,1,GotoIfTime(9:00-18:00|mon-sat|*|*?incoming-reception-work,s,1)
exten => s,1,GotoIfTime(9:00-18:00|mon-fri|*|*?incoming-reception-work,s,1)
exten => s,n,Answer()
exten => s,n,Set(TIMEOUT(digit)=2)
exten => s,n,NoOp(${CALLERID(num)})
exten => s,n,Set(CHANNEL(language)=ru)
exten => s,n,Wait(2)
exten => s,n,Background(day_off_1_welcome)
exten => s,n,Background(day_off_2_message)
exten => s,n,Voicemail(2001,s,300)
exten => 5,1,GoTo(incoming-reception-enoff,s,2)
exten => i,1,GoTo(incoming-reception,s,3)
exten => h,1,Congestion(10)
exten => h,2,HangUp()
next
[incoming-reception-work]
include => external-trunk
exten => s,1,Answer()
exten => s,n,Set(TIMEOUT(digit)=2)
exten => s,n,NoOp(${CALLERID(num)})
exten => s,n,Set(CHANNEL(language)=ru)
exten => s,n,Wait(2)
exten => s,n,Background(business_hours_1_welcome)
exten => s,n,Queue(test,T,,,32)
exten => s,n,Queue(test2,T)
exten => s,101,Background(business_hours_4_message)
exten => s,102,Voicemail(2001,s,300)
exten => 5,1,GoTo(incoming-reception-en,s,1)
exten => 9,1,Background(business_hours_4_message)
exten => 9,2,Voicemail(2001,s,300)
exten => i,1,GoTo(incoming-reception-work,s,1)
exten => h,1,Congestion(10)
exten => h,2,HangUp()
How can I make record incoming calls? Asterisk 1.8 (no freepbx, console only)
You could try to use Monitor/StopMonitor dialplan procedures to record incoming calls. Use the following template:
same => n,Monitor(wav,''${UNIQUEID},m)
same => n,Set(FILEARG="/tmp/asterisk/monitor/${UNIQUEID}.wav")
.
.
same => n,Hangup()
exten => h,1,StopMonitor()
same => n,System(/usr/local/bin/record-file-to-database --file=${FILEARG})
Check your Asterisk configs for the exact location of Monitor output folder.
See also an example here
I have the following macro in my diaplan which is excuted each time an incoming call comes.
Problem is that it is repeating itself indefinitely. I want it to repeat 3 times, if no input from the user, it should say goodbye and quit. Could anyone help me with this please.
Thanks
[macro-test]
;exten => s,1,Answer()
;exten => s,n,Wait(2)
exten => s,1,Set(AGISIGHUP=no)
exten => s,n,NoOp(AGISUGHUP: ${AGISIGHUP})
exten => s,n,Set(CALLED=${MACRO_EXTEN})
exten => s,n,Set(CALLER=${CUT(CUT(SIP_HEADER(From),#,1),:,2)})
exten => s,n(action),Set(EXIT=0)
exten => s,n,Set(TOKEN="")
exten => s,n,Set(INIT="true")
exten => s,n,While($[${EXIT}<1])
exten => s,n,Set(EXIT=1)
exten => s,n,Agi(agi://${ARG1}/server.agi?caller=${CALLER}&called=${CALLED}&init=${INIT})
exten => s,n,Set(INIT="false")
exten => s,n,NoOp(AGISTATUS: ${AGISTATUS})
exten => s,n,GotoIf($["${AGISTATUS}" != "SUCCESS"]?fail:succ)
exten => s,n(succ),EndWhile()
exten => s,n,Set(INIT="end")
exten => s,n,Agi(agi://${ARG1}/server.agi?caller=${CALLER}&called=${CALLED}&init=${INIT})
exten => s,n,Hangup()
exten => s,n(fail),Wait(2)
exten => s,n,Playback(vm-goodbye)
exten => s,n,Hangup()
exten => h,1,NoOp(Notify Billing System)
exten => h,n,NoOp(Other Tasks)
exten => h,n,Hangup()
Simple loop dialplan
exten =>s ,1,Set(loop=3)
exten =>s,n(loop),Noop(loop start here)
exten =>s,n,Noop(do something here)
exten =>s,n,Set(loop=$[ ${loop} - 1 ]);decrease loop countr
exten =>s,n,GotoIf($[ ${loop} > 0 ]?loop); if still have something, do again
exten => h,n,Hangup()
Don't call hangup, when you're already hung up.