<div dir="ltr"><div>You add headers in a similar way as before. It is just a matter of adding them to the right channel.</div><div>You must add them to the outgoing channel for PJSIP. This can be accomplished by using pre-dial handlers [1][2].</div><div><br></div><div>Richard</div><div><br></div><div>[1] <a href="https://wiki.asterisk.org/wiki/display/AST/Pre-Dial+Handlers">https://wiki.asterisk.org/wiki/display/AST/Pre-Dial+Handlers</a></div><div>[2] <a href="https://www.asterisk.org/dialplan-handler-routines-allow-customization/">https://www.asterisk.org/dialplan-handler-routines-allow-customization/</a></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 21, 2020 at 10:49 AM Benoit Duverger <<a href="mailto:bduverger@atwtech.com">bduverger@atwtech.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<br><br>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... <br>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:<div>sprintf( cmd, "SipAddHeader(command:%s)", command );<br>res = astcmd( chan, cmd );<br>astcmd is a custom function wrapped onto pbx_exec(). <br><br>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.</div><div>res = pbx_builtin_setvar_helper(chan, "PJSIP_HEADER(add, X-test)", "test");<br></div><div><br><br>How can I use PJSIP_HEADER in a C module ?, which libraries should I need to import ?<br><br>Thanks<br clear="all"><div><br></div>--<div><br></div><div>Benoit<br><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr" style="color:rgb(136,136,136)"><div dir="ltr"><div style="font-size:12.8px"></div></div></div></div></div></div></div></div></div></div></div></div></div>
-- <br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
<br>
asterisk-dev mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-dev</a></blockquote></div></div>