[OpenSIPS-Devel] [ opensips-Bugs-3610776 ] while loop through $branch doesn't show first branch

SourceForge.net noreply at sourceforge.net
Mon Apr 15 18:53:21 CEST 2013


Bugs item #3610776, was opened at 2013-04-13 15:03
Message generated for change (Comment added) made by bogdan_iancu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3610776&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: 1.8.x
Status: Open
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: a719719 (a719719)
>Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: while loop through $branch doesn't show first branch

Initial Comment:
I try to xlog the URI's of all branches:

if (!lookup("location")) {
   switch ($retcode) {
      case -1:
      case -3:
         sl_send_reply("404", "Not Found");
         exit;
      case -2:
         sl_send_reply("405", "Not Found");
         exit;
   };
};

$var(i) = 0;
while($(branch(uri)[$var(i)])!=NULL) {
   xlog("----- branch $var(i): $(branch(uri)[$var(i)])");
   $var(i) = $var(i) + 1;
};

3 phones are registered. All receive an Invite. No problem there.
But this code prints:

OpenSips[6832]: DBG:registrar:lookup: found a complete match
OpenSips[6832]: DBG:registrar:lookup: setting as ruri <sip:testaccount at 4.4.4.4:30626;rinstance=30ffadee5f56a3d2;transport=UDP>
OpenSips[6832]: DBG:registrar:lookup: looking for branches
OpenSips[6832]: DBG:registrar:lookup: setting branch <sip:testaccount at 4.4.4.4:18349>
OpenSips[6832]: DBG:registrar:lookup: setting branch <sip:testaccount at 8.8.8.8:61002;rinstance=106001d34f5d2212;transport=UDP>
OpenSips[6832]: ----- branch 0: sip:testaccount at 4.4.4.4:18349
OpenSips[6832]: ----- branch 1: sip:testaccount at 8.8.8.8:61002;rinstance=106001d34f5d2212;transport=UDP

I would expect the output to be:

OpenSips[6832]: ----- branch 0: sip:testaccount at 4.4.4.4:30626;rinstance=30ffadee5f56a3d2;transport=UDP
OpenSips[6832]: ----- branch 1: sip:testaccount at 4.4.4.4:18349
OpenSips[6832]: ----- branch 2: sip:testaccount at 8.8.8.8:61002;rinstance=106001d34f5d2212;transport=UDP

I'm not completely sure but isn't every contact a branch, so the first one (sip:testaccount at 4.4.4.4:30626;rin..) also?
I use 1.8.2 svn9916.

----------------------------------------------------------------------

>Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2013-04-15 09:53

Message:
Hi,

There is a misunderstanding here - the "branch" is an additional
destination, aside the mandatory one hold by RURI. So RURI is keeping first
destination, branch 0 the second destination, branch 1 the third
destination, a.s. o

So you should also print the RURI before the branches.

Regards,
Bogdan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=3610776&group_id=232389



More information about the Devel mailing list