[Devel] append_branch

Klaus Darilion klaus.mailinglists at pernau.at
Tue Feb 6 17:47:44 CET 2007


Bogdan-Andrei Iancu wrote:
> Hi Klaus,
> 
> actually append_branch() does not store any path variable. Only 
> registrar module sets it when doing lookup().

Yes. But what happens if after lookup I call append_branch and add 
another URI:
route  { lookup(); # sets RURI/DURI/PATH
          append_branch();
          rewriteuri("sip:foo at bar"); # this branch reuses
                                     # DURI and PATH from above
          t_relay();
}

this one also will use the previous path - not?

int append_branch(struct sip_msg* msg,....
{
...

         /* copy the path string */
         if (path && path->len && path->s) {
...

}

> BTW, this lead to a related issue I found - stateless forward does not 
> obey the path info.
> 
> What you are saying about resetting the path after append_branch() is 
> more related here to a logical issue: when creating a new branch (via 
> append), all the info pushed into the new branch should be reset? 

Not sure how it should be done - probably I still do not know what 
append branch exactly does. I try to write down my understanding of 
branches and please correct me:

When a request enters openser.cfg the message has one branch (branches[0]).

Any manipulation or lookup of RURI and DURI will be done on branches[0].

If I call append_branch, the current RURI/DURI/PATH (identically to 
branches[0]) will be copied into the next empty branch - in this case 
branches[1].

Then further URI/DURI manipulation will not touch branches[1] anymore.

Is the above correct?

Thus IMO it would make sense to reset all parameters of branches[0] to 
avoid confusion between the existing (copied into branches[x]) and the 
fresh new branch.

regards
klaus

 > like
> append_branch() will reset duri, bflags, path, forced socket ,leaving a 
> new virgin branch 0 (ruri) to work with??
> 
> regards,
> bogdan
> 
> Klaus Darilion wrote:
>> Hi!
>>
>> AFAIK append_branch copies the current RURI, DURI and PATH into a new 
>> branch. Then, if I push a new RURI I also have to delete the previous 
>> DURI using resetdsturi(). Thus I guess we would also need a function 
>> to reset the PATH too - don't we?
>>
>> regards
>> klaus


-- 
Klaus Darilion
nic.at




More information about the Devel mailing list