[Asterisk-Dev] Magic channel-variables

Jacob Tinning tinning at sifira.dk
Tue Oct 18 05:17:50 MST 2005


I am writing a small fix for the SIP Diversion-header parsing
function (get_rdnis) to extract the "reason" parameter.
(See draft-levy-sip-diversion-07, January 16, 2004)

I wish to save the diversion-"reason" somewhere and then read it again
in one of my other modules.

The 'struct ast_callerid' (cid in 'struct ast_channel') doesn't contain
such a field, and I don't think it should, so I will not use that.

I once heard rumors about magic channel-bound variables.
The story told, that a variable prefixed __ (two underscores) or something
like that, would be accesible only in the same channel as it was 'set'.

So my idea is to pbx_builtin_setvar_helper(chan, "__REDIRECTCAUSE", reason); in
chan_sip.c and reason = pbx_builtin_getvar_helper(chan, "__REDIRECTCAUSE");
in my other module.
The important detail is that if two different channels set this variable
then the "receiving" modules will also get two different values from getvar_helper.

Can anyone confirm this rumor ?

If anyone are interrested, I can submit the fix to mantis when done..

Mvh. Jacob
-- 

Jacob Tinning
System Developer




More information about the asterisk-dev mailing list