[SR-Users] Kamailio : Serial forking

Paclinio thomas.leutscher at gmail.com
Tue Mar 22 16:08:11 CET 2022


Following the example of TM Module.
https://www.kamailio.org/docs/modules/devel/modules/tm.html#tm.serial_forking

Code :

modparam("tm", "contacts_avp", "tm_contacts");
>
> route {
>   seturi("sip:a at example.com");
>   append_branch("sip:b at example.com", "0.5");
>   append_branch("sip:c at example.com", "0.5");
>   append_branch("sip:d at 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 at 192.168.1.41","1");
> append_branch("sip:9919992 at 192.168.1.41", "0.21");
> append_branch("sip:9919997 at 192.168.1.41", "0.22");
> append_branch("sip:9919991 at 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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220322/6a56f4d6/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 239787 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220322/6a56f4d6/attachment-0001.png>


More information about the sr-users mailing list