Are you intending to use `t_next_contact_flow()` rather than `t_next_contact()`?   There's not enough data here to know what your contacts look like.  The definition of `t_next_contact_flow()` is:

> Function adds a new branch to the request that includes the first contact from contact_flows_avp that matches the +sip.instance value of the flow that has failed.

If your contacts have separate +sip.instance values, then it would be expected that this would fail.  Unless you know this to be the case use `t_next_contact()` in a failure route (as opposed to a branch failure route).  

Regards,
Kaufman


From: Benoît Panizzon via sr-users <sr-users@lists.kamailio.org>
Sent: Friday, January 17, 2025 9:15 AM
To: sr-users@lists.kamailio.org <sr-users@lists.kamailio.org>
Cc: Benoît Panizzon <benoit.panizzon@imp.ch>
Subject: [SR-Users] Need help with serial branching using: t_load_contacts(1)
 
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.


Hi Gang

I guess, I don't completely understand who to properly perform serial
branching.

I did try to follow the examples from:

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kamailio.org%2Fdocs%2Fmodules%2Fdevel%2Fmodules%2Ftm.html%23tm.f.t_next_contacts&data=05%7C02%7Cbkaufman%40bcmone.com%7C9e2ae0b2f7ed428f103f08dd370b15f0%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C638727242952699867%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=9t0EzDJSIqM9E%2BK0GjGfBnF5gpCQCKOS7qssZVyRNmc%3D&reserved=0

This is, stripped down, the relevant config used.

modparam("tm", "contacts_avp", "tm_contacts")
modparam("tm", "contact_flows_avp", "tm_contact_flows")

route[LOCATION]
{
lookup_to_dset("location", "$var(lookupuri)");

if (!t_load_contacts(1)) {
      xlog("L_ERR", "$cfg(route): ######### load_contacts failed\n");
      sl_send_reply("500", "Server Internal Error - Cannot load contacts");
      exit;
}

xlog("L_INFO", "$cfg(route): Contacts loaded: $cnt($xavp(tm_contacts))\n");

=> Confirms, there is more than one contact loaded.

if (!t_next_contacts()) {
        send_reply("480", "Not registered");
}

t_set_fr(5000,1500); # Set 5 second timeout for LAB testing to quickly try the next contact.

t_on_branch("BR_TO_CUST");
t_on_branch_failure("BR_TO_CUST_FAILURE");
exit;
}

event_route[tm:branch-failure:BR_TO_CUST_FAILURE] {
        xlog("BRANCH FAILED $T_reply_code to $rm message\n");
        t_on_branch("BR_TO_CUST");
        t_on_branch_failure("BR_TO_CUST_FAILURE");
        if (t_next_contact_flow())
        {
                xlog("BRANCH FAILED, Try Next\n");
                t_relay();
        } else {
                xlog("L_INFO", "No more flows\n");
                t_reply("408", "Branch Timeout");
                exit;
        }
}

What happens is:

INVITE is sent to the first contact, who is replying RINGING.
After 5 seconds the timeout is reached and the branch-failure route engaged.

Jan 17 15:01:15 dev-cpereg01 kamailio[3599432]: ERROR: <script>: BRANCH FAILED 408 to INVITE message
Jan 17 15:01:15 dev-cpereg01 kamailio[3599432]: INFO: <script>: No more flows
Jan 17 15:01:15 dev-cpereg01 kamailio[3599432]: CRITICAL: tm [tm.c:1554]: ki_t_reply(): w_t_reply entered in unsupported mode

To my understanding, t_next_contact_flow() should have loaded the next ds, but this does not seem to happen.

What am I missing?

--
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  https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.imp.ch%2F&data=05%7C02%7Cbkaufman%40bcmone.com%7C9e2ae0b2f7ed428f103f08dd370b15f0%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C638727242952716365%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ADXgfGp%2Fj2baIJwbj%2BmB7tJGmOdXxCs6sgcobRF%2B48k%3D&reserved=0
______________________________________________________
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- sr-users@lists.kamailio.org
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
r