If you’re using a db, You could also use use_preference and set the dispatcher group there. So that if you need to change existing or add new numbers, you don’t need to change the config, simply add them to the table.

On Tue, 25 Aug 2020 at 07:38, Jurijs Ivolga <jurijs.ivolga@gmail.com> wrote:
Hi Patrik,

It would help if you will include your config and some logs.

But something like this should work:



if($rU=~"^(0201316)[0-1][0-9]$")

{



ds_select_dst("1", "4")




}  else {





ds_select_dst("2", "4")








}





I never tried this code, so it might have some errors, but you should understand the overall idea. 


Jurijs


On Tue, Aug 25, 2020 at 9:18 AM Patrik Nilsson <patrik.n@pm.me> wrote:
Hi,

Although what I'm trying to achieve seems like an easy task, I have been tearing my hair for the past two days getting Kamailio to dispatch incoming phone calls to two different groups of Asterisk servers in my dispatcher list. I have 30 dedicated phone numbers from Telco: 020131600 - 020131629. I want 00-19 to be routed to Group 1, and 20-29 to be routed to Group 2, with a Round-robin algorithm. I'm aware that I can set up these incoming phone numbers in each Asterisk server's extension dial plans; nevertheless, I want Kamailio to do the initial incoming routing to a specific group (as Group 2, for instance, will never receive calls from for instance 02013161).

Example dispatcher.list:
#Company A (Group 1)
1 sip:10.50.0.1 0 0 maxload=20
1 sip:10.50.0.2 0 0 maxload=20
1 sip:10.50.0.3 0 0 maxload=20
#Company B (Group 2)
2 sip: 10.60.0.1 0 0 maxload=20
2 sip: 10.60.0.2 0 0 maxload=20
2 sip: 10.60.0.3 0 0 maxload=20

I assume this is done in the route[DISPATCH] of my kamailio.cfg, using ds_select_dst, but my previous attempts to get this routing to work just breaks the config file.

I appreciate any help that I can get!

Best regards,
Patrik
_______________________________________________


Kamailio (SER) - Users Mailing List


sr-users@lists.kamailio.org


https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users




_______________________________________________

Kamailio (SER) - Users Mailing List

sr-users@lists.kamailio.org

https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

--
Regards,

David Villasmil
email: david.villasmil.work@gmail.com
phone: +34669448337