[OpenSIPS-Users] Creating branches inside a while loop
Bogdan-Andrei Iancu
bogdan at opensips.org
Tue Oct 11 09:32:53 UTC 2022
Hi, and it works now, right?
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
https://www.opensips-solutions.com
OpenSIPS Summit 27-30 Sept 2022, Athens
https://www.opensips.org/events/Summit-2022Athens/
On 10/11/22 10:29 AM, mayamatakeshi wrote:
> Hi Bogdan,
> indeed, I think I removed the append_branch() line by mistake when
> removing some debug lines I added to check function return code etc.
> Thanks,
> Takeshi
>
> On Mon, Oct 10, 2022 at 9:39 PM Bogdan-Andrei Iancu
> <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>
> Hi Takeshi,
>
> Aren't you missing the "seturi()" + "append_branch()" in the loop ??
>
> Regards,
>
> Bogdan-Andrei Iancu
>
> OpenSIPS Founder and Developer
> https://www.opensips-solutions.com <https://www.opensips-solutions.com>
> OpenSIPS Summit 27-30 Sept 2022, Athens
> https://www.opensips.org/events/Summit-2022Athens/ <https://www.opensips.org/events/Summit-2022Athens/>
>
> On 9/28/22 4:26 PM, mayamatakeshi wrote:
>>
>> On Wed, Sep 28, 2022 at 2:21 PM mayamatakeshi
>> <mayamatakeshi at gmail.com <mailto:mayamatakeshi at gmail.com>> wrote:
>>
>> Hi,
>> I'm testing latest
>> commit b243666098be44226ade6a7df2b62851efcb5de8 of opensips-3.2.
>>
>> I tested adding branches to an INVITE for a fixed size list
>> of AORs this way:
>>
>> $var(aors) = "sip:user1 at test1.com
>> <mailto:sip%3Auser1 at test1.com>,sip:user2 at test1.com
>> <mailto:sip%3Auser2 at test1.com>,sip:user3 at test1.com
>> <mailto:sip%3Auser3 at test1.com>";
>>
>> seturi($(var(aors){s.select,0,,}));
>>
>> append_branch();
>> seturi($(var(aors){s.select,1,,}));
>>
>> append_branch();
>> seturi($(var(aors){s.select,2,,}));
>>
>> lookup("location", "r")
>>
>> The above works fine and all 3 destinations resolved by AOR
>> lookup are called (max of contact per AOR).
>>
>> However, in case of a a list of unknown size, I tried to use
>> a while loop like this:
>> $var(aors) = "sip:user1 at test1.com
>> <mailto:sip%3Auser1 at test1.com>,sip:user2 at test1.com
>> <mailto:sip%3Auser2 at test1.com>,sip:user3 at test1.com
>> <mailto:sip%3Auser3 at test1.com>";
>>
>> $var(idx) = 0;
>> $var(aor) = $(var(aors){s.select,$var(idx),,});
>>
>> while($var(aor) != null) {
>> seturi($var(aor));
>>
>> $var(idx) = $var(idx) + 1;
>> $var(aor) = $(var(aors){s.select,$var(idx),,});
>> }
>>
>> lookup("location", "r")
>>
>> But with the above, only the last destination (lookup of
>> user3 at test1.com <mailto:user3 at test1.com>) is called.
>> I confirmed this is not related to the lookup function
>> because I tried with fixed destinations like this:
>>
>> $var(aors) = "sip:user1 at 10.0.0.1:5072
>> <http://sip:user1@10.0.0.1:5072/>,sip:user2 at 10.0.0.1:5074
>> <http://sip:user2@10.0.0.1:5074/>,sip:user3 at 10.0.0.1:5076
>> <http://sip:user3@10.0.0.1:5076/>";
>>
>> $var(idx) = 0;
>> $var(aor) = $(var(aors){s.select,$var(idx),,});
>>
>> while($var(aor) != null) {
>> seturi($var(aor));
>>
>> $var(idx) = $var(idx) + 1;
>> $var(aor) = $(var(aors){s.select,$var(idx),,});
>> }
>>
>> and the same problem happens: only the last destination
>> sip:user3 at 10.0.0.1:5076 <http://sip:user3@10.0.0.1:5076/> is
>> called.
>>
>> So, is there a way to append a non-fixed number of branches
>> to an INVITE?
>>
>> Regards,
>> Takeshi
>>
>>
>> Sorry, I think I did something wrong.
>> I was able to make append_branch to work inside a while loop.
>> So there is no problem.
>> Regards,
>> Takeshi
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20221011/94a86385/attachment.html>
More information about the Users
mailing list