Table of Contents
pvh_collect_headers()
pvh_apply_headers()
pvh_reset_headers()
pvh_check_header(hname)
pvh_append_header(hname, hvalue)
pvh_modify_header(hname, hvalue, [idx])
pvh_remove_header(hname, [idx])
pvh_value_exists(hname, hparameter)
pvh_remove_header_param(hname, hparameter)
List of Examples
Table of Contents
pvh_collect_headers()
pvh_apply_headers()
pvh_reset_headers()
pvh_check_header(hname)
pvh_append_header(hname, hvalue)
pvh_modify_header(hname, hvalue, [idx])
pvh_remove_header(hname, [idx])
pvh_value_exists(hname, hparameter)
pvh_remove_header_param(hname, hparameter)
The main goal of the module is to offload the intermediate header processing into the XAVI dynamic container as well as provide with high level methods and pseudovariables to simplify SIP message header modifications.
The following modules must be loaded before this module:
uac.
tm.
Needed only if “auto_msg” parameter is set to 1.
Name of the XAVI where the collected headers are stored.
Default value is “headers”.
Example 1.1. Set xavi_name
parameter
... modparam("pv_headers", "xavi_name", "headers") ...
Result: $xavi(headers[0]=>From) $xavi(headers[0]=>To) $xavi(headers[0]=>Call-ID)
Defines an internal maximum SIP header value size. Header values longer than this setting will be stripped down when collected or applied.
Default value is 1024.
Example 1.2. Set header_value_size
parameter
... modparam("pv_headers", "header_value_size", 512) ...
Used to mark that headers are collected for the SIP message, leading to subsequent headers collection on this message to be declined with an error. Should be used only in branches and replies.
Default value is 27.
Example 1.3. Set header_collect_flag
parameter
... modparam("pv_headers", "header_collect_flag", 17) ...
Used to mark that headers are applied for the SIP message, leading to subsequent headers applies on this message to be declined with an error. Should be used only in branches and replies.
Default value is 28.
Example 1.4. Set header_apply_flag
parameter
... modparam("pv_headers", "header_apply_flag", 18) ...
A comma separated headers list that must be excluded from processing (they are skipped when pvh_apply_headers() changes the SIP message headers).
If the parameter is set to an empty string then all the SIP message headers are processed.
Default value is “Record-Route,Via,Route,Content-Length,Max-Forwards,CSeq”.
Example 1.5. Set skip_headers
parameter
... modparam("pv_headers", "skip_headers", "Record-Route,Via,Route") ...
A comma separated headers list that must be split into multi headers if their value is a comma separated list.
If the parameter is set to an empty string then no headers are split.
Default value is “”.
Example 1.6. Set split_headers
parameter
... modparam("pv_headers", "split_headers", "Diversion") ...
Result: Received Diversion header: Diversion: <user1@test.local>,<user2@test.local>,<user3@test.local> After split: Diversion: <user1@test.local> Diversion: <user2@test.local> Diversion: <user3@test.local>
Becomes handy if used together with pvh_modify_header() or pvh_remove_header() to change or remove value 2 for instance.
Defines whether the headers are automatically collected for incoming messages, as well as automatically applied for forwarded messages.
It is enabled by default and requires the 'tm' module to be loaded, otherwise the mode is disabled and manual invocation of pvh_collect_headers()/pvh_apply_headers() is required.
Default value is 1 (enabled).
Collects all headers from the message into the XAVP. It should be used preferably just when the SIP message is received by Kamailio.
This function can be used from ANY_ROUTE.
Applies the current XAVP headers state to the real headers. Should be called only once per branch when the message is about to leave Kamailio.
The following rules apply:
This function can be used from ANY_ROUTE.
Collects all headers from the message into the XAVP. It should be used preferably just when the SIP message is received by >Kamailio.
This function can be used from ANY_ROUTE.
Checks if the header “hname” already exists in the XAVP.
This function can be used from ANY_ROUTE but only after pvh_collect_headers() or with “auto_msg” parameter enabled.
Appends a new header “hname” with the value “hvalue” into the XAVP. Please note that subsequent "pv_append_header" calls will result in multiple headers.
If the provided “hvalue” is $null then the header is added into the XAVP but it is not going to be added into the message.
This function can be used from ANY_ROUTE but only after pvh_collect_headers() or with “auto_msg” parameter enabled.
Modifies an existing header in the XAVP “hname” with the value “hvalue” into the XAVP. Index order is top to bottom. Please note that subsequent pvh_append_header calls will result in multiple headers.
Please note that if the header “hname”does not exist it will be explicitly appended. If there are multiple headers with the same name and “idx” is omitted, only the first one will be affected.
This function can be used from ANY_ROUTE but only after pvh_collect_headers() or with “auto_msg” parameter enabled.
Removes an existing header “hname” from the XAVP. Index order is top to bottom.
If there are multiple headers with the same name and “idx” is omitted, all of them will be removed.
This function can be used from ANY_ROUTE but only after pvh_collect_headers() or with “auto_msg” parameter enabled.
Checks if the parameter “hparameter” is present in the header “hname” from XAVP.
This function can be used from ANY_ROUTE but only after pvh_collect_headers() have been called or with “auto_msg” parameter enabled.
Removes an existing parameter “hparameter” in the header “hname” from the XAVP.
If there are multiple headers, only the one containing the parameter will be modified.
The parameter can be located in any position (beginning, middle or end) of the list of parameters.
If the parameter is the only one present, the header will be removed.
This function can be used from ANY_ROUTE but only after pvh_collect_headers() have been called or with “auto_msg” parameter enabled.
$x_hdr
$x_fu
$x_fU
$x_fd
$x_fn
$x_ft
$x_tu
$x_tU
$x_td
$x_tn
$x_tt
$x_rs
$x_rr
Exported pseudo-variables are documented at https://www.kamailio.org/wikidocs/.