hi friends, I need that when somebody dial an specific phone number from PSTN (_1371) happen one of two things: if time is between 15:01-23:00 fri-sun the call goes to a cel phone 044XXXXXXXXXX and if time is between 23:01-15:00 fri-sun then the call goes to exten 3296. I already did this in my dialplan:
exten => _1371,1,GotoIfTime(15:01-23:00,fri-sun,,,Dial(DAHDI/g11/044XXXXXXXXXX,45,T))
exten => _1371,n,GotoIfTime(23:01-15:00,fri-sun,,,Dial(SIP/3296,50,T))
exten => _1371,n,Hangup()
but isn’t working…
Can anybody help me please??? I can’t find what I’m missing here…
Thanks in advance. BR.
Assuming the time it is matching correctly, you need to use labels
destination
labeliftrue - Continue at labeliftrue if the condition is true. Takes the form similar to Goto() of [[context,]extension,]priority.
labeliffalse - Continue at labeliffalse if the condition is false. Takes the form similar to Goto() of [[context,]extension,]priority.
https://wiki.asterisk.org/wiki/display/AST/Application_GotoIfTime
thanks my friend, but I’m a little bit lost about what you say since my knowledge about Asterisk is very limited. I changed my dialplan for these (changed time to run tests):
exten => _1371,1,GotoIfTime(13:01-23:00,fri-sun,,?celatenclientes,s,1)
exten => _1371,n,Dial(SIP/3296,50,T)
exten => _1371,n,Hangup()
[celatenclientes]
exten => 9044XXXXXXXXXX,1,Dial(DAHDI/g11/${EXTEN:1},40,T)
exten => 9044XXXXXXXXXX,n,Hangup()
but isn’t working neither…can you please tell me how to solve it???
s extension doesnt exist on context celatenclientes, as you have limited knowledge
start reading this Home - Asterisk Documentation
Instead of GotoIfTime you could use an ExecIfTime
ExecIfTime(15:01-23:00,fri-sun,*,*?Dial(DAHDI/g11/044XXXXXXXXXX,45,T))
ExecIfTime(23:01-15:00,fri-sun,*,*?Dial(SIP/3296,50,T))
ExecIfTime would be godo for you, but if you are learning Asterisk it is mandatory you learn how to use goto() or you wont be able to use the real power of Asterisk
thank you both my friends, I already solved!!! I’m using GotoIfTime but already tried ExecIfTime and worked too. Thanks!!!