[sr-dev] appending a new branch in route block

Juha Heinanen jh at tutpro.com
Mon May 17 15:09:27 CEST 2010


Daniel-Constantin Mierla writes:

> is a second call of next_gw() in route block always appending a branch? 
> or is updating the r-uri/dst-uri?

daniel,

second and later invocations of next_gw() always append a branch, which
now has turned out to be wrong.

> In this case when t_relay failed, transaction is created, probably the 
> first branch is set in transaction structure, but to see what is its 
> states, need to get into sources...

next_gw() is not checking is transaction exists.  it knows based on an
avp value if next_gw() call is first or not.  it is not first, it always
appends a branch.

i try to figure out an algorithm that works no matter if t_relay()
creates a transaction or not.

this mess could be avoided by implementing the same behavior as
opensips:

2.2  Append_branch() usage

There is no need to call "append_branch()" function in failure_route in
order to use the RURI - you still need to use it only if you want to do
parallel forking.

Ex:
 # in 1.4.x
 failure_route[2]
    if (t_check_status("408")) {
       # set new RURI
       rewritehostport("my_voicemail.com:5060");
       append_branch();
       t_relay();
    }
  }

  -> 
  # in 1.5.x
  failure_route[2]
    if (t_check_status("408")) {
       # set new RURI
       rewritehostport("my_voicemail.com:5060");
       t_relay();
    }
  }

after that, life would be much simpler.
 
-- juha



More information about the sr-dev mailing list