Contact center admins can set up logic in the flow editor to write to a custom variable, then use this variable in the Route To widget to route to a specific queue. This allows you to route to different queues by only using one Route To widget.
Note: This section shows an example configuration and is not meant to be a complete configuration guide.
Enter the following script in the Script widget. This will parse the called number and set the appropriate queue name. In this example, we created the custom variable: global_custom.General.queueName
const log = require('./utils/log'); var {_get:var_get , _set:var_set, _setGlobalVariable: global_var_set} = require('./utils/variable'); module.exports = async () => { let caller_number = var_get()["Start.From"]; let callee_number = var_get()["Start.To"]; let queue_name=""; switch (callee_number) { case "+16505552222": queue_name = "IT Helpdesk Voice"; break; case "+16505553333": queue_name = "Queue2"; break; default: queue_name = "Queue1"; } log.info("Call from " + caller_number + " to " + callee_number + " routed to queue " + queue_name); global_var_set("global_custom.General.queueName", queue_name); //set value of queue to a global custom variable return; }
Set the following settings in the Route To widget. This will send the caller to a queue defined by the global variable.