GotoIfTime outbound restriction

I’m trying to setup Asterisk to only allow outbound calling during certain hours. After hours works as it should, but normal hours it fails. It looks like it’s not passing the dialed number to the outbound context.

     -- Executing [469xxxxxxx@internal-kids:1] GotoIfTime("SIP/301-00000002", "08:00-21:59,sun-thu,*,*?internal-kids-out,s,1") in new stack
     -- Goto (internal-kids-out,s,1)
     -- Executing [s@internal-kids-out:1] Set("SIP/301-00000002", "CALLERID(all)="My Name" <469xxxxxx>") in new stack
     -- Executing [s@internal-kids-out:2] Dial("SIP/301-00000002", "SIP/1s@VoIPms") in new stack
   == Using SIP RTP CoS mark 5
     -- Called SIP/1s@VoIPms
   == Everyone is busy/congested at this time (1:0/0/1)

Here is the extensions.conf

[internal-kids-out]
exten => _1NXXNXXXXXX,1,Set(CALLERID(all)="My Name" <469xxxxxxx>)
exten => _1NXXNXXXXXX,2,Dial(SIP/${EXTEN}@VoIPms)
exten => _1NXXNXXXXXX,n,Hangup()
exten => _NXXNXXXXXX,1,Set(CALLERID(all)="My Name" <469xxxxxxx>)
exten => _NXXNXXXXXX,2,Dial(SIP/1${EXTEN}@VoIPms)
exten => _NXXNXXXXXX,n,Hangup()

[internal-kids]
exten => _214xxxxxxx,1,Set(CALLERID(all)="My Name" <469xxxxxxx>)
exten => _214xxxxxxx,2,Dial(SIP/1${EXTEN}@VoIPms)
exten => _1214xxxxxxx,1,Set(CALLERID(all)="My Name" <469xxxxxxx>)
exten => _1214xxxxxxx,2,Dial(SIP/1${EXTEN}@VoIPms)
exten => _3XX,1,Dial(SIP/${EXTEN})
exten => _3XX,2,Hangup()
exten => _1NXXNXXXXXX,1,GotoIfTime(08:00-21:59,sun-thu,*,*?internal-kids-out,s,1)
exten => _1NXXNXXXXXX,2,GotoIfTime(09:00-23:59,fri&sat,*,*?internal-kids-out,s,1)
exten => _1NXXNXXXXXX,3,Goto(bedtime,s,1)
exten => _NXXNXXXXXX,1,GotoIfTime(08:00-21:59,sun-thu,*,*?internal-kids-out,s,1)
exten => _NXXNXXXXXX,2,GotoIfTime(09:00-23:59,fri&sat,*,*?internal-kids-out,s,1)
exten => _NXXNXXXXXX,3,Goto(bedtime,s,1)
include => parked-calls

[bedtime]
exten => s,1,Answer()
exten => s,2,Playback(what-time-it-is2)
exten => s,3,Playback(goodbye)
exten => s,4,Hangup()
1 Like

You are doing a goto from ‘internal-kids’ to extension ‘s’ inside ‘internal-kids-out’ which does not exist.

You’d need to goto to the telephone number you wish to call instead of ‘s’.

Ahh, duh, so something like this should work?

exten => _1NXXNXXXXXX,1,GotoIfTime(08:00-21:59,sun-thu,*,*?internal-kids-out,${EXTEN},1)
exten => _1NXXNXXXXXX,2,GotoIfTime(09:00-23:59,fri&sat,*,*?internal-kids-out,${EXTEN},1)
exten => _1NXXNXXXXXX,3,Goto(bedtime,s,1)
exten => _NXXNXXXXXX,1,GotoIfTime(08:00-21:59,sun-thu,*,*?internal-kids-out,${EXTEN},1)
exten => _NXXNXXXXXX,2,GotoIfTime(09:00-23:59,fri&sat,*,*?internal-kids-out,${EXTEN},1)
exten => _NXXNXXXXXX,3,Goto(bedtime,s,1)
 -- Goto (internal-kids-out,s,1)

replace s extension by outbound number you want to dial out

The extension variable should work for that, right?

${EXTEN}

WIll ne equal to the value on - Executing [469xxxxxxx@internal-kids:1], if that is the number you want to dial out is OK

Nice, yep, this works. Thanks guys! :slight_smile:

exten => _1NXXNXXXXXX,1,GotoIfTime(08:00-21:59,sun-thu,*,*?internal-kids-out,${EXTEN},1)
exten => _1NXXNXXXXXX,2,GotoIfTime(09:00-23:59,fri&sat,*,*?internal-kids-out,${EXTEN},1)
exten => _1NXXNXXXXXX,3,Goto(bedtime,s,1)
exten => _NXXNXXXXXX,1,GotoIfTime(08:00-21:59,sun-thu,*,*?internal-kids-out,${EXTEN},1)
exten => _NXXNXXXXXX,2,GotoIfTime(09:00-23:59,fri&sat,*,*?internal-kids-out,${EXTEN},1)
exten => _NXXNXXXXXX,3,Goto(bedtime,s,1)
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.