Skip to main content

Day / Night in MTE

Posted by abongard on Thu, 12/17/2009

having problems with day/night mode in MTE and PBX Manager 6.0.1.76

have setup

day to go to IVR
night to go to EXTENSION
temp to go to another EXTENSION

it only goes to the the first one on the handler list

i get an error

[Dec 17 14:55:34] WARNING[20567]: ast_expr2.fl:435 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected '', expecting $end; Input:
""day"" = "temp"
^
[Dec 17 14:55:34] WARNING[20567]: ast_expr2.fl:439 ast_yyerror: If you have questions, please refer to doc/tex/channelvariables.tex in the asterisk source.


Submitted by eeman on Thu, 12/17/2009 Permalink

did you set your mode from a phone?

my advice is to set

day to IVR
temp to EXTENSION
any to EXTENSION (formerly night)

that way any can be your catch-all route

Submitted by abongard on Fri, 12/18/2009 Permalink

this is from inbound.include

exten => 14164610207,1,Set(DIALED_PUBLIC_NUMBER=${EXTEN})
exten => 14164610207,2,Set(DIALED_NUMBER=${EXTEN})
exten => 14164610207,3,Set(status=${DB(TL/TENANT/ocld/status)})
exten => 14164610207,4,GotoIf($["${status}" != "0"]?7)
exten => 14164610207,5,Playback(ss-noservice)
exten => 14164610207,6,Congestion
exten => 14164610207,7,GotoIf($["${DB(TL/TENANT/ocld/officemode)}" = "day"]?from-outside-14164610207-day,${EXTEN},1)
exten => 14164610207,8,GotoIf($["${DB(TL/TENANT/ocld/officemode)}" = "temp"]?from-outside-14164610207-temp,${EXTEN},1)
exten => 14164610207,9,Goto(from-outside-14164610207-any,${EXTEN},1)

Submitted by eeman on Fri, 12/18/2009 Permalink

I just tested your dialplan and its working correctly. Either your database value is bad or you have a broken version of asterisk

how did you install asterisk
what version is asterisk

Submitted by eeman on Fri, 12/18/2009 Permalink

here is how i tested your dialplan.. I created a context called test-dial in user_extensions.include with your dialplan. Then i created the database key set to temp and did a test dial from console

eeman*CLI> database put TL/TENANT/ocld officemode temp
Updated database successfully
eeman*CLI> console dial 14164610207@test-dial
== Console is full duplex
[Dec 18 10:11:04] NOTICE[11268]: console_video.c:133 console_video_start: voice only, console video support not present
-- Executing [14164610207@test-dial:1] Set("Console/dsp", "DIALED_PUBLIC_NUMBER=14164610207") in new stack
-- Executing [14164610207@test-dial:2] Set("Console/dsp", "DIALED_NUMBER=14164610207") in new stack
-- Executing [14164610207@test-dial:3] Set("Console/dsp", "status=") in new stack
-- Executing [14164610207@test-dial:4] GotoIf("Console/dsp", "1?7") in new stack
-- Goto (test-dial,14164610207,7)
-- Executing [14164610207@test-dial:7] GotoIf("Console/dsp", "0?from-outside-14164610207-day,14164610207,1") in new stack
-- Executing [14164610207@test-dial:8] GotoIf("Console/dsp", "1?from-outside-14164610207-temp,14164610207,1") in new stack
-- Goto (from-outside-14164610207-temp,14164610207,1)
[Dec 18 10:11:04] WARNING[11269]: pbx.c:3858 __ast_pbx_run: Channel 'Console/dsp' sent into invalid extension '14164610207' in context 'from-outside-14164610207-temp', but no invalid handler
<< Hangup on console >>

see how the GotoIf for step 8 matches true invoking a goto for from-outside-14164610208-temp ?

that indicates that theres no issue with the code, theres something wrong with either the database key or your asterisk binary.

Submitted by abongard on Fri, 12/18/2009 Permalink

database get TL/TENANT/ocld officemode
Value: "temp"

when I change it to day I get:

database get TL/TENANT/ocld officemode
Value: "day"

Submitted by eeman on Fri, 12/18/2009 Permalink

you're adding the quotes?

1.6.0.6 ???? you should be running something newer

show me your macro-tl-set-daynight in scripts.include

Submitted by abongard on Fri, 12/18/2009 Permalink

exten => s,1,Answer
exten => s,n,Authenticate(${ARG1})
exten => s,n(begin),Playback(tl/welcome-mode-menu)
exten => s,n,Playback(tl/after-tone-choose)
exten => s,n,Playback(tl/to-set)
exten => s,n,Playback(tl/day-mode)
exten => s,n,Playback(press-1)
exten => s,n,Playback(tl/to-set)
exten => s,n,Playback(tl/night-mode)
exten => s,n,Playback(press-2)
exten => s,n,Playback(tl/to-set)
exten => s,n,Playback(tl/temp-mode)
exten => s,n,Playback(press-3)
exten => s,n,Read(MODE,beep,1,,,7)
exten => s,n,GotoIf($["${MODE}" != ""]?${MODE},1)
exten => s,n,Goto(s,begin)

exten => 1,1,Set(DB(TL/TENANT/${tenant}/officemode)="day")
exten => 1,n,Playback(system)
exten => 1,n,Playback(has-been-set-to)
exten => 1,n,Playback(tl/day-mode)
exten => 1,n,Wait(1)
exten => 1,n,Playback(goodbye)
exten => 1,n,Hangup

exten => 2,1,Set(DB(TL/TENANT/${tenant}/officemode)="night")
exten => 2,n,Playback(system)
exten => 2,n,Playback(has-been-set-to)
exten => 2,n,Playback(tl/night-mode)
exten => 2,n,Wait(1)
exten => 2,n,Playback(goodbye)
exten => 2,n,Hangup

exten => 3,1,Set(DB(TL/TENANT/${tenant}/officemode)="temp")
exten => 3,n,Playback(system)
exten => 3,n,Playback(has-been-set-to)
exten => 3,n,Playback(tl/temp-mode)
exten => 3,n,Wait(1)
exten => 3,n,Playback(goodbye)
exten => 3,n,Hangup

exten => _X,1,Playback(invalid)
exten => _X,n,Goto(s,begin)

Submitted by eeman on Fri, 12/18/2009 Permalink

you see the lines that set the database key to "temp" and "day" etc?

try removing the quotes from around them and then from CLI type

> dialplan reload

then re-set your day mode and tell me if that has an impact?