Following the example of TM Module.
https://www.kamailio.org/docs/modules/devel/modules/tm.html#tm.serial_forki…
Code :
modparam("tm", "contacts_avp", "tm_contacts");
route {
seturi("sip:a@example.com");
append_branch("sip:b@example.com", "0.5");
append_branch("sip:c@example.com", "0.5");
append_branch("sip:d@example.com", "1.0");
t_load_contacts();
t_next_contacts();
t_on_failure("serial");
t_relay();
break;
}
failure_route["serial"]
{
if (!t_next_contacts()) {
exit;
}
t_on_failure("serial");
t_relay();
}
My code :
failure_route[GroupFailureRoute]{
t_next_contacts();
while(!route(GROUP_LOCATION))
{
if (!t_next_contacts()) {
send_reply("408","Nobody available");
exit;
}
}
t_on_failure("GroupFailureRoute");
t_relay();
}
route[GROUP_RELAY_SER]{
append_branch("sip:9919995@192.168.1.41","1");
append_branch("sip:9919992@192.168.1.41", "0.21");
append_branch("sip:9919997@192.168.1.41", "0.22");
append_branch("sip:9919991@192.168.1.41", "0.22");
t_load_contacts();
t_next_contacts();
while(!route(GROUP_LOCATION))
{
if (!t_next_contacts()) {
send_reply("408","Timeout or nobody available");
exit;
}
}
t_on_failure("GroupFailureRoute");
t_relay();
break;
}
The result :
[image: image.png]
public2_addr
192.168.1.41
192.168.1.24
192.168.1.10
──────────┬───────── ──────────┬─────────
──────────┬───────── ──────────┬─────────
│ INV (192.168.1.41)
│
|
│ audio 39776 (g711u) │
|
│
─────────────────────────────── ──────────────> │
│ INV
(192.168.1.41) │
│
│─┐ audio 39776 (g711u) │
│
│<┘
│
│
│─┐ 407 Proxy Authentication R│ │
│<┘ │
│
│
CANCEL │
│
│ ─────────────────────> │
│
│─┐ ACK
│
│
│<┘
│
│
│ 487 Request Terminated │
│
│ <────────────────────── │
│
│
ACK │
│
│ ─────────────────────> │
│
│ 200 OK │ │
│ <───────────────────── │
│
│ 100 Trying │
│ <────────────────────────────────────────────── │
│ 180 Ringing │
│ <─────────────────────────────────────────── ── │
│ 180 Ringing
│ │
│
│ <─────────────────── │
│
│
On the Second "wave" of INVITE with the parallel only the first one is
correctly changed with the lookup("location") and not the second.
Could someone give me some tips?
Best regards
Thomas
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>