This is a bit of dialplan I’m concerned with (Asterisk 11)

exten => getPledges,1,Verbose(Caller was matched to a single record in the database)
same => n,Set(client = ${ODBC_FETCH(${matches})})
same => n,Set(clientID = ${client})
same => n,ODBCFinish(${matches})
same => n,Verbose(1, Caller’s clientID is: ${client})

When the call gets to this point in the dialplan - here’s the output from the console:

-- Executing [getPledges@moApplicationCheck:1] Verbose("SIP/energy_ivr1_NIN6PeRY7-00000021", "Caller was matched to a single record in the database") in new stack

Caller was matched to a single record in the database
– Executing [getPledges@moApplicationCheck:2] Set(“SIP/energy_ivr1_NIN6PeRY7-00000021”, [color=#FF0000]“client = 2”[/color]) in new stack
– Executing [getPledges@moApplicationCheck:3] Set(“SIP/energy_ivr1_NIN6PeRY7-00000021”, "clientID = ") in new stack
– Executing [getPledges@moApplicationCheck:4] ODBCFinish(“SIP/energy_ivr1_NIN6PeRY7-00000021”, “32”) in new stack
– Executing [getPledges@moApplicationCheck:5] Verbose(“SIP/energy_ivr1_NIN6PeRY7-00000021”, "1, Caller’s clientID is: ") in new stack
Caller’s clientID is:

So, the problem is that the query runs fine and sets the variable client equal to 2. However, it seems no matter what I do I cannot pass that variable anywhere else. You’ll see I’m trying to set clientID equal to the value of client, or at least display it but it seems to be null even though the console shows that ODBC_FETCH is assigning a value of 2 to the client variable initially.

I’ve been banging my head against the wall for a while on this one and cannot seem to come up with an answer. Any help would be greatly appreciated.

I would suggest small modification. Remove space in line

same => n,Set(client = ${ODBC_FETCH(${matches})})


same => n,Set(client=${ODBC_FETCH(${matches})})

It seems that variable client is empty.
Please also try to add noop statement to check where is the problem

same => n,NoOp("${client}")
same => n,NoOp("${clientID}")

to your dialplan just after each set statement

That did it, bbialy! My, my what a difference white space makes. Thanks a million.