[asterisk-users] set(CALLERID(name) not working

sean darcy seandarcy2 at gmail.com
Wed Nov 12 17:06:03 CST 2008


Doug Lytle wrote:
> sean darcy wrote:
>> Tried it with and with quotes. Same result - exactly. Works with dummy 
>> variable, doesn't if set in subroutine.
>>   
> 
> It works fine for me, I use the below:
> 
> 
> 
> exten => 3175797960,1,Gosub(get_name,s,1)
> 
> [get_name]
> 
> ;********************************************
> ;* Connect to local MySQL database to match-
> ;* against speed dial database for Caller*ID
> ;* name.  If no match, check against Corporate
> ;* Database.  If a match, jump to incoming
> ;* Context.
> ;********************************************
> 
> exten => s,1,MYSQL(Connect connid localhost anonymous '' speeddials)
> exten => s,n,GosubIf($["${MYSQL_STATUS}" = "-1"]?mysql_failed,s,6)
> exten => s,n,MYSQL(Query resultid ${connid} SELECT name FROM 
> Indianapolis WHERE phone = 1${CALLERID(num)})
> exten => s,n,MYSQL(Fetch fetchid ${resultid} caller.name)
> exten => s,n,MYSQL(Disconnect ${connid})
> exten => s,n,MYSQL(Clear ${resultid})
> exten => s,n,Set(CALLERID(name)=${caller.name})
> exten => s,n,Set(CALLERID(num)=${CALLERID(num)})
> exten => s,n,GotoIf($["${caller.name}" != ""]?10:100)
> exten => s,n,NoOP(${DIALSTATUS})
> exten => s,n,Return
> 
> 
> 
Well, it wasn't the quotes, it wasn't you can't set CALLERID(name) in a 
subroutine, it's that the parser doesn't allow/get confused by/ space 
around the assignment.

  Set(CALLERID(name)=Fred)  works

but neither

Set(CALLERID(name) = Fred)

nor

Set(CALLERID(name) =Fred)

works.

BTW, quotes don't make a difference.

And the parser doesn't complain, or make an assignment to null. There's 
just no assignment despite what the CLI shows.

In any event, thanks for the lead, and when I get the time, I'm 
switching to your script.

sean




More information about the asterisk-users mailing list