This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
cookbooks:devel:pseudovariables [2021/06/09 12:36] miconda [$siptrace(name)] |
cookbooks:devel:pseudovariables [2022/03/22 17:13] jih [$tu - To URI] |
||
---|---|---|---|
Line 171: | Line 171: | ||
<code c> | <code c> | ||
xlog(" | xlog(" | ||
+ | </ | ||
+ | |||
+ | **$cnt(xavp)** - return the number of xavps | ||
+ | |||
+ | < | ||
+ | * $cnt($xavp(key[*])) : number of XAVPs " | ||
+ | * $cnt($xavp(key[n]=> | ||
+ | * $cnt($xavp(key[*]=> | ||
+ | |||
+ | * $cnt($xavp(key[n])) : 1 or 0 (if this index exists or not). | ||
+ | * $cnt($xavp(key[-n])) : same but with reverse indexing (-1 is the last index). | ||
+ | |||
+ | * $cnt($xavp(key[*]=> | ||
+ | |||
+ | * $cnt($xavp(key)) is the same as $cnt($xavp(key[*])). | ||
+ | * $cnt($xavp(key=> | ||
</ | </ | ||
==== $conid - TCP Connection ID ==== | ==== $conid - TCP Connection ID ==== | ||
Line 564: | Line 580: | ||
**$Rp** - reference to the port where the message was received | **$Rp** - reference to the port where the message was received | ||
+ | |||
+ | ==== $Rn - Received socket name ==== | ||
+ | |||
+ | **$Rn** - reference to the name of the socket where the message was received | ||
==== $RAu - Advertised socket URI ==== | ==== $RAu - Advertised socket URI ==== | ||
Line 673: | Line 693: | ||
**$tu** - reference to URI of ' | **$tu** - reference to URI of ' | ||
+ | |||
+ | It is R/W variable (you can assign values to it directly in configuration file, but its value does not change) | ||
==== $tU - To URI Username ==== | ==== $tU - To URI Username ==== | ||
Line 961: | Line 983: | ||
Implemented for: | Implemented for: | ||
+ | * Record-Route | ||
+ | * Route | ||
* Via | * Via | ||
Line 1159: | Line 1183: | ||
</ | </ | ||
- | ==== $rpl(key) ==== | + | ===== $rpl(key) |
Attributes of the SIP reply processed at that moment. The variables must be used during SIP reply processing, otherwise it returns $null. | Attributes of the SIP reply processed at that moment. The variables must be used during SIP reply processing, otherwise it returns $null. | ||
Line 1179: | Line 1203: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ===== $msgbuf(index) ===== | ||
+ | |||
+ | Get or set the character in the message buffer at the position index. | ||
+ | |||
+ | The index has to be a positive integer or a variable holding such value. | ||
+ | |||
+ | Note that the variable returns a clone of the character stored in a static buffer, copy it to another variable if you want to compare with another $msgbuf(index). | ||
+ | |||
+ | The update is done directly and immediately in the message buffer -- use it with care! | ||
+ | |||
+ | Example of usage: | ||
+ | |||
+ | <code c> | ||
+ | if ($msgbuf(20)==" | ||
+ | $msgbuf(20) = " | ||
+ | } | ||
+ | </ | ||
+ | ===== Header Field Iterator ===== | ||
+ | |||
+ | ==== $hfitname(iname) ==== | ||
+ | |||
+ | The header name of the header field iterator. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | hf_iterator_start(" | ||
+ | while(hf_iterator_next(" | ||
+ | xlog(" | ||
+ | } | ||
+ | hf_iterator_end(" | ||
+ | </ | ||
+ | |||
+ | ==== $hfitbody(iname) ==== | ||
+ | |||
+ | The header body of the header field iterator. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | hf_iterator_start(" | ||
+ | while(hf_iterator_next(" | ||
+ | xlog(" | ||
+ | } | ||
+ | hf_iterator_end(" | ||
+ | </ | ||
+ | |||
+ | ===== Body Line Iterator ===== | ||
+ | |||
+ | ==== $blitval(iname) ==== | ||
+ | |||
+ | The value of the body line iterator. | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | bl_iterator_start(" | ||
+ | while(bl_iterator_next(" | ||
+ | xlog(" | ||
+ | } | ||
+ | bl_iterator_end(" | ||
+ | </ | ||
+ | |||
===== Send Data Attributes ===== | ===== Send Data Attributes ===== | ||
Line 1255: | Line 1343: | ||
* src_addr - source socket address (proto: | * src_addr - source socket address (proto: | ||
* dst_addr - destination socket address (proto: | * dst_addr - destination socket address (proto: | ||
+ | * src_host - source host, for IPv6 host contains `[]` | ||
+ | * dst_host - destination host, for IPv6 host contains `[]` | ||
+ | * src_hostip - source host, for IPv6 host do not contains `[]` | ||
+ | * dst_hostip - destination host, for IPv6 host do not contains `[]` | ||
+ | * src_port - source port | ||
+ | * dst_port - destination port | ||
+ | * src_proto - source proto | ||
+ | * dst_proto - destination proto | ||
Example: | Example: | ||
<code c> | <code c> | ||
- | |||
- | event_route[sipdump: | ||
- | if($sipdump(len) > 1024) { | ||
- | ... | ||
- | } | ||
- | } | ||
event_route[siptrace: | event_route[siptrace: | ||
{ | { | ||
- | $var(troubleshoot_ip) = $(siptrace(dst_uri){re.subst,/ | + | if (allow_address(" |
- | if (compare_ips($var(troubleshoot_ip), " | + | return; |
- | return; | + | |
- | } | + | } |
+ | | ||
+ | return; | ||
+ | } | ||
} | } | ||
</ | </ | ||
Line 1819: | Line 1912: | ||
* hdrs - SIP Headers | * hdrs - SIP Headers | ||
* body - Body | * body - Body | ||
+ | * flags - flags for processing | ||
+ | * 1 - the password is provided in HA1 format | ||
* auser - authentication username | * auser - authentication username | ||
* apasswd - authentication password | * apasswd - authentication password | ||
Line 1985: | Line 2080: | ||
===== TLS Module ===== | ===== TLS Module ===== | ||
+ | |||
+ | ==== $tls(key) ==== | ||
+ | |||
+ | Variables related to TLS communication and certificates. | ||
+ | |||
+ | The **key** can be: | ||
+ | |||
+ | * **m_issuer_line** - return local (my) certificate issuer line | ||
+ | * **p_issuer_line** - return remote (peer) certificate issuer line | ||
+ | * **m_subject_line** - return local (my) certificate subject line | ||
+ | * **p_subject_line** - return remote (peer) certificate subject line | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | if(proto==TLS) { | ||
+ | xinfo(" | ||
+ | } | ||
+ | </ | ||
==== $tls_version ==== | ==== $tls_version ==== | ||
+ | |||
The TLS/SSL version which is used on the TLS connection from which the message was received. String type. | The TLS/SSL version which is used on the TLS connection from which the message was received. String type. | ||
==== $tls_description ==== | ==== $tls_description ==== | ||
Line 2122: | Line 2237: | ||
* $msg(body) - sip message body | * $msg(body) - sip message body | ||
* $msg(body_len) - sip message body length | * $msg(body_len) - sip message body length | ||
- | * $msg(hdrs) - sip message headers | + | * $msg(hdrs) - sip message headers |
- | * $msg(fline) - sip message first line | + | * $msg(fline) - sip message first line (surrounding white space and EoL chars trimmed) |
+ | * $msg(fpart) - sip message first line and the headers | ||
+ | * $msg(lpart) - sip message headers and the body | ||
+ | ===== POSOPS Module ===== | ||
+ | |||
+ | ==== $pos(key) ==== | ||
+ | |||
+ | Get attributes after a function of the module is executed. | ||
+ | |||
+ | The key can be: | ||
+ | |||
+ | * ret - the return code on success or -1 | ||
+ | * idx - position inside message buffer, for find/search it is the start of matching | ||
+ | * len - the length of matching string for search functions | ||
===== XHTTP Module ===== | ===== XHTTP Module ===== | ||
Line 2323: | Line 2451: | ||
* 2 charge | * 2 charge | ||
* 3 spare | * 3 spare | ||
+ | |||
+ | |||
+ | ==== $sipt(redirection_info) / $sipt_redirection_info === | ||
+ | Returns the value of the Redirecting reason of the Call Diversion Information header from ISUP. | ||
+ | Returns -1 if there is a parsing error or if the Call Diversion Information is not present. | ||
+ | |||
+ | Can return the following values: | ||
+ | |||
+ | * 0 Unknown | ||
+ | * 1 User busy | ||
+ | * 2 no reply | ||
+ | * 3 unconditional | ||
+ | * 4 deflection during alerting | ||
+ | * 5 deflection immediate response | ||
+ | * 6 mobile subscriber not reachable | ||
+ | |||
+ | |||
+ | ==== $sipt(redirection_number) / $sipt_redirection_number === | ||
+ | Returns the value (Address signal) of the Redirection Number. | ||
+ | Returns -1 if there is a parsing error or if the Redirection Number is not present. | ||
+ | |||
+ | Example: | ||
+ | <code c> | ||
+ | # get the redirection number | ||
+ | $avp(s: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== $sipt(redirection_number.nai) / $sipt_redirection_number_nai === | ||
+ | Returns the value of the Nature of Address Indicator of the Redirection Number. Returns -1 if there is a parsing error or if the Redirection Number is not present. | ||
+ | |||
+ | Can return the following values: | ||
+ | |||
+ | * 0 Spare | ||
+ | * 1 Subscriber Number (national use) | ||
+ | * 2 Unknown (national use) | ||
+ | * 3 National (significant) number | ||
+ | * 4 International use | ||
+ | |||
+ | |||
+ | ==== $sipt(calling_party_number) === | ||
+ | Returns the value (Address signal) of the Calling Party for the IAM message. | ||
+ | Returns -1 if there is a parsing error or if the Calling Party Number is not present. | ||
+ | |||
+ | |||
+ | ==== $sipt(called_party_number) === | ||
+ | Returns the value (Address signal) of the Called Party for the IAM message. | ||
+ | Returns -1 if there is a parsing error or if the Called Party Number is not present. | ||
+ | |||
+ | |||
+ | ==== $sipt(sipt_redirection_information_reason) === | ||
+ | Returns the value of the Redirection reason of the Redirection information header from ISUP. | ||
+ | Returns -1 if there is a parsing error or if the Redirection information is not present. | ||
+ | |||
+ | |||
+ | ==== $sipt(sipt_redirection_information_original_reason) === | ||
+ | Returns the value of the Original Redirection reason of the Redirection information header from ISUP. | ||
+ | Returns -1 if there is a parsing error or if the Redirection information is not present. | ||
+ | |||
+ | |||
+ | ==== $sipt(redirecting_number.nai) === | ||
+ | Returns the value of the Nature of Address Indicator of the Redirecting Number. Returns -1 if there is a parsing error or if the Redirecting Number is not present. | ||
+ | |||
+ | Can return the following values: | ||
+ | |||
+ | * 0 Spare | ||
+ | * 1 Subscriber Number (national use) | ||
+ | * 2 Unknown (national use) | ||
+ | * 3 National (significant) number | ||
+ | * 4 International use | ||
+ | |||
+ | |||
+ | ==== $sipt(redirecting_number) === | ||
+ | Returns the value (Address signal) of the Redirecting Number for the IAM message. | ||
+ | Returns -1 if there is a parsing error or if the Redirecting Number is not present. | ||
+ | |||
+ | |||
+ | ==== $sipt(original_called_number.nai) === | ||
+ | Returns the value of the Nature of Address Indicator of the Original Called Number. Returns -1 if there is a parsing error or if the Original Called Number is not present. | ||
+ | |||
+ | Can return the following values: | ||
+ | |||
+ | * 0 Spare | ||
+ | * 1 Subscriber Number (national use) | ||
+ | * 2 Unknown (national use) | ||
+ | * 3 National (significant) number | ||
+ | * 4 International use | ||
+ | |||
+ | |||
+ | ==== $sipt(original_called_number) === | ||
+ | Returns the value (Address signal) of the Original Called Number for the IAM message. | ||
+ | Returns -1 if there is a parsing error or if the Original Called Number is not present. | ||
+ | |||
+ | |||
+ | ==== $sipt(generic_number.nai) === | ||
+ | Returns the value of the Nature of Address Indicator of the Generic Number. Returns -1 if there is a parsing error or if the Generic Number is not present. | ||
+ | |||
+ | Can return the following values: | ||
+ | |||
+ | * 0 Spare | ||
+ | * 1 Subscriber Number (national use) | ||
+ | * 2 Unknown (national use) | ||
+ | * 3 National (significant) number | ||
+ | * 4 International use | ||
+ | |||
+ | |||
+ | ==== $sipt(generic_number) === | ||
+ | Returns the value (Address signal) of the Generic Number for the IAM message. | ||
+ | Returns -1 if there is a parsing error or if the Generic Number is not present. | ||
Line 2444: | Line 2681: | ||
* 0x999 - HEP attribute 0x999 | * 0x999 - HEP attribute 0x999 | ||
- | ===== $phn(rid=> | + | ===== Phonenum Variables ===== |
$phn(rid=> | $phn(rid=> | ||
Line 2466: | Line 2703: | ||
</ | </ | ||
+ | ===== SecSIPId Variables ===== | ||
+ | $secsipid(key) - return attributes of secsipid module. | ||
+ | |||
+ | The key can be: | ||
+ | |||
+ | * val - the value of Identity computed by secsipid_build_identity(...) | ||
+ | * ret - the return code of the libsecsipid function used by secsipid_build_identity(...) | ||
+ | |||
+ | Example: | ||
+ | |||
+ | <code c> | ||
+ | if(secsipid_build_identity(" | ||
+ | " | ||
+ | xinfo(" | ||
+ | } | ||
+ | </ | ||
===== sdpops module variables ===== | ===== sdpops module variables ===== | ||
Line 2484: | Line 2737: | ||
* $ltt(x) - $ltt(t) if the transaction was created already, otherwise $ltt(s) | * $ltt(x) - $ltt(t) if the transaction was created already, otherwise $ltt(s) | ||
+ | ===== $via0(attr) - Via[0] Attributes ===== | ||
+ | |||
+ | $via0(attr) - attributes of first Via header. | ||
+ | |||
+ | The attr can be: | ||
+ | |||
+ | * host - host part (string) | ||
+ | * port - port (number) | ||
+ | * proto - protocol - transport part (string) | ||
+ | * protoid - protocol id (integer id) | ||
+ | * branch - branch parameter | ||
+ | * rport - rport parameter value (string) | ||
+ | * received - received parameter value (string) | ||
+ | * i - i parameter value (string) | ||
+ | |||
+ | ===== $via1(attr) - Second Via Attributes ===== | ||
+ | |||
+ | $via1(attr) - attributes of second Via header. The attr can be the same as for $via0(attr). | ||
+ | |||
+ | ===== $viaZ(attr) - Last Via Attributes ===== | ||
+ | |||
+ | $viaZ(attr) - attributes of last Via header. The attr can be the same as for $via0(attr). | ||
===== tcpops module variable ===== | ===== tcpops module variable ===== | ||