Time based rules for outgoing dialing plan

In my country we have some carriers who have different tariffs in different parts of the day (busy time vs. less busy time). Consequently, if you want to create a fully optimized least cost routing table you need some time based rules.
Can we do that, or am I asking for a new feature?

You should be able to do this, try use the GotoIfTime dialplan command, voip-info.org/wiki-Asterisk+cmd+GotoIfTime .

Cheers.

Marco Bruni

I knew about this command. I just used it for menues so far. So, it took me a while to come up with somthing that will work for outgoing:
[main_outgoing_context]
exten = _X.,1,NoOp(Off Peak)
exten = _X.,n,GotoIfTime(19:00-23:59|sun-thu||?off_peak_numberplan,${EXTEN:0},1)
exten = _X.,n,GotoIfTime(00:00-07:00|sun-thu||?off_peak_numberplan,${EXTEN:0},1)
exten = _X.,n,NoOp(The rest is Peak time)
exten = _X.,n,Goto(peak_time_numberplan,${EXTEN:0},1)

Let me know if I got it right, or you think there is anything better I can do.

Seems right to me.

Cheers.

Marco Bruni