[asterisk-users] FUNC_ODBC and ARRAY

Paul Belanger pabelanger at digium.com
Sat Jan 22 22:48:40 CST 2011


On 11-01-22 08:46 PM, Sherwood McGowan wrote:
> Gentlemen,
> 
> I have googled, searched the mailing list archives, and even spoke on
> the IRC channel, but have not found an answer to the following
> problem. I am attempting to retrieve multiple columns in an ODBC query
> using ARRAY per the solutions offered by many individuals. My dialplan
> code is as follows:
> 
Here is some code I use on Asterisk 1.8:

extensions.conf
---
[SQL_CheckCallback]
exten => s,1,CELGenUserEvent(ODBC, ${CONTEXT})
    same =>
n,Set(ARRAY(SCHEDULEID,CALLDATE,CONTACTID)=${ODBC_CHECKCALLBACK(${ARG1})})
    same => n,Return(${ISNULL(${SCHEDULEID})})

func_odbc.conf
---
[CHECKCALLBACK]
dsn=asterisk
readsql=SELECT s.Id, c.CallDate, c.Id FROM Schedules s, ListContacts c
WHERE s.user='${SQL_ESC(${ARG1})}' AND s.Contact=c.Id AND s.Active=True

Hope it helps.

-- 
Paul Belanger
Digium, Inc. | Software Developer
twitter: pabelanger | IRC: pabelanger (Freenode)
Check us out at: http://digium.com & http://asterisk.org



More information about the asterisk-users mailing list