[Asterisk-Dev] Passing SIP parameters to AGI scripts: coding advice needed

Otmar Lendl lendl at nic.at
Tue Jul 12 08:12:09 MST 2005


Hi,

for some AGI scripts which I was asked to write I need access to more
than the usual range of parameters which are passed to AGI scripts.

In my case, all (interesting) calls will come in via SIP and for my
processing logic, I need details like the IP-address of call-originating
SIP server, the AoR of the caller, and perhaps some RTP parameters.

Digging through the code I saw that the AGI environment is created by
setup_env in res_agi.c. The only sip-relevant parameters I see there
are e.g. 'channel' => 'SIP/proxy01.sipphone.com-4081a160', callerid and
'type' => 'SIP'.

My first guess was that adding the appropriate fdprintf calls shouldn't
be a problem, but I was wrong.

Within res_agi.c, I do not have access to the definition of struct
sip_pvt, and thus I can't access the data stored in chan->tech_pvt.

Ok, I thought, then let's create a function in chan_sip.c which prints
out the AGI header lines. This doesn't seem to be viable either, as
chan_sip is dynamically loaded and I can't just call an arbitrary
function from there.

--------------------------

So what is the best way of doing this? As I see it the correct way seems
to be to augment the ast_channel_tech structure and add capability to
output tech-specific AGI parameters there.

Is this assessment correct?

And if yes, would a patch doing this get accepted into the mainstream
codebase?

/ol 
-- 
< Otmar Lendl (lendl at nic.at) | nic.at Systems Engineer >



More information about the asterisk-dev mailing list