User Tools

Site Tools


cookbooks:devel:pseudovariables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
cookbooks:devel:pseudovariables [2021/06/09 12:41]
miconda [$siptrace(name)]
cookbooks:devel:pseudovariables [2021/07/30 12:39]
miconda [$blitval(iname)]
Line 961: Line 961:
 Implemented for: Implemented for:
  
 +  * Record-Route
 +  * Route
   * Via   * Via
  
Line 1159: Line 1161:
 </code> </code>
  
-==== $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 1181:
 } }
 </code> </code>
 +
 +===== $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)=="V") {
 +    $msgbuf(20) = "v";
 +}
 +</code>
 +===== Header Field Iterator =====
 +
 +==== $hfitname(iname) ====
 +
 +The header name of the header field iterator.
 +
 +Example:
 +
 +<code c>
 +    hf_iterator_start("i1");
 +    while(hf_iterator_next("i1")) {
 +        xlog("hdr[$hfitname(i1)] is: $hfitbody(i1)\n");
 +    }
 +    hf_iterator_end("i1");
 +</code>
 +
 +==== $hfitbody(iname) ====
 +
 +The header body of the header field iterator.
 +
 +Example:
 +
 +<code c>
 +    hf_iterator_start("i1");
 +    while(hf_iterator_next("i1")) {
 +        xlog("hdr[$hfitname(i1)] is: $hfitbody(i1)\n");
 +    }
 +    hf_iterator_end("i1");
 +</code>
 +
 +===== Body Line Iterator =====
 +
 +==== $blitval(iname) ====
 +
 +The value of the body line iterator.
 +
 +Example:
 +
 +<code c>
 +    bl_iterator_start("b1");
 +    while(bl_iterator_next("b1")) {
 +        xlog("body line: $blitval(b1)");
 +    }
 +    bl_iterator_end("b1");
 +</code>
 +
  
 ===== Send Data Attributes ===== ===== Send Data Attributes =====
Line 1255: Line 1321:
   * src_addr - source socket address (proto:ip:port)   * src_addr - source socket address (proto:ip:port)
   * dst_addr - destination socket address (proto:ip:port)   * dst_addr - destination socket address (proto:ip:port)
 +  * 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:msg] { 
-  if($sipdump(len) > 1024) { 
-    ... 
-  } 
-} 
 event_route[siptrace:msg] event_route[siptrace:msg]
 { {
-  $var(troubleshoot_ip) = $(siptrace(dst_addr){re.subst,/^(udp|tcp|tls):(.*):[0-9]*/\2/}); +    if (allow_address("1", "$siptrace(src_hostip)""0")) { 
-  if (compare_ips($var(troubleshoot_ip), "[2001:DB8::1]")) { +        return
-      return; + 
-  }+    } 
 +    if (compare_ips($siptrace(src_host), "[2001:DB8::1]")) { 
 +        return; 
 +    }
 } }
 </code> </code>
Line 2444: Line 2515:
   * 0x999 - HEP attribute 0x999   * 0x999 - HEP attribute 0x999
  
-===== $phn(rid=>key) - Phonenum Variables =====+===== Phonenum Variables =====
  
 $phn(rid=>key) - rid is an identifier for this query result; it is designated by the second parameter of phonenum_match(). The key can be one of the following: $phn(rid=>key) - rid is an identifier for this query result; it is designated by the second parameter of phonenum_match(). The key can be one of the following:
Line 2466: Line 2537:
 </code> </code>
  
 +===== 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("$fU", "$rU", "A", "",
 +        "https://kamailio.org/stir/$rd/cert.pem", "/secsipid/$rd/key.pem")) {
 +    xinfo("identity value: $secsipid(val)\n");
 +}
 +</code>
 ===== sdpops module variables ===== ===== sdpops module variables =====
  
Line 2484: Line 2571:
   * $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 =====
  
cookbooks/devel/pseudovariables.txt · Last modified: 2022/04/11 15:24 by henningw