[sr-dev] [kamailio/kamailio] dispatcher on 5.2 not setting the destination properly for the second route (#1728)

David Villasmil notifications at github.com
Wed Nov 21 17:59:16 CET 2018


Hello Daniel,

Here's the requested info, unedited.

Kamailio's config:

(I added that `if($du==$null){` because when $du it's not set kamailio just sends it to itself creating a loop)
```
route[DISPATCH] {
#!ifdef WITH_DISPATCHER

    dp_match("1", "$ru");

    if(ds_select_routes("1=10;11=9", "d", "0"))
    {
        xlog("L_ERR", "[DISPATCH] $ci: ds_select_routes was succesful (ruri: $ru - du: <$du> xavp_dsdst: <$xavp(_dsdst_=>attr)>)\n");
        pv_xavp_print();
        if($du==$null){
            send_reply("404", "No destination - failed");
            exit;
        }
    } else {
        xlog("L_ERR", "[DISPATCH] $ci: did NOT find a gateway to use!\n");
        send_reply("404", "No destination");
        exit;
    }
    xlog("L_DBG", "[DISPATCH] $ci: going to <$ru> via <$du>\n");
    t_on_failure("RTF_DISPATCH");
    route(RELAY);
    exit;
}
```

rpc command output:
```
kamctl rpc dispatcher.list
{
  "jsonrpc":  "2.0",
  "result": {
    "NRSETS": 5,
    "RECORDS":  [{
        "SET":  {
          "ID": 1,
          "TARGETS":  [{
              "DEST": {
                "URI":  "sip:54.209.229.198:5080",
                "FLAGS":  "AP",
                "PRIORITY": 0,
                "ATTRS":  {
                  "BODY": "weight=100;maxload=2;duid=cuore_2",
                  "DUID": "cuore_2",
                  "MAXLOAD":  2,
                  "WEIGHT": 100,
                  "RWEIGHT":  0,
                  "SOCKET": ""
                },
                "RUNTIME":  {
                  "DLGLOAD":  0
                }
              }
            }, {
              "DEST": {
                "URI":  "sip:34.201.28.49:5080",
                "FLAGS":  "AP",
                "PRIORITY": 0,
                "ATTRS":  {
                  "BODY": "weight=100;maxload=2;duid=cuore_1",
                  "DUID": "cuore_1",
                  "MAXLOAD":  2,
                  "WEIGHT": 100,
                  "RWEIGHT":  0,
                  "SOCKET": ""
                },
                "RUNTIME":  {
                  "DLGLOAD":  0
                }
              }
            }]
        }
      }, {
        "SET":  {
          "ID": 11,
          "TARGETS":  [{
              "DEST": {
                "URI":  "sip:35.170.67.206:5080",
                "FLAGS":  "AP",
                "PRIORITY": 0,
                "ATTRS":  {
                  "BODY": "weight=100;maxload=2;duid=cuore_3",
                  "DUID": "cuore_3",
                  "MAXLOAD":  2,
                  "WEIGHT": 100,
                  "RWEIGHT":  0,
                  "SOCKET": ""
                },
                "RUNTIME":  {
                  "DLGLOAD":  0
                }
              }
            }]
        }
      }]
  },
  "id": 9046
}
```

Scenario:

I'm sending exactly 5 calls to kamailio, it should do the following according to the config:

- call 1: Send to setid 1 node A (maxload=2)
- call 2: Send to setid 1 node B (maxload=2)
- call 3: Send to setid 1 node A (maxload=2)
- call 4: Send to setid 1 node B (maxload=2)
- call 5: Send to setid 11 node A

The logs:

I'm pasting the logs for call 4 (in which the destination is set properly on $du) and call 5 where $du is not set:

Call 4:
```
ERROR: <script>: [DISPATCH] 4-7723 at 192.168.1.201: ds_select_routes was succesful (ruri: sip:*TESTCALL at cuore-proxy.sandbox-sngl.com - du: <sip:34.201.28.49:5080> xavp_dsdst: <<null>>)
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1070 a=24 n=pv_xavp_print
INFO: <core> [core/xavp.c:543]: xavp_print_list_content(): +++++ start XAVP list: 0x7f1d441b4358 ((nil)) (level=0)
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:0 - 0x7f1d441b4358) XAVP name: _dsctx_
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 1427193258
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 6
INFO: <core> [core/xavp.c:571]: xavp_print_list_content():      XAVP value: <xavp:0x7f1d441b42b0>
INFO: <core> [core/xavp.c:543]: xavp_print_list_content(): +++++ start XAVP list: 0x7f1d441b42b0 (0x7f1d441b4378) (level=1)
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d441b42b0) XAVP name: cnt
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 7279890
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 1
INFO: <core> [core/xavp.c:555]: xavp_print_list_content():      XAVP value (int): 2
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d441b42b0) end
INFO: <core> [core/xavp.c:584]: xavp_print_list_content(): ----- end XAVP list: 0x7f1d441b42b0 (level=1)
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:0 - 0x7f1d441b4358) end
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:0 - 0x7f1d441c0cf0) XAVP name: _dsdst_
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 1427333496
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 6
INFO: <core> [core/xavp.c:571]: xavp_print_list_content():      XAVP value: <xavp:0x7f1d441ec258>
INFO: <core> [core/xavp.c:543]: xavp_print_list_content(): +++++ start XAVP list: 0x7f1d441ec258 (0x7f1d441c0d10) (level=1)
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d441ec258) XAVP name: dstid
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 1762493352
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 2
INFO: <core> [core/xavp.c:558]: xavp_print_list_content():      XAVP value (str): cuore_1
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d441ec258) end
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d441b4650) XAVP name: attrs
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 1835799177
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 2
INFO: <core> [core/xavp.c:558]: xavp_print_list_content():      XAVP value (str): weight=100;maxload=2;duid=cuore_1
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d441b4650) end
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d441edb50) XAVP name: grp
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 7056653
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 1
INFO: <core> [core/xavp.c:555]: xavp_print_list_content():      XAVP value (int): 1
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d441edb50) end
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d44202b88) XAVP name: uri
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 8122237
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 2
INFO: <core> [core/xavp.c:558]: xavp_print_list_content():      XAVP value (str): sip:34.201.28.49:5080
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d44202b88) end
INFO: <core> [core/xavp.c:584]: xavp_print_list_content(): ----- end XAVP list: 0x7f1d441ec258 (level=1)
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:0 - 0x7f1d441c0cf0) end
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:0 - 0x7f1d441bcbb0) XAVP name: _dsdst_
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 1427333496
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 6
INFO: <core> [core/xavp.c:571]: xavp_print_list_content():      XAVP value: <xavp:0x7f1d441ebed8>
INFO: <core> [core/xavp.c:543]: xavp_print_list_content(): +++++ start XAVP list: 0x7f1d441ebed8 (0x7f1d441bcbd0) (level=1)
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d441ebed8) XAVP name: attrs
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 1835799177
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 2
INFO: <core> [core/xavp.c:558]: xavp_print_list_content():      XAVP value (str): weight=100;maxload=2;duid=cuore_3
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d441ebed8) end
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d441bcb08) XAVP name: grp
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 7056653
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 1
INFO: <core> [core/xavp.c:555]: xavp_print_list_content():      XAVP value (int): 11
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d441bcb08) end
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d441f08a8) XAVP name: uri
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 8122237
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 2
INFO: <core> [core/xavp.c:558]: xavp_print_list_content():      XAVP value (str): sip:35.170.67.206:5080
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d441f08a8) end
INFO: <core> [core/xavp.c:584]: xavp_print_list_content(): ----- end XAVP list: 0x7f1d441ebed8 (level=1)
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:0 - 0x7f1d441bcbb0) end
INFO: <core> [core/xavp.c:584]: xavp_print_list_content(): ----- end XAVP list: 0x7f1d441b4358 (level=0)
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1075 a=16 n=if
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1080 a=26 n=xlog
DEBUG: <script>: [DISPATCH] 4-7723 at 192.168.1.201: going to <sip:*TESTCALL at cuore-proxy.sandbox-sngl.com> via <sip:34.201.28.49:5080>
```

Call 5
```
ERROR: <script>: [DISPATCH] 5-7723 at 192.168.1.201: ds_select_routes was succesful (ruri: sip:*TESTCALL at cuore-proxy.sandbox-sngl.com - du: <<null>> xavp_dsdst: <<null>>)
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1070 a=24 n=pv_xavp_print
INFO: <core> [core/xavp.c:543]: xavp_print_list_content(): +++++ start XAVP list: 0x7f1d44226d88 ((nil)) (level=0)
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:0 - 0x7f1d44226d88) XAVP name: _dsctx_
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 1427193258
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 6
INFO: <core> [core/xavp.c:571]: xavp_print_list_content():      XAVP value: <xavp:0x7f1d44226ce0>
INFO: <core> [core/xavp.c:543]: xavp_print_list_content(): +++++ start XAVP list: 0x7f1d44226ce0 (0x7f1d44226da8) (level=1)
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d44226ce0) XAVP name: cnt
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 7279890
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 1
INFO: <core> [core/xavp.c:555]: xavp_print_list_content():      XAVP value (int): 1
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d44226ce0) end
INFO: <core> [core/xavp.c:584]: xavp_print_list_content(): ----- end XAVP list: 0x7f1d44226ce0 (level=1)
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:0 - 0x7f1d44226d88) end
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:0 - 0x7f1d44226c38) XAVP name: _dsdst_
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 1427333496
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 6
INFO: <core> [core/xavp.c:571]: xavp_print_list_content():      XAVP value: <xavp:0x7f1d44226b70>
INFO: <core> [core/xavp.c:543]: xavp_print_list_content(): +++++ start XAVP list: 0x7f1d44226b70 (0x7f1d44226c58) (level=1)
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d44226b70) XAVP name: attrs
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 1835799177
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 2
INFO: <core> [core/xavp.c:558]: xavp_print_list_content():      XAVP value (str): weight=100;maxload=2;duid=cuore_3
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d44226b70) end
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d44226ac8) XAVP name: grp
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 7056653
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 1
INFO: <core> [core/xavp.c:555]: xavp_print_list_content():      XAVP value (int): 11
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d44226ac8) end
INFO: <core> [core/xavp.c:547]: xavp_print_list_content():      *** (l:1 - 0x7f1d44226a08) XAVP name: uri
INFO: <core> [core/xavp.c:548]: xavp_print_list_content():      XAVP id: 8122237
INFO: <core> [core/xavp.c:549]: xavp_print_list_content():      XAVP value type: 2
INFO: <core> [core/xavp.c:558]: xavp_print_list_content():      XAVP value (str): sip:35.170.67.206:5080
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:1 - 0x7f1d44226a08) end
INFO: <core> [core/xavp.c:584]: xavp_print_list_content(): ----- end XAVP list: 0x7f1d44226b70 (level=1)
INFO: <core> [core/xavp.c:581]: xavp_print_list_content():      *** (l:0 - 0x7f1d44226c38) end
INFO: <core> [core/xavp.c:584]: xavp_print_list_content(): ----- end XAVP list: 0x7f1d44226d88 (level=0)
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1075 a=16 n=if
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1072 a=26 n=send_reply
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1073 a=2 n=exit
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1062 a=26 n=dp_match
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1079 a=16 n=if
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1064 a=27 n=ds_select_routes
exec: *** cfgtrace:request_route=[DISPATCH] c=[/usr/local/kamailio5/etc/kamailio/kamailio.cfg] l=1069 a=26 n=xlog
ERROR: <script>: [DISPATCH] 6-7723 at 192.168.1.201: ds_select_routes was succesful (ruri: sip:*TESTCALL at cuore-proxy.sandbox-sngl.com - du: <<null>> xavp_dsdst: <<null>>)
```


-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1728#issuecomment-440738611
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20181121/eba36062/attachment-0001.html>


More information about the sr-dev mailing list