PJSIP_HEADER_PARAM(header_name,parameter_type,parameter_name)
PJSIP_HEADER_PARAM allows you to read or set parameters in a SIPSession Initiation Protocol, the standard signaling protocol used to set up, manage, and tear down VoIP calls between Asterisk and phones or carriers. header on a PJSIP channel.
Both URI parameters and header parameters can be read and set using this function. URI parameters appear in the URI (inside the <> in the header) while header parameters appear afterwards.
Note
If you call PJSIP_HEADER_PARAM in a normal dialplanThe core call-routing configuration of Asterisk, written mostly in extensions.conf as contexts, extensions, and priorities that decide how every call is handled. Full definition → contextA named section of the dialplan that groups extensions. Calls enter a specific context and can only reach extensions visible from it, making contexts the basic unit of call routing and security. you'll be operating on the caller's (incoming) channel which may not be what you want. To operate on the callee's (outgoing) channel call PJSIP_HEADER_PARAM in a pre-dial handler.
[handler]
exten => addheader,1,Set(PJSIP_HEADER_PARAM(From,uri,isup-oli)=27)
same => n,Return()
[somecontext]
exten => 1,1,Dial(PJSIP/${EXTEN},,b(handler^addheader^1))
same => n,Set(value=${PJSIP_HEADER_PARAM(From,uri,isup-oli)})
header_namerequired - Header in which parameter should be read or set.parameter_typerequired - The type of parameter to get or set.header- Header parameter.uri- URI parameter.
parameter_namerequired - Name of parameter.
User Notes
Know a tip or gotcha for this topic? Share it below and help others.
Contribute a note
Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.