[Add-CallerID-Call-Queue]
exten => s,1,NoOp(Add new caller ID for existing customer)
same => n,NoOp(This is existing customer with new caller ID. Add him to the DB:${Cust_no})
same => n,Set(RESULT=${ODBC_SLS_ADDCUSTOMER(${Cust_no})})
You’re using this incorrectly. This invokes “readsql” because you’re reading a dialplan function. If you want to use “writesql” you’d use Set on the dialplan function to write to it:
same => n,Set(ODBC_SLS_ADDCUSTOMER(${Cust_no})=1)
Though I haven’t tested it.
You’ve also configured “readsql” twice in SLS_ADDCUSTOMER.
How was it resolved ? And might you please link back to the Asterisk Forums where the solution was found (as you posted this elsewhere e.g. FreePBX Community Forums) ?
The variable I am passing to the ODBC function here comes from another ODBC read function I used before calling this one
Changing the calling ODBC to
[Add-CallerID-Call-Queue]
exten => s,1,NoOp(Add new caller ID for existing customer)
same => n,NoOp(This is existing customer with new caller ID. Add him to the DB:${Cust_no})
same => n,Set(ODBC_SLS_ADDCUSTOMER(${Cust_no},${Cust_name},${Queue_no},${Queue_name},${CALLERID(num)})=${Cust_no},${Cust_name},${Queue_no},${Queue_name},${CALLERID(num)})
same => n,NoOp(Newcustomer added: RESULT=${RESULT})
And writesql command to
writesql=INSERT INTO SLS_Customer (cust_no,cust_name,queue_no,queue_name,caller_id) VALUES (‘${SQL_ESC(${VAL1})}’,‘${SQL_ESC(${VAL2})}’,‘${SQL_ESC(${VAL3})}’,‘${SQL_ESC(${VAL4})}’,‘${SQL_ESC(${VAL5})}’);