[asterisk-users] comma issue with func_odbc

Richard Mudgett rmudgett at digium.com
Tue Aug 21 19:46:19 CDT 2012


> 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_faxFile_Path},${l_faxFile_FullName},${FAXOPT(ecm)},${FAXOPT(filename)},${FAXOPT(localstationid)},${FAXOPT(headerinfo)},${FAXOPT(remotestationid)},${FAXOPT(maxrate)},${FAXOPT(minrate)},${l_storeRate},${FAXOPT(pages)},${FAXOPT(resolution)},${FAXOPT(error)},${FAXOPT(status)},${FAXOPT(statusstr)})
> 
> Any ideas suggestions on how to over come this. Would be appreciated.

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

Richard



More information about the asterisk-users mailing list