Re: How to get count of contacts/branches after t_next_contacts()

Fred Posner via sr-users <[email protected]>
Newsgroups gmane.comp.voip.ser
Message-ID <[email protected]>
> On Oct 31, 2025, at 9:02 AM, Benoît Panizzon via sr-users <[email protected]> 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

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.