I have generated a dialplan, where you call one function or another, depending on what time you call.
My problem comes when it goes from morning shift to afternoon shift
Like i said earlier i create a time slot.
n,gotoiftime(8:00-15:00,mon-thu,*,*,?atencionPublico)
n,gotoiftime(15:00-17:30,mon-thu,*,*,?atencionPublicoAttTardes)
n(atencionPublicoAttTardes),BackGround(/var/lib/asterisk/sounds/ocm/NavarraHorario)
n,waitexten(5)
n,Set(ACTION=FUNC_SKILL NA_IncidenciasTardes)
n,AGI(agi:async)
exten => 1,1,Set(ACTION=FUNC_DIALPLAN NavarraPulsa1)
n,AGI(agi:async)
;*******************************************************
n(atencionPublico),BackGround(/var/lib/asterisk/sounds/ocm/Navarra)
n,waitexten(5)
n,Set(ACTION=FUNC_SKILL NA_Incidencias)
n,AGI(agi:async)
exten => 1,1,Set(ACTION=FUNC_DIALPLAN NavarraPulsa1)
n,AGI(agi:async)
My problem is that I have to change the order of the call to make it work.
Can somebody help me?
Remember that
gotoiftime
will continue executing dialplan if your condition is false. If your dialplan is exactly as shown, you don't have a handler for Fri-Sun, before 8am, or after 5:30pm. It would simply continue executing the next step when bothgotoiftime
conditions are false, meaning it would go to the next step, which isn(atencionPublicoAttTardes)
.In order to be certain that your condition for
15:00-17:30,mon-thu,*,*,
is correct, try adding a step between the conditions and the afternoon handler, like for examplen,Hangup()
(don't use this live of course, just for testing).If you find that it's hanging up instead of executing the afternoon dialplan, the problem is actually the condition in
gotoiftime
, not the order of the handlers.Normally the order shouldn't matter. This is the only reason I can think that it would affect the result.