More fancy queues

As mentioned in my previous post about queueing, I wanted to add some code that automatically adds an extension into the queue database table the first time they log in. I finally got around to adding the three lines in extensions.conf as well as creating the extra func_odbc.conf entries.  Total time for the addition was only a few minutes.

First, extensions.conf:

exten => *7,48,Set(EXIST=${ODBC_EXTENEXIST(${CALLERID(num)},queuenum)})
exten => *7,49,Gotoif($["${EXIST}" = "${CALLERID(num)}"]?51:43)
exten => *7,50,Set(ODBC_QUEUENUMC()=${CALLERID(num)}\,1234)

It’s pretty basic – set variable “exist” to the output from a select statement that tries to pull the extension from the “queuenum” table.  From there, compare “exist” to “queuenum”.  If it matches, go ahead and log the person in with the code in my previous post, otherwise create the entry with default information, then go ahead and log them in like everyone else.

Func_odbc entries:

[EXTENEXIST]
dsn=asterisk
read=SELECT ${ARG1} FROM ${ARG2}  WHERE EXTEN = '${ARG1}'

[QUEUENUMC]
dsn=asterisk
write=insert queuenum (exten,queue) values ('${VAL1}','${VAL2}')

And there you have it!

Both comments and pings are currently closed.

Comments are closed.