I need a specific Contact Header to be sent with every INVITE using PJsip. The problem I have is that the “Contact User” field pjsip has, only gets used for the registration and not INVITEs.
-- Executing [s@macro-dialout-trunk-predial-hook:1] NoOp("Local/023456789@from-internal-00000022;2", "Updating Contact Header") in new stack
-- Executing [s@macro-dialout-trunk-predial-hook:2] Set("Local/023456789@from-internal-00000022;2", "PJSIP_HEADER(update,Contact)=<sip:71234567;tgrp=71234567;[email protected]:5060;transport=udp>") in new stack
[2015-10-14 12:48:56] ERROR[13169][C-00000013]: res_pjsip_header_funcs.c:515 func_write_header: This function requires a PJSIP channel.
So, it looks like it’s trying, but it’s not finding a PJSIP channel. Is there something else I need to reference? I figured it would create the channel before it gets to this point in the FPBX dial-plan?
So, to hook b(macro-dialout-trunk-predial-hook^addheader^1) into that Dial call, would I have to play within the ${DIAL_TRUNK_OPTIONS} variable? Or would it be safe to just add it at the end separated with a comma? Obviously within extension_custom.conf.
Sorry if this is becoming long in the tooth, but I feel it’s worthwhile documenting my pjsip journey. Hopefully it’ll help people as they start migrating to pjsip.
To call PJSIP_HEADER properly, you should add it in its own context, then call it within the Asterisk Trunk Dial Options field in FPBX.
I added the following in extensions_custom.conf
[lets-modify-contact]
exten => modheader,1,Set(PJSIP_HEADER(update,Contact)=<sip:73333333\;tgrp=73333333\;[email protected]:5065\;transport=udp>)
same => n,Return()
Then the following in Asterisk Trunk Dial Options within FPBX:
Ttb(lets-modify-contact^modheader^1)
This is how you would add and modify custom headers… It works, just not in my case, since Asterisk as a whole relies on the Contact Header too much, even with pjsip.
Can anyone recommend a good SBC I can use that works well with Asterisk to play as an interworking function here?