Comma Issue With Func_odbc

Home » Asterisk Users » Comma Issue With Func_odbc
Asterisk Users 1 Comment

Hey all

I have an issue that I have been bumping up against. We have some inbound fax services and occasionally an inbound fax that successfully came in would fail to store it’s references in the database.

We are using a function in func_odbc to update a database table. We call the function from the dialplan and pass in all the opt_xxx return values as well as other important values we need to store. The issue we are having is this.

In some cases values such as Caller ID, Remote Station ID and Header Info will have a comma in them. Even though these values are being encoded using SQL_ESC the comma is being interpreted as an extra parameter and messing up the storage values and causing the database insert to fail. Is there a way to encode variables with commas in their values so they can be sent into the func_odbc function as a parameter without causing the process to thing it has more parameters?

Exp…

If the ${CALLERID(number)} or ${FAXOPT(remotestationid)} or others in the line below have a comma in them then the parameter order pushed buy one and the value is broken up when building the insert statement.

exten =>
Do-Store,n,Set(FAX-DO-STORE()=${CALLERID(number)},${CALLERID(name)},${l_faxF
ile_Path},${l_faxFile_FullName},${FAXOPT(ecm)},${FAXOPT(filename)},${FAXOPT(
localstationid)},${FAXOPT(headerinfo)},${FAXOPT(remotestationid)},${FAXOPT(m axrate)},${FAXOPT(minrate)},${l_storeRate},${FAXOPT(pages)},${FAXOPT(resolut ion)},${FAXOPT(error)},${FAXOPT(status)},${FAXOPT(statusstr)})

Any ideas suggestions on how to over come this. Would be appreciated.

Thanks Bryant Any ideas suggestions on how to over come this. Would be appreciated.ThanksBryant

One thought on - Comma Issue With Func_odbc

  • Can you quote it like this:
    DO-STORE()=”${CALLERID(number)}”,”${CALLERID(name)}”,…

    Richard