How to get count of contacts/branches after t_next_contacts()
Hi Gang I use: lookup_to_dset(), t_load_contacts(), t_next_contacts() to gather contacts for parallel forking (like for a hunt group). After that I use $cnt($xavp(tm_contacts)) to find the number of branches which would be created. But $cnt($xavp(tm_contacts)) seems to always be 1 no matter how many branches I get in route(RELAY). What am I doing wrong? Is there another PV I could use? Background: When a 100rel is supported by the originating device, the destination devices might all reply 180 RINGING with 100required, same rseq but different ToTags. The originating device would require to reply PRACK to each of those ringing and it looks like MANY originating devices (especially commercial SBC) do NOT consider the ToTag but ignore any subsequent 180 RINGING with same CallID and rseq causing such forked calls fail. So if I have > 1 branches, I would like to exclude_hf_value("Allow", "PRACK"); exclude_hf_value("Supported", "100rel"); -- Mit freundlichen Grüssen -Benoît Panizzon- @ HomeOffice und normal erreichbar -- I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________ Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________
Hi Publishing what think I have found while trying out different ways: After calling: t_load_contacts() $cnt($xavp(tm_contacts)) contains the total number loaded contacts + 1 After calling: t_next_contacts() $cnt($xavp(tm_contacts)) contains 1 (maybe if there contacts?) $branch(count) contains the number of _additional_ branches with matching Q Value and $null if only the main branch exists. So I can check for $branch(count) != $null to remove PRACK. -- Mit freundlichen Grüssen -Benoît Panizzon- @ HomeOffice und normal erreichbar -- I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________ Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________
On Oct 31, 2025, at 9:02 AM, Benoît Panizzon via sr-users <sr-users@lists.kamailio.org> wrote:
Hi
Publishing what think I have found while trying out different ways:
After calling: t_load_contacts()
$cnt($xavp(tm_contacts)) contains the total number loaded contacts + 1
After calling: t_next_contacts()
$cnt($xavp(tm_contacts)) contains 1 (maybe if there contacts?)
$branch(count) contains the number of _additional_ branches with matching Q Value and $null if only the main branch exists.
So I can check for $branch(count) != $null to remove PRACK.
I generally do something like… ``` if (reg_fetch_contacts("location", "$ru", "$ci")){ xinfo("callee=>aor: $(ulc($ci=>aor)) callee=>count $(ulc($ci=>count))\n"); if ($(ulc($ci=>count)) > 1) { ... ``` Fred Posner Tel: +1 (352) 664-3733 Alt: +1 (224) 334-3733 Contact info at https://fredp.xyz
participants (2)
-
Benoît Panizzon -
Fred Posner