[Kamailio-Devel] serialize_branches() nowhere documented?

Juha Heinanen jh at tutpro.com
Mon Oct 20 11:08:46 CEST 2008


Jan Janak writes:

 >   Hmm, I don't really know how to do this in k., in ser/tm there is a
 >   global variable called rmode which can be used to determine what kind of
 >   route block you are in. I quickly checked your sources but could not
 >   find it, so maybe it was removed or replaced with something else (this
 >   is a pretty old thing).

jan,

it is possible in k too to determine, which route block you are.  there
is a variable route_type for that, for example:

    if (route_type == REQUEST_ROUTE) { ...

however, that is not good enough for this problem.  the problem is that
when one calls t_relay and it fails, for example, due to failed tcp
connection setup, t_relay returns negative result and either terminates
the transaction with an error reply or returns control back to the route
block, where it was called.  this is controlled by t_relay flag 0x02:

  0x02 - do not internally send a negative reply in case of forward
  failure (due internal error, bad RURI, bad message, etc). When a forward
  failure occurs, no SIP request is relayed and therefore no negative
  reply or timeout will show up on the failure_route (if one is set). It
  applies only when the transaction is created. By default one negative
  reply is sent. Useful if you want to implement a serial forking in case
  of failure.

if the flag is not set and t_relay terminates the transaction, failure
route will NOT be called even if it is set.  so the script needs to use
the flag and then try another contact in route block.  as result, this
logic does not work: "since we are in route block, re-write r-uri
instead of adding a branch".

so far i have not found a way to figure out outside of tm module, if
first-time forwarding has already taken place.  if someone knows how to
do it, please let me know.

-- juha



More information about the Devel mailing list