Re: [asterisk-users] Writing own applications for asterisk - read CALLERIDNUM

2006-07-20 Thread Matthias Fechner
Hello Russell,

* Russell Bryant <[EMAIL PROTECTED]> [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
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Writing own applications for asterisk - read CALLERIDNUM

2006-07-20 Thread Russell Bryant
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.

___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


[asterisk-users] Writing own applications for asterisk - read CALLERIDNUM

2006-07-20 Thread Matthias Fechner
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
___
--Bandwidth and Colocation provided by Easynews.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users