Tuesday, December 9, 2008

Request/Reply Attributes Access From TM

Latest developments provide access to the attributes of reply while processing the request and vice-versa.

The TM module introduces two new features:

  • access to SIP request attributes while processing a reply belonging to same transaction
  • access to SIP reply attributes while processing a request belonging to same transaction

Functionalities come as pseudo-variables, $T_req(pv) and $T_rpl(pv) - where pv can be any pseudo-variable, check documents at:

http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:devel#tm_module_pseudo-variables

The new pseudo-variables can be used:

  • in failure_route to get the attributes of the reply causing the failure route. You can take decisions what to do with the request based on reply details
  • in onreply_route to get the attributes of the request. you can take decision what to do with the reply based on request attributes.
  • in acc to store data from reply
  • in C code (modules)

Note that couple of PV are disabled for these cases (PV will return null) - these are the PV that alter/depend on the context of the processed message, like $Ts, $Tf (but you can use $TS and $TF), $time, destination set attributes. The $avp(...) will be current avps, as they are stored in a global list. Also, in case there is a timeout or other reply generated by kamailio itself, $T_rpl(pv) will return null as there is no real reply structure behind.

Example, print the source ip of the reply in failure route:

failure_route[1] {
    xlog("reply received from: $T_rpl($si)\n");
}

No comments:

Post a Comment