[asterisk-dev] Accessing SIP Headers from within a module
Mark Michelson
mmichelson at digium.com
Wed Aug 14 11:19:38 CDT 2013
A design principle of Asterisk is that channel technology-specific details
are only obtainable from the channel driver for that technology.
Trying to transplant functions from chan_sip.c into app_voicemail.c is
going to lead to, well let's just say, pain :).
What you're better off doing is trying to get data from the SIP header from
within chan_sip.c when a SIP request arrives. You can then save that
information on the ast_channel, potentially using a channel variable (see
pbx_builtin_setvar_helper() and pbx_builtin_getvar_helper() in
include/asterisk/pbx.h). This way, the data will be available on the
channel itself in app_voicemail.c.
Good luck!
Mark Michelson
On Wed, Aug 14, 2013 at 10:36 AM, Josh <josh at sentrix.co.uk> wrote:
>
> Dear Asterisk-Dev,
>
> Apologies if this isn't the right place, I'm mainly looking for a pointer
> on how to access sip headers from within app_voicemail.c, unfortunately I'm
> using asterisk 1.4 (duck!). Is this possible? I have seen the function
>
> func_header_read(chan, NULL, "diversion", diversion, 100);
>
> which is declared static in chan_sip.c so I can't use it.
> Copying the important parts from the routine gives me the
> following:
>
> struct sip_pvt *p;
> p = chan->tech_pvt;
> sip_req *req = (sip_req *)p->initreq; // doesn't compile
> ast_log(LOG_WARNING, "DATA:%s",&p->initreq->header[0]); // doesn't work as
> above.
>
> Is there another way to access these? A function already? Any help/pointer
> would be amazing,
>
> thanks for your time,
>
> Josh
>
> --
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130814/206ac3b1/attachment-0001.htm>
More information about the asterisk-dev
mailing list