Ban outgoing on Certain Times

Hi Guys,

Have any of you where able to apply a ban on outgoing calls on certain times? If yes, can you please share what have you used?


For example, if time was included in ban it will go to an IVR or a voice message

Use GotoIfTime

Thanks, able to make it work.
Is anyone know how I could exclude some extensions on that gotoiftime,
example, exten 100 will go through that gotoiftime and exten 101 will just ignore it.

Evaluate the ${CALLERID(num)} using goto before gotoiftime

I did this, but it doesnt seem to adjust, even the extension is not 412, it is still going to 2 priority.

exten => s,1,GotoIf(${CALLERID(num)}=412?2:4)

Any idea?

If you mean extension in the Asterisk sense, then just include the conditional code in those extensions to which it applies.

If you really meant a locally attached calling device, put that device in a different context.

If you meant a remote device, you will need to use caller ID. If a caller ID is not working, you need to log the caller ID actually being seen.

In the and last cases you can use wildcards on the Goto and a more specific match on a Noop to let the privileged cases though.

Also note that whole contexts may have time dependent variations, and Astrisk comes with several examples; if you have not read extensions.conf.sample yet, you should do so before contniung.

1 Like

You could use time-based includes.

;these phones are always allowed to call internationally
include => international
include => internal

;These phones are only allowed to make international calls during business hours
include => pstn-local
include => long-distance
include => international,8:00-17:00,mon-fri

Then you set the context appropriately in your endpoint definition