Matthias Fechner
2006-Jul-20 04:05 UTC
[asterisk-users] Writing own applications for asterisk - read CALLERIDNUM
Hi,
I'm not sure if this is the right list for this question...
I have written a small application which looks up a number in a
database and return the name for the number if available.
But I have now the problem that I cannot read the variable CALLERIDNUM
from my script.
I tried it with:
value = pbx_builtin_getvar_helper(chan, key);
where chan is the value given from the initial function call (struct
ast_channel *chan) and key is set to "CALLERIDNUM".
But the function always returns NULL.
The function is called with:
exten => 205,1,NoOP(--CALLERID=${CALLERID}, CALLERIDNUM=${CALLERIDNUM},
EXTEN=${EXTEN}--)
exten => 205,2,myAppGet(resolveToName)
exten => 205,3,Dial(SIP/201)
exten => 205,4,Hangup
The NoOp displays the right values.
TIA
Best regards,
Matthias
--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
Russell Bryant
2006-Jul-20 05:12 UTC
[asterisk-users] Writing own applications for asterisk - read CALLERIDNUM
On Thu, 2006-07-20 at 13:05 +0200, Matthias Fechner wrote:> But I have now the problem that I cannot read the variable CALLERIDNUM > from my script. > > I tried it with: > value = pbx_builtin_getvar_helper(chan, key); > > where chan is the value given from the initial function call (struct > ast_channel *chan) and key is set to "CALLERIDNUM". > > But the function always returns NULL.To access the callerid number inside an Asterisk application, you access it directly on the channel structure. ast_verbose("The channel cid num is: %s\n", chan->cid.cid_num); To set it, use the ast_set_callerid() function, which is defined in include/asterisk/channel.h. The third argument is for changing the name, and the fourth is for ANI. ast_set_callerid(chan, "12564286000", NULL, NULL); I hope this helps, -- Russell Bryant Software Developer Digium, Inc.
Matthias Fechner
2006-Jul-20 06:11 UTC
[asterisk-users] Writing own applications for asterisk - read CALLERIDNUM
Hello Russell, * Russell Bryant <russell@digium.com> [20-07-06 08:12]:> ast_verbose("The channel cid num is: %s\n", chan->cid.cid_num);thx a lot! Everything is working perfectly now. :) Best regards, Matthias -- "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning." -- Rich Cook