<div dir="ltr">Hi,<br><br>I'm trying to use LCR with kamailio v5.5.4<br>gw, rule and rule_target are stored on mysql.<br><br>for lcr rules, do you know if prefix is mandatory ?<br>I first wanted to start using request_uri instead and leave the prefix column null/empty because prefix seems not to support regexp, I don't want to add the same rule with different prefixes.<br><br>but I'm facing issues <br><br>my database is fulfilled with :<br>lcr_gw<br>+----+--------+--------------+---------------+----------+------+--------+------------+-----------+-------+--------+-------------+-------+---------+<br>| id | lcr_id | gw_name      | ip_addr       | hostname | port | params | uri_scheme | transport | strip | prefix | tag         | flags | defunct |<br>+----+--------+--------------+---------------+----------+------+--------+------------+-----------+-------+--------+-------------+-------+---------+<br>|  1 |      1 | carrier1     | 10.78.51.3    | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | fd=carrier1 |     0 |    NULL |<br>|  2 |      1 | carrier2     | 10.78.51.3    | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | fd=carrier2 |     0 |    NULL |<br>|  3 |      1 | carrier3     | 10.192.50.212 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>|  6 |      1 | carrier4     | 10.192.50.3   | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | fd=carrier4 |     0 |    NULL |<br>| 10 |      1 | carrier5     | 10.192.50.3   | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | fd=carrier5 |     0 |    NULL |<br>| 18 |      1 | carrier6     | 10.192.50.214 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 20 |      1 | carrier7     | 10.192.50.210 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 30 |      1 | carrier8     | 10.192.50.211 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 31 |      1 | carrier9     | 10.192.50.216 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 32 |      2 | media1       | 10.192.50.232 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 33 |      2 | media2       | 10.192.50.233 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 34 |      2 | media3       | 10.192.50.234 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 35 |      2 | media4       | 10.192.50.235 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 36 |      2 | media5       | 10.192.50.240 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 37 |      2 | media6       | 10.192.50.241 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 38 |      2 | media7       | 10.192.50.242 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | NULL        |     0 |    NULL |<br>| 39 |      3 | xivo-231     | 10.192.50.231 | NULL     | 5060 | NULL   |       NULL |         1 |  NULL | NULL   | cps=5;cc=50 |     0 |    NULL |<br>+----+--------+--------------+---------------+----------+------+--------+------------+-----------+-------+--------+-------------+-------+---------+<br><br>lcr_rule<br>+----+------------------------+-----------------------------------+------------------+--------+----------+-----------+---------+---------+<br>| id | desc                          | request_uri                   | lcr_id | prefix | from_uri | mt_tvalue | stopper | enabled |<br>+----+------------------------+-----------------------------------+------------------+--------+----------+-----------+---------+---------+<br>|  1  | Default                      | .+                                   |      1 | NULL   | NULL     | NULL      |       0 |       1 |<br>|  2  | France GSM             | (0|(|00|\+)33)[67]\d{8}    |      1 | NULL   | NULL     | NULL      |       1 |       1 |<br>|  3  | France                      | (0|(|00|\+)33)[1-59]\d{8} |      1 | NULL   | NULL     | NULL      |       1 |       1 |<br>|  4  | International default  | (00|\+)[1-9].+                 |      1 | NULL   | NULL     | NULL      |       1 |       1 |<br>|  5  | Italy                           | (00|\+)39.+                    |      1 | NULL   | NULL     | NULL      |       1 |       1 |<br>| 14 | to_oldmedias            | .+                                   |      2 | NULL   | NULL     | NULL      |       0 |       1 |<br>+----+------------------------+-----------------------------------+-------------------+--------+----------+-----------+---------+---------+<br><br>lcr_rule_target<br>+----+--------+---------+-------+----------+--------+<br>| id | lcr_id | rule_id | gw_id | priority | weight |<br>+----+--------+---------+-------+----------+--------+<br>| 25 |      1 |       3 |     3 |        1 |      1 |<br>| 26 |      1 |       3 |    18 |        2 |      1 |<br>| 28 |      1 |       3 |    30 |        3 |      1 |<br>| 29 |      1 |       2 |    30 |        4 |      1 |<br>| 30 |      1 |       2 |     3 |        2 |      1 |<br>| 31 |      1 |       2 |    18 |        3 |      1 |<br>| 32 |      1 |       2 |    20 |        1 |      1 |<br>| 33 |      1 |       1 |    30 |        1 |      1 |<br>| 34 |      1 |      12 |     1 |        1 |      1 |<br>| 35 |      1 |      12 |    10 |        1 |      1 |<br>| 37 |      2 |      14 |    32 |        1 |      1 |<br>| 38 |      2 |      14 |    33 |        1 |      1 |<br>| 39 |      2 |      14 |    34 |        1 |      1 |<br>| 40 |      2 |      14 |    35 |        1 |      1 |<br>| 41 |      2 |      14 |    36 |        1 |      1 |<br>| 42 |      2 |      14 |    37 |        1 |      1 |<br>| 43 |      2 |      14 |    38 |        1 |      1 |<br>| 45 |      1 |       2 |    10 |        3 |      1 |<br>+----+--------+---------+-------+----------+--------+<br><br>to test gws, I use kamcmd<br>for example :<br>kamcmd lcr.load_gws 1 s:0600000001 s:02111111111 s:0600000001<br>arg 1 : prefix or $rU<br>arg 2 : from_uri<br>arg 3 : request_uri<br><br>result is OK with 5 gateways selected<br><br>but in real test situation with the following config file :<br><br>kamailio.cfg :<br><br>request_route {<br>...<br>if(!load_gws(1,$rU,$fU)) {<br>              sl_send_reply("500", "Cannot load gateways");<br>              exit;<br>}  <br>## - dumping the list of lcr gateways<br>$var(i) = 0;<br>while( $(avp(lcr_gw_uri)[$var(i)]) != $null) {<br>        xlog("L_ERR","loaded gw_uri_avp[$var(i)]=’$(avp(lcr_gw_uri)[$var(i)])’\n");<br>        $var(i) = $var(i) + 1;<br>}<br><br>if(!next_gw()) {<br>        sl_send_reply("503", "No gateways found");<br>        exit;<br>}<br>}<br>.....<br><br>=> we receive a 503 "No gateways found", which indicate that load_gws() is OK, but wasn't able to parse avp lcr_gw_uri (we have no xlog output)<br><br>Then I noticed that some calls are OK  and others are KO (with same pattern for $rU) => lcr rule id 2<br><br>So I with debug=3<br><br><u>call to 0611111111 => load_gws OK and next_gw OK</u><br><br> lcr [lcr_mod.c:3018]: do_from_gw(): request did not come from gw<br> lcr [lcr_mod.c:3018]: do_from_gw(): request did not come from gw<br> lcr [lcr_mod.c:3004]: do_from_gw(): request game from gw<br> lcr [lcr_mod.c:3009]: do_from_gw(): added tag_avp <cps=5;cc=50><br> lcr [lcr_mod.c:2264]: ki_load_gws_furi(): load_gws(1, 0611111111, 0211111111)<br> lcr [lcr_mod.c:2313]: ki_load_gws_furi(): from uri <0211111111> did not match to from regex <AMD><br> lcr [lcr_mod.c:2349]: ki_load_gws_furi(): request uri <<a href="http://sip:0611111111@10.192.50.227:5060">sip:0611111111@10.192.50.227:5060</a>> did not match to request regex <(00|\+)39.+><br> lcr [lcr_mod.c:2349]: ki_load_gws_furi(): request uri <<a href="http://sip:0611111111@10.192.50.227:5060">sip:0611111111@10.192.50.227:5060</a>> did not match to request regex <(00|\+)[1-9].+><br> lcr [lcr_mod.c:2349]: ki_load_gws_furi(): request uri <<a href="http://sip:0611111111@10.192.50.227:5060">sip:0611111111@10.192.50.227:5060</a>> did not match to request regex <(0|(|00|\+)33)[1-59]\d{8}><br> lcr [lcr_mod.c:2369]: ki_load_gws_furi(): added matched_gws[0]=[4, 0, 3, 2329862]<br> lcr [lcr_mod.c:2369]: ki_load_gws_furi(): added matched_gws[1]=[5, 0, 1, 5553909]<br> lcr [lcr_mod.c:2369]: ki_load_gws_furi(): added matched_gws[2]=[8, 0, 3, 7256660]<br> lcr [lcr_mod.c:2369]: ki_load_gws_furi(): added matched_gws[3]=[7, 0, 2, 3129551]<br> lcr [lcr_mod.c:2369]: ki_load_gws_furi(): added matched_gws[4]=[6, 0, 4, 2234577]<br> lcr [lcr_mod.c:2085]: add_gws_into_avps(): added gw_uri_avp <6|sip:|0|||3543318538||5060||;transport=udp|0|2> with weight <2234577><br> lcr [lcr_mod.c:2085]: add_gws_into_avps(): added gw_uri_avp <4|sip:|0||fd=carrier5|53657610||5060||;transport=udp|0|2> with weight <2329862><br> lcr [lcr_mod.c:2085]: add_gws_into_avps(): added gw_uri_avp <8|sip:|0|||3593650186||5060||;transport=udp|0|2> with weight <7256660><br> lcr [lcr_mod.c:2085]: add_gws_into_avps(): added gw_uri_avp <7|sip:|0|||3560095754||5060||;transport=udp|0|2> with weight <3129551><br> lcr [lcr_mod.c:2085]: add_gws_into_avps(): added gw_uri_avp <5|sip:|0|||3526541322||5060||;transport=udp|0|2> with weight <5553909><br> lcr [lcr_mod.c:2610]: generate_uris(): r_uri <sip:0611111111@10.192.50.210:5060;transport=udp>, dst_uri <><br> lcr [lcr_mod.c:2904]: ki_next_gw(): added ruri_user_avp <0611111111><br> lcr [lcr_mod.c:2950]: ki_next_gw(): added tag_avp <><br> lcr [lcr_mod.c:2965]: ki_next_gw(): added defunct_gw_avp <3526541322><br> lcr [lcr_mod.c:2610]: generate_uris(): r_uri <sip:0611111111@10.192.50.212:5060;transport=udp>, dst_uri <><br> lcr [lcr_mod.c:2950]: ki_next_gw(): added tag_avp <><br> lcr [lcr_mod.c:2965]: ki_next_gw(): added defunct_gw_avp <3560095754><br> lcr [lcr_mod.c:2610]: generate_uris(): r_uri <sip:0611111111@10.192.50.214:5060;transport=udp>, dst_uri <><br> lcr [lcr_mod.c:2950]: ki_next_gw(): added tag_avp <><br> lcr [lcr_mod.c:2965]: ki_next_gw(): added defunct_gw_avp <3593650186><br> lcr [lcr_mod.c:2610]: generate_uris(): r_uri <sip:0611111111@10.192.50.3:5060;transport=udp>, dst_uri <><br> lcr [lcr_mod.c:2950]: ki_next_gw(): added tag_avp <fd=carrier5><br> lcr [lcr_mod.c:2965]: ki_next_gw(): added defunct_gw_avp <53657610><br> lcr [lcr_mod.c:2610]: generate_uris(): r_uri <sip:0611111111@10.192.50.211:5060;transport=udp>, dst_uri <><br> lcr [lcr_mod.c:2950]: ki_next_gw(): added tag_avp <><br> lcr [lcr_mod.c:2965]: ki_next_gw(): added defunct_gw_avp <3543318538><br><div><br></div><div>the right gws are selected and call are routed to them<br></div><br><u>call to 0600000001 => load_gws OK and next_gw KO</u><br><br> lcr [lcr_mod.c:3018]: do_from_gw(): request did not come from gw<br> lcr [lcr_mod.c:3018]: do_from_gw(): request did not come from gw<br> lcr [lcr_mod.c:3004]: do_from_gw(): request game from gw<br> lcr [lcr_mod.c:3009]: do_from_gw(): added tag_avp <cps=5;cc=50><br> lcr [lcr_mod.c:2264]: ki_load_gws_furi(): load_gws(1, 0600000001, 0211111111)<br> lcr [lcr_mod.c:2313]: ki_load_gws_furi(): from uri <0170619309> did not match to from regex <AMD><br><div> lcr [lcr_mod.c:2349]: ki_load_gws_furi(): request uri <<a href="http://sip:0600000001@10.192.50.227:5060">sip:0600000001@10.192.50.227:5060</a>> did not match to request regex <(00|\+)39.+></div><div><br></div><div>the process stops after trying to match rule with regexp <(00|\+)39.+>

</div><br><div>Don't know if it's a bug or if I misunderstood something !</div><div><br></div><div>Thanks in advance !</div><div><br></div><div>Best regards,<br></div><div><br></div><div><br></div><br></div>

<br>
<a href="https://app.livestorm.co/comdata-group/metaverse-what-will-cx-look-like-in-an-immersive-world?type=detailed&utm_source=Livestorm&utm_medium=Email&utm_campaign=Webinar+Metaverse" target="_blank"><img src="https://www.comdatagroup.com/wp-content/uploads/2022/04/okBandeau-email-webinar-Metaverse.png" alt="https://app.livestorm.co/comdata-group/metaverse-what-will-cx-look-like-in-an-immersive-world?type=detailed&utm_source=Livestorm&utm_medium=Email&utm_campaign=Webinar+Metaverse"></a><br>