Redirect calls from external to VM part2

Yes. DB = database.

Pro Tip: at the bash prompt, you can grep the AstDB with:

asterisk -x "database show" | grep <string>

OK awesome! that is what I thought at first, guess I got into my own head. Back to the drawing board.

OK here it is, I added @classroom under Account Code for any classroom extension

Used a regex to search for the word @classroom in the above field

;AMPUSER daytime redirect
[daytimevm-custom-ampuser]
exten => _XXXX,1,Answer()
same => n,Set(CALLER_ACCOUNTCODE=${DB(AMPUSER/${EXTEN}/accountcode)})
same => n,NoOp(========== The DAYTIMEVM for ${EXTEN} value is ${CALLER_ACCOUNTCODE} ==========)
same => n,NoOp(========== ${EXTEN} @classroom = ${REGEX(“@classroom” ${CALLER_ACCOUNTCODE})} ==========)
same => n,GotoIf($[“${REGEX(”@classroom" ${CALLER_ACCOUNTCODE})}" != “1”]]?SkipForwardVM)
same => n,GotoIfTime(15:30-7:00,mon-sun,,?SkipForwardVM)
same => n(ForwardVM),Voicemail(${EXTEN},u)
same => n,Macro(hangupcall,)
same => n(SkipForwardVM),Goto(from-did-direct-continue,${EXTEN},1)
same => n,Hangup()

Only thing I wish I could get working is, instead of hard coding the gotoiftime, but instead referencing the “Time Groups” so I could update the times from the gui. As well, if I have a Directory with “Spell By Name” enabled it does not apply to this dialplan. I cant figure out what context it is using, seems to be using “from-internal”

Thanks @dicko and @lgaetz!!!

A time condition (not a group) has a toggle feature code with an associated hint:

*CLI> core show hint *271
*271@timeconditions-: Custom:TC1            State:InUse           Presence:not_set         Watchers  0

See this post where you can see the value of a hint with

${EXTENSION_STATE(*271@from-internal)}

In this case it will probably return either NOT_INUSE or INUSE.

Awesome! thanks @lgaetz I got it working with Time conditions now! Here itis if anyone is interested.

exten => _XXXX,1,Answer()
same => n,Set(CALLER_ACCOUNTCODE=${DB(AMPUSER/${EXTEN}/accountcode)})
same => n,Set(classroom_hours=${EXTENSION_STATE(*271@from-internal)})
same => n,Set(holiday=${EXTENSION_STATE(*273@from-internal)})
same => n,GotoIf($[“${REGEX(”@classroom" ${CALLER_ACCOUNTCODE})}" != “1”]]?SkipForwardVM)
same => n,GotoIf($[“${classroom_hours}” = “INUSE”]?SkipForwardVM)
same => n,GotoIf($[“${holiday}” = “NOT_INUSE”]?SkipForwardVM)
same => n(ForwardVM),Voicemail(${EXTEN},u)
same => n,Macro(hangupcall,)
same => n(SkipForwardVM),Goto(from-did-direct-continue,${EXTEN},1)
same => n,Hangup()

4 Likes

When you get it refined to the point you like it, create a new thread in ‘Tips and Tricks’ with the result.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.