[asterisk-dev] Add SIP Header with PJSIP in C module

Benoit Duverger bduverger at atwtech.com
Wed Oct 21 10:49:17 CDT 2020


Hello,

We have a module written in C which was developed initially for asterisk
1.4, modified a few years ago to run in asterisk 1.8 then 11. This module
is used to verify user's limits, route calls etc...
Actually, I try to adapt it to run in asterisk 16, I moved from chan_sip to
PJSIP and I don't know how can I add SIP Headers into the channel. With
chan_sip we used that:
sprintf( cmd, "SipAddHeader(command:%s)", command );
res = astcmd( chan, cmd );
astcmd is a custom function wrapped onto pbx_exec().

I tried to use pbx_builtin_setvar_helper(), with the function
PJSIP_HEADER() but I didn't see any custom headers in SIP... and no errors,
res = 0.
res = pbx_builtin_setvar_helper(chan, "PJSIP_HEADER(add, X-test)", "test");


How can I use PJSIP_HEADER in a C module ?, which libraries should I need
to import ?

Thanks

--

Benoit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20201021/94abd98c/attachment.html>


More information about the asterisk-dev mailing list