xavp_name (string)
Name of the XAVP there the collected headers are stored.
Default: headers
modparam("pv_headers", "xavp_name", "headers") Result: $xavp(headers[0]=>From) $xavp(headers[0]=>To) $xavp(headers[0]=>Call-ID) ....
skip_headers (string)
A comma separated headers list that must be excluded from processing (they are skipped when pv_apply_headers() changes the sip message headers). If the parameter is not set then the "Default" list is used. If the parameter is set to an empty string then all the sip message headers are processed.
Default: Record-Route,Via,Route,Content-Length,Max-Forwards
split_headers (string)
A comma separated headers list that must be split into multi headers if their value is a comma separated list. If the parameter is not set then the "Default" is used. If the parameter is set to an empty string then no headers are split.
Default: None
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 pv_modify_header() or pv_remove_header() to change or remove value 2 for instance.
pv_collect_headers()
This function collects all headers from the message into the XAVP. It should be used preferably just when the sip message is reveived by kamailio.
Returns:
pv_apply_headers()
This function applies the current XAVP headers state to the real headers and should be called only once per branch when the message is about to leave kamailio.
The following rules apply:
Usage:
if (pv_apply_headers()) { "success" } else { "errors" }
pv_reset_headers()
This function resets the current XAVP headers list and enables pv_collect_headers() and pv_apply_headers() to be called again in the same branch.
Usage:
if (pv_reset_headers()) { "success" } else { "errors" }
pv_check_header(hname)
This function checks if the header already exists in the XAVP. It can be freely called from anywere, but only after pv_collect_headers().
Usage:
if (pv_check_header(hname)) { "exists" } else { "does not exist" }
pv_append_header(hname, hvalue)
This function appends a new header into the XAVP. It can be freely called from anywere, but only after pv_collect_headers(). 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.
Usage:
if (pv_append_header(hname, hvalue)) { "appended" } else { "errors" }
pv_modify_header(hname, hvalue)
This function modifies an existing header in the XAVP. It can be freely called from anywere, but only after pv_collect_headers(). Please note that if the header does not exist it will be explicitly appended. If there are multiple headers with the same name only the first one will be affected. If the provided header value is $null then the header is modified in the XAVP then it is removed from the sip message when pv_apply_headers() is called.
Usage:
if (pv_modify_header(hname, hvalue)) { "modified" } else { "errors" }
pv_modify_header(hname, idx, hvalue)
This function works similar to pv_modify_header(hname, hvalue) but should be used when there are multiple headers with the same name one of them to be modified. Index order is top to bottom.
Usage:
if (pv_modify_header(hname, idx, hvalue)) { "modified" } else { "errors" }
pv_remove_header(hname)
This function removes an existing header from the XAVP. It can be freely called from anywere, but only after pv_collect_headers(). If there are multiple headers with the same name all of them are removed. It returns -1 if the header does not exist.
Usage:
if (pv_remove_header(hname, hvalue)) { "removed" } else { "does not exist or errors" }
pv_remove_header(hname, idx, hvalue)
This function works similar to pv_remove_header(hname, hvalue) but should be used when there are multiple headers with the same name one of them to be removed. Index order is top to bottom.
Usage:
if (pv_remove_header(hname, idx, hvalue)) { "removed" } else { "does not exist or errors" }
$x_hdr
This pseudovariable is used to append/modify/remove headers by their name and can be used instead of the pv_append_header(), pv_modify_header(), pv_remove_header() functions.
Usage:
$x_hdr(X-Header) = "example";
$(x_hdr(X-Header)[0]) = "example";
$(x_hdr(X-Header)[*]) = "example";
$(x_hdr(X-Header)[2]) = $null;
$(x_hdr(X-Header)[*]) = $null;
$var(test) = $x_hdr(X-Header);
$var(test) = $x_hdr(X-Header)[*]);
$var(test) = $(x_hdr(X-Header)[2]);
$x_fu, $x_tu
These pseudovariables are used to modify/retrieve the "From" and "To" headers.
Usage:
$x_fu = "User1 <440001@example.local>";
$var(test) = $x_fu;
$x_fU, $x_tU
These pseudovariables are used to modify/retrieve the username part of the "From" and "To" headers.
Usage:
$x_fU = "440001";
$var(test) = $x_fU;
$x_fd, $x_td
These pseudovariables are used to modify/retrieve the domain part of the "From" and "To" headers.
Usage:
$x_fd = "example.local";
$var(test) = $x_fd;
$x_fn, $x_tn
These pseudovariables are used to modify/retrieve the display part of the "From" and "To" headers.
Usage:
$x_fn = "User1";
$var(test) = $x_fn;
$x_ft, $x_tt
These pseudovariables are used to retrieve the tag part of the "From" and "To" headers.
Usage:
$var(test) = $x_ft;
$x_rs, $x_rr
These pseudovariables are used to modify/retreive or change "status" and "code" of the SIP reply NOTE: Only messages with reply status > 300 can be changed as well as reply status 1xx and 2xx cannot be set
Usage:
$x_rs = 486
$var(test) = $x_rs;
$x_rr = "Custom Reason"
$var(test) = $x_rr;