User Tools

Site Tools


cookbooks:3.2.x: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
cookbooks:3.2.x:pseudovariables [2011/12/16 23:31]
miconda
cookbooks:3.2.x:pseudovariables [2012/05/03 13:35]
klaus3000 [AVPs]
Line 259: Line 259:
  
 **$ml** - reference to SIP message length **$ml** - reference to SIP message length
 +
 +==== SIP Message Type ====
 +
 +**$mt** - returns 1 if the sip message is a request, returns 2 if the sip message is a reply
 +
  
 ==== Domain in SIP Request's original URI ==== ==== Domain in SIP Request's original URI ====
Line 331: Line 336:
  
 **$rm** - reference to request's method. Works also for replies (by using the CSeq header) **$rm** - reference to request's method. Works also for replies (by using the CSeq header)
 +
 +==== Request Method ID ====
 +
 +**$rmid** - returns internal integer representation of SIP method type
 +
  
 ==== SIP request's port ==== ==== SIP request's port ====
Line 365: Line 375:
  
 <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc> <fc #0000ff>It is R/W variable (you can assign values to it directly in configuration file)</fc>
 +
 +==== URI Scheme of Request URI ====
 +
 +**$rz** - returns R-URI scheme, possible values: sip, sips, tel and tels, R-URI scheme parsing error should be reflected by value: none
  
 ==== Received IP address ==== ==== Received IP address ====
Line 468: Line 482:
 $(avp(id)[0]) can be written in shorter form as $avp(id) and $avp(s:name) as $avp(name). $(avp(id)[0]) can be written in shorter form as $avp(id) and $avp(s:name) as $avp(name).
  
-AVPs are special variables that are attached to SIP transactions. It is a list of pairs (name,value). Before the transaction is created, the AVP list is attached to SIP request. Note that the AVP list works like a stack, last added value is retrieved first, and there can be many values for same AVP name, an assignment to the same AVP name does not overwrite old value, it will add the new value in the list.+AVPs are special variables that are attached to SIP transactions. It is a list of pairs (name,value). Before the transaction is created, the AVP list is attached to SIP request. Note that the AVP list works like a stack, last added value is retrieved first, and there can be many values for same AVP name. An assignment to the same AVP name does not overwrite the existing AVPbut it will add an additional AVP to the list. When writing an AVP, the [N] index is ignored, except for [*].
  
 To delete the first AVP with name 'id' you have to assign to it '$null': To delete the first AVP with name 'id' you have to assign to it '$null':
Line 482: Line 496:
 To overwrite the value of the AVP with name 'id' you have to assign the new value to the index '*': To overwrite the value of the AVP with name 'id' you have to assign the new value to the index '*':
 <code c> <code c>
-$(avp(id)[*]) = newvalue;+$(avp(id)[*]) = newvalue; # delete all existing AVPs with name 'id' and create a single AVP with newvalue
 </code> </code>
  
Line 492: Line 506:
 $avp(x) = 1;  # assign of integer value $avp(x) = 1;  # assign of integer value
 $avp(x) = 2; $avp(x) = 2;
 +$avp(x) = 3;
 +# now: $avp(x) = $(avp(x)[0]) = 3, $(avp(x)[1]) = 2, $(avp(x)[2]) = 1
 $avp(y) = "abc"; # assign of string value $avp(y) = "abc"; # assign of string value
-if($(avp(x)[1])==1) {+if($(avp(x)[2])==1) { # TRUE
   ...   ...
 } }
-$(avp(x)[1]) = $null;+$(avp(x)[1]) = $null; # index will be ignored and top element removed from list 
 +# now: $avp(x) = $(avp(x)[0]) = 2, $(avp(x)[1]) = 1 
 +$(avp(x)[*]) = $null; # all AVPs 'x' are deleted
 </code> </code>
  
Line 591: Line 609:
 </code> </code>
  
 +===== Strftime Formatted Time =====
 +
 +**$timef(format)** - return current time as formatted by strftime 'format'. See 'man strftime' to see the available time attribute specifiers.
 +
 +Example:
 +
 +<code c>
 +xlog("Today is $timef(%m/%d/%y)\n");
 +</code>
 ===== Selects ===== ===== Selects =====
  
Line 919: Line 946:
   * reply_code - alias to $T_reply_code   * reply_code - alias to $T_reply_code
   * branch_index - alias to $T_branch_idx   * branch_index - alias to $T_branch_idx
 +  * reply_type - 1 if it is a local generated reply, 0 - if no reply for transaction or it is a received reply
  
 Note: the pair (id_index,id_label) uniquely identifies a transaction. Note: the pair (id_index,id_label) uniquely identifies a transaction.
cookbooks/3.2.x/pseudovariables.txt · Last modified: 2012/05/03 13:35 by klaus3000