Kamailio Pseudo-variables

From open-voip.org

Jump to: navigation, search
  • Pseudo-variables are used in Kamailio sript as parameters. The variables will be replaced by the corresponding values before the script execution.
  • use $ before a pseudo variable.
  • use $$ in order to use the $ sign
  • $ai - reference to URI in request's P-Asserted-Identity header (see RFC 3325)
  • $adu - URI from Authorization or Proxy-Authorization header. This URI is used when calculating the HTTP Digest Response.
  • $ar - realm from Authorization or Proxy-Authorization header
  • $au - user part of username from Authorization or Proxy-Authorization header
  • $ad - domain part of username from Authorization or Proxy-Authorization header
  • $aU - whole username from Authorization or Proxy-Authorization header
  • $Au - username for accounting purposes. It's a selective pseudo variable (inherited from acc module). It returns * $au if exits or From username otherwise.
  • $branch(name) - reference to attribute 'name' of a branch
  • $br - reference to request's first branch
  • $bR - reference to request's all branches
  • $bf - reference to branch flags of branch 0 (RURI) - decimal output
  • $bF - reference to branch flags of branch 0 (RURI) - hexa output
  • $ci - reference to body of call-id header
  • $cl - reference to body of content-length header
  • $cs - reference to the sequence number in the cseq header. The method in the CSeq header is identical to the request method, thus use * $rm to get the methode (works also for responses).
  • $ct - reference to body of contact header
  • $cT - reference to body of content-type header
  • $dd - reference to domain of destination uri
  • $di - reference to Diversion header URI
  • $dip - reference to Diversion header “privacy” parameter value
  • $dir - reference to Diversion header “reason” parameter value
  • $dp - reference to port of destination uri
  • $dP - reference to transport protocol of destination uri
  • $ds - reference to destination set
  • $du - reference to destination uri
If loose_route() returns TRUE a destination uri is set according to the first Route header.
  • $du is also set if lookup() function of 'registrar' module finds contact(s) behind NAT.
  • $du = null; - To reset * $du
  • $err.class - the class of error (now is '1' for parsing errors)
  • $err.level - severity level for the error
  • $err.info - text describing the error
  • $err.rcode - recommended reply code
  • $err.rreason - recommended reply reason phrase
  • $fd - reference to domain in URI of 'From' header
  • $fn - reference to display name of 'From' header
  • $ft - reference to tag parameter of 'From' header
  • $fu - reference to URI of 'From' header
  • $fU - reference to username in URI of 'From' header
  • $mb - reference to SIP message buffer
  • $mf - reference to message/transaction flags set for current SIP request
  • $mF -reference to message/transaction flags set for current SIP request in hexa-decimal
  • $mi - reference to SIP message id
  • $ml - reference to SIP message length
  • $od - reference to domain in request's original R-URI
  • $op - reference to port of original R-URI
  • $oP - reference to transport protocol of original R-URI
  • $ou - reference to request's original URI
  • $oU - reference to username in request's original URI
  • $pd - reference to domain in request's P-Preferred-Identity header URI (see RFC 3325)
  • $pn - reference to Display Name in request's P-Preferred-Identity header (see RFC 3325)
  • $pp - reference to process id (pid)
  • $pr or * $proto - protocol of received message (UDP, TCP, TLS, SCTP)
  • $pU - reference to user in request's P-Preferred-Identity header URI (see RFC 3325)
  • $pu - reference to URI in request's P-Preferred-Identity header (see RFC 3325)
  • $rd - reference to domain in request's URI
  • $rb - reference to message body
  • $rc - reference to returned code by last invoked function
  • $retcode - same as * $rc
  • $re - reference to Remote-Party-ID header URI
  • $rm - reference to request's method. Works also for replies (by using the CSeq header)
  • $rp - reference to port of R-URI
  • $rP - reference to transport protocol of R-URI
  • $rr - reference to reply's reason
  • $rs - reference to reply's status
  • $rt - reference to URI of refer-to header
  • $ru - reference to request's URI
  • $rU - reference to username in request's URI
  • $Ri - reference to IP address of the interface where the request has been received
  • $Rp - reference to the port where the message was received
  • $sf - reference to script flags - decimal output
  • $sF - reference to script flags - hexa output
  • $si - reference to IP source address of the message
  • $sp - reference to the source port of the message
  • $stat(name) - return the value of statistic item specified by 'name'
  • $fs - reference to the forced socket for message sending (if any) in the form proto:ip:port
  • $td - reference to domain in URI of 'To' header
  • $tn - reference to display name of 'To' header
  • $tt - reference to tag parameter of 'To' header
  • $tu - reference to URI of 'To' header
  • $tU - reference to username in URI of 'To' header
  • $Tf - reference string formatted time
  • $TF - reference string formatted time
  • $Ts - reference to unix time stamp
  • $TS - reference to unix time stamp
  • $ua - reference to user agent header field
  • $(avp(id)[N]) - represents the value of N-th AVP identified by 'id'.
The 'id' can be: 
”[si]:name” - name is the id of an AVP; 's' and 'i' specifies if the id is string or integer. If missing, it is considered to be string.
“name” - the name is an AVP alias 
Note: By default AVP created during initial message is available in “failure_route[]” but not in “onreply_route[]”. To get the last is needed: modparam("tm", "onreply_avp_mode", 1) 
  • $(hdr(name)[N]) - represents the body of the N-th header identified by 'name'. If [N] is omitted then the body of the first header is printed
  • $var(name) -Script variables. refers to variables that can be used in configuration script, having integer or string value
  • $shv(name) -Shared variables. it is a class of pseudo-variables stored in shared memory. The value of * $shv(name) is visible across all openser processes.
  • $time(name) - the PV provides access to broken-down time attributes.
The 'name' can be: 
sec - return seconds (int 0-59)
min - return minutes (int 0-59)
hour - return hours (int 0-23)
mday - return the day of month (int 0-59)
mon - return the month (int 1-12)
year - return the year (int, e.g., 2008)
wday - return the day of week (int, 1=Sunday - 7=Saturday)
yday - return the day of year (int, 1-366)
isdst - return daylight saving time status (int, 0 - DST off, >0 DST on)
  • $dlg(attr) - Return the attribute of the current processed dialog.
It is R/O variable. 
The 'attr' can be: 
h_id - hash id
h_entry - hash entry
ref - reference count
state - state of dialog
to_rs - To route set
from_rs - From route set
dflags - dialog internal flags
sflags - dialog script flags
callid - sip call id
to_uri - To uri
to_tag - To tag
from_uri - From uri
from_tag - From tag
toroute - timeout route
lifetime - timeout inteval
start_ts - start timestamp
to_cseq - To CSeq
from_cseq - From CSeq
to_contact - To contact address
from_contact - From contact address
to_bindaddr - To bind address
from_bindaddr - From bind address
  • $dlg_ctx(attr) - Return the attribute of the context for current processed dialog.
It is R/W variable. 
The 'attr' can be: 
set
flags
timeout_route
timeout_bye
Personal tools