abuzooz Posted September 14, 2020 Report Posted September 14, 2020 Hi All I am not sure this feature exist in Kazoo, but I guess so as I saw there is weight assigned in resources, what I am trying to do, is to define 3 servers as gateway for Kazoo (I used to have 1 and working perfectly) and Kazoo shall chose one of the servers for outbound calls randomly as I set the resources weight to be equal. However, it is always calling one server and if this server (gateway) is down the call fails. Any Idea? Dailplan regex is the same for all gateways Quote
fmateo05 Posted September 14, 2020 Report Posted September 14, 2020 (edited) Shall I send you a direct message? Edited September 14, 2020 by fmateo05 (see edit history) Quote
Administrators mc_ Posted September 16, 2020 Administrators Report Posted September 16, 2020 Look at the flag for 'gateway_strategy'; can be 'sequential' or 'random'. Then you can define one resource with 3 gateways and shuffle between them. With resources of the same weight, there is no expected or implied order; its kinda up to the system and how things are fetched from the database. Quote
abuzooz Posted September 16, 2020 Author Report Posted September 16, 2020 @mc_ thank you for your continue help! worked like a charm Quote
abuzooz Posted October 7, 2020 Author Report Posted October 7, 2020 Hi @mc_ If I understood you correctly, I added 1 resource with 3 gateways as below, still the first defined gateway will be always used and no load distribution is happening, am I doing anything wrong? { "data":{ "emergency":false, "enabled":true, "flags":[ ], "gateways":[ { "channel_selection":"ascending", "codecs":[ "PCMU", "PCMA" ], "custom_sip_headers":{ "out":{ "user_caller_id_number":"{caller_id_number}", "user_caller_id_name":"{caller_id_name}", "X-account-id":"{account_id}", "X-Member":"{caller_id_name}" } }, "emergency":false, "enabled":true, "endpoint_type":"sip", "format_from_uri":false, "gateway_strategy":"sequential", "invite_format":"route", "prefix":"", "progress_timeout":15, "realm":"bill.XXX.com", "server":"bill.XXX.com", "suffix":"", "username":"", "password":"", "Custom-Channel-Vars":{ "Caller-Privacy-Hide-Name":false, "Caller-Privacy-Hide-Number":false }, "force_port":false, "port":5060, "skype_rr":true }, { "channel_selection":"ascending", "codecs":[ "PCMU", "PCMA" ], "custom_sip_headers":{ "out":{ "user_caller_id_number":"{caller_id_number}", "user_caller_id_name":"{caller_id_name}", "X-account-id":"{account_id}", "X-Member":"{caller_id_name}" } }, "emergency":false, "enabled":true, "endpoint_type":"sip", "format_from_uri":false, "gateway_strategy":"sequential", "invite_format":"route", "prefix":"", "progress_timeout":15, "realm":"bill2.XXX.com", "server":"bill2.XXX.com", "suffix":"", "username":"", "password":"", "Custom-Channel-Vars":{ "Caller-Privacy-Hide-Name":false, "Caller-Privacy-Hide-Number":false }, "force_port":false, "port":5060, "skype_rr":true }, { "channel_selection":"ascending", "codecs":[ "PCMU", "PCMA" ], "custom_sip_headers":{ "out":{ "user_caller_id_number":"{caller_id_number}", "user_caller_id_name":"{caller_id_name}", "X-account-id":"{account_id}", "X-Member":"{caller_id_name}" } }, "emergency":false, "enabled":true, "endpoint_type":"sip", "format_from_uri":false, "gateway_strategy":"sequential", "invite_format":"route", "prefix":"", "progress_timeout":15, "realm":"bill3.XXX.com", "server":"bill3.XXX.com", "suffix":"", "username":"", "password":"", "Custom-Channel-Vars":{ "Caller-Privacy-Hide-Name":false, "Caller-Privacy-Hide-Number":false }, "force_port":false, "port":5060, "skype_rr":true } ], "grace_period":10, "gateway_strategy":"sequential", "media":{ "audio":{ "codecs":[ "PCMU", "PCMA" ] }, "video":{ "codecs":[ ] }, "encryption":{ "enforce_security":false, "methods":[ ] } }, "name":"bill.XXX.com", "rules":[ "[1-9]\\d+" ], "weight_cost":50, "id":"billing" }, "auth_token":"{auth_token}}" } Quote
Administrators mc_ Posted October 7, 2020 Administrators Report Posted October 7, 2020 You want to set `gateway_strategy` to `random` on the top-level of the document (not per-gateway). See the schema at https://docs.2600hz.com/dev/applications/crossbar/doc/resources/ Sequential will dial the gateways in the order they appear in the array; random will shuffle the array and dial in that randomized order. Assuming the shuffle is "random" enough, you should see a roughly even balance of which gateway is dialed first. Quote
abuzooz Posted October 7, 2020 Author Report Posted October 7, 2020 2 hours ago, mc_ said: You want to set `gateway_strategy` to `random` on the top-level of the document (not per-gateway). See the schema at https://docs.2600hz.com/dev/applications/crossbar/doc/resources/ Sequential will dial the gateways in the order they appear in the array; random will shuffle the array and dial in that randomized order. Assuming the shuffle is "random" enough, you should see a roughly even balance of which gateway is dialed first. I am not sure what I am doing wrong, I change where should I put gateway_strategy almost everywhere in the document with no luck,(trial #1 and trial #2 for example), somehow it is always using the first gateway defined in the document in below example (bill.xxx.com), and ignoring the gateway_strategy option, I tried to shuffel gateways and it is always selecting the first one. am I doing something wrong here? { "data": { "emergency": false, "enabled": true, "flags": [], "gateway_strategy":"sequential", ---> tried it here (trial #1) "gateways": [ { "gateway_strategy":"sequential", ---> tried it here (trial #2) "codecs": [ "PCMU", "PCMA" ], "custom_sip_headers": { "out": { "user_caller_id_number": "{caller_id_number}", "user_caller_id_name": "{caller_id_name}", "X-account-id": "{account_id}", "X-Member": "{caller_id_name}" } }, "emergency": false, "enabled": true, "endpoint_type": "sip", "format_from_uri": false, "invite_format": "route", "prefix": "", "progress_timeout": 15, "realm": "bill.xxx.com", "server": "bill.xxx.com", "suffix": "", "username": "", "password": "", "Custom-Channel-Vars": { "Caller-Privacy-Hide-Name": false, "Caller-Privacy-Hide-Number": false }, "force_port": false, "port": 5060, "skype_rr": true }, { "channel_selection": "ascending", "codecs": [ "PCMU", "PCMA" ], "custom_sip_headers": { "out": { "user_caller_id_number": "{caller_id_number}", "user_caller_id_name": "{caller_id_name}", "X-account-id": "{account_id}", "X-Member": "{caller_id_name}" } }, "emergency": false, "enabled": true, "endpoint_type": "sip", "format_from_uri": false, "invite_format": "route", "prefix": "", "progress_timeout": 15, "realm": "bill2.xxx.com", "server": "bill2.xxx.com", "suffix": "", "username": "", "password": "", "Custom-Channel-Vars": { "Caller-Privacy-Hide-Name": false, "Caller-Privacy-Hide-Number": false }, "force_port": false, "port": 5060, "skype_rr": true }, { "channel_selection": "ascending", "codecs": [ "PCMU", "PCMA" ], "custom_sip_headers": { "out": { "user_caller_id_number": "{caller_id_number}", "user_caller_id_name": "{caller_id_name}", "X-account-id": "{account_id}", "X-Member": "{caller_id_name}" } }, "emergency": false, "enabled": true, "endpoint_type": "sip", "format_from_uri": false, "invite_format": "route", "prefix": "", "progress_timeout": 15, "realm": "bill3.xxx.com", "server": "bill3.xxx.com", "suffix": "", "username": "", "password": "", "Custom-Channel-Vars": { "Caller-Privacy-Hide-Name": false, "Caller-Privacy-Hide-Number": false }, "force_port": false, "port": 5060, "skype_rr": true } ], "grace_period": 10, "media": { "audio": { "codecs": [ "PCMU", "PCMA" ] }, "video": { "codecs": [] }, "encryption": { "enforce_security": false, "methods": [] } }, "name": "billing", "rules": [ "[1-9]\\d+" ], "weight_cost": 100, "id": "billing" }, "auth_token": "{auth_token}}" } Quote
Administrators mc_ Posted October 7, 2020 Administrators Report Posted October 7, 2020 This has been part of 4.3 since 4.3.90: https://github.com/2600hz/kazoo/releases/tag/4.3.90 So make sure you have a version >= .90. But, more importantly, you continue to show examples using "sequential". That means "in the order they appear in the gateways array". Quote
abuzooz Posted October 7, 2020 Author Report Posted October 7, 2020 (edited) 1 hour ago, mc_ said: This has been part of 4.3 since 4.3.90: https://github.com/2600hz/kazoo/releases/tag/4.3.90 So make sure you have a version >= .90. But, more importantly, you continue to show examples using "sequential". That means "in the order they appear in the gateways array". Thank you @mc_ the version I have is 4.3-126, somehow when I changed the strategy to "random" it worked, the strange thing when using sequential it keeps using the same gateway without changing, over and over. I am glad with random it worked, thanks again for your help! Edited October 7, 2020 by abuzooz (see edit history) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.