Skip to main content
Skip table of contents

EFSwitch Configurations for CX Voice

Requirements

Software Requirements

Item

Recommended

Installation guide

EFSwitch

Latest version

Installation

EFCX

Latest version

Installation

Install Lua libraries

  • SSH into the Debian server onto which EFSwitch is installed.

    • Use command

      CODE
      ssh username@server-ip
    • Enter user password and press ENTER.

    • Use command

      CODE
      su
    • Enter root password and press ENTER.

  • Run the following commands, one at a time:

    • CODE
      apt install lua-socket
      sudo apt install lua-sec
      sudo apt-get install lua-json
      sudo apt-get install -y lua-dkjson

Configure IVR scripts and recordings

Deployment

  • SSH into the Debian server onto which EFSwitch is installed.

    • Use command

      CODE
      ssh username@server-ip
    • Enter user password and press ENTER.

    • Use command

      CODE
      su
    • Enter root password and press ENTER.

  • Confirm git is installed, and install it if is not.

  • Clone the EFSwitch scripts repository:

    CODE
    git clone -b 4.5 https://efcx:RecRpsuH34yqp56YRFUb@gitlab.expertflow.com/rtc/freeswitch-scripts.git
  • Alter the file name of cx_env.lua to cx_env{DN}.lua where {DN} is the dialing number of the IVR (Set in the CxIvr Dialplan section below).

    • e.g. for an IVR with a dialing number of 1555 the file would be named cx_env1555.lua.

  • Move the files ending in .lua  to the EFSwitch scripts folder:

  • CODE
    mv file-name /usr/share/freeswitch/scripts
  • Move the ivr_prompts folder:

    CODE
    mv ivr_prompts /usr/share/freeswitch/sounds/
  • Assign read-write permissions to the ivr_prompts folder:

    CODE
    chmod 777 -R /usr/share/freeswitch/sounds/ivr_prompts

Configuration

  1. Open cx_env{DN}.lua :

    CODE
    vi cx_env{DN}.lua
  2. Press the "I" key to enter editing mode.

  3. The queueType field can contain one of two values:

    1. 'NAME'

    2. ''

  4. The queue field can contain one of two types of values, based on what the queueType field above contains:

    1. Name of the Agent Queue e.g. Support Queue (If queueType contains 'NAME') This name can be obtained from Unified Admin from the Queues section.

    2. Empty string i.e. '' (If queueType contains '')

  5. If queue and queueType are set to '' , then the call will be routed to the default queue set for the CX Voice channel in Unified Admin.

  6. The voiceConnectorApi field will contain a URL in the following format:

    1. http://VC-IP:VC-PORT/request-agent

    2. Replace VC-IP and VC-PORT with IP address and port of the voice connector.

  7. The cxFqdn field contains the fully qualified domain name of the EFCX:

    1. https://devops.com/message/receive

    2. Replace https://devops.com with the EFCX domain name.

  8. The ivr_prompts_folder field contains path to the ivr_prompts folder. Leave it at the default value.

  9. Save and exit the file by pressing the Esc key, entering :wq and pressing ENTER.

Domain Creation

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Select the Domains option from the Advanced tab.

  • Select the ADD button on the top right.

  • Add the Fully Qualified Domain Name(FQDN) that was provided with the EFSwitch server, as shown in the image below:

  • Save the changes by pressing SAVE button in top right corner.

Configure Dialplans

CxIVR Dialplan

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open the Dialplan Manager section under the Dialplan tab.

  • Add a new Dialplan by pressing the Add Button on the top.

  • Fill the form with following details :

    • Name = CxIvr

    • Condition 1 =  Select destination_number from list and add a dialing number, matching the {DN} value in the cx_env{DN}lua script filename set in the IVR scripts section above.

    • Action 1  =  Select first item from the list  

  • Save the form by pressing save button on top right Corner.

  • Re-open CxIvr dialplan.

  • Change action from transfer to lua and add cxIvr.lua into data column. it looks like this.

  • Set the Context field to the value of the Domain set in the Domain creation section.

  • Set the Domain field to the value of the Domain set in the Domain creation section.

  • Save the changes by pressing SAVE button in top right corner.

Direct-Transfer Dialplan

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open the Dialplan Manager section under the Dialplan tab.

  •  Add a new Dialplan by pressing the Add Button on the top.

  •  Fill the form with following details :

    • Name = CxQueue

    • Condition 1 =  Select destination_number from list and add a random number

    • Action 1  =  Select first item from the list  

  • Save the form by pressing save button on top right Corner.

  • Re-open CxQueue dialplan.

  • Change the value of the Data column in the destination_number row to ^99887766[-0-9a-zA-Z]*$

  • Change the value of the Type column in the Action row to lua and the Data field to vcApi.lua 'directTransfer'

  • Set the Context field to the value of the Domain set in the Domain creation section.

  • Set the Domain field to the value of the Domain set in the Domain creation section.

  • Save the changes by pressing SAVE button in top right corner.

WebRTC Dialplan

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open the Dialplan Manager section under the Dialplan tab.

  • Add a new Dialplan by pressing the Add Button on the top.

  • Fill the form with following details :

    • Name = webrtc

    • Condition 1 =  Select destination_number from list and add the webRTC dialing number

    • Action 1  =  Select first item from the list  

  • Save the form by pressing save button on top right Corner.

  • Re-open webRTC dialplan.

  • Set the Context field to the value of the Domain set in the Domain creation section.

  • Set the Domain field to the value of the Domain set in the Domain creation section.

Progressive Outbound Dialplan

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open the Dialplan Manager section under the Dialplan tab.

  • Add a new Dialplan by pressing the Add Button on the top.

  • Fill the form with following details :

    • Name = Progressive Outbound Agent Transfer

    • Condition 1 =  Select destination_number from list and set the value to agent

    • Action 1  =  Select first item from the list  

  • Save the form by pressing save button on top right Corner.

  • Re-open the Progressive Outbound Agent Transfer dialplan.

  • Set the Context field to the value of the Domain set in the Domain creation section.

  • Set the Domain field to the value of the Domain set in the Domain creation section.

  • Change the value of the Type column in the Action row to bridge and the Data field to user/${sip_h_X-agentExtension}@<DOMAIN>

    • Where DOMAIN is the value of the Domain set in the Domain creation section.

Changes in Local extension Dialplan

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open the Dialplan Manager section under the Dialplan tab.

  • Find and open the local_extension dialplan.

  • Add the following information to the last group:

action

lua

vcApi.lua 'rona'

1

76

true

  • The result will look like this:

  • Note that the new line must be AFTER the bridge user/${destination_number}@${domain_name} line so if the Order of that line is 75 then the new line must have order 76 (as shown in the image above)

  • Save the changes by pressing SAVE button in top right corner.

Changes in Global Variables dialplan

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open the Dialplan Manager section under the Dialplan tab.

  • Find and open the global_variables dialplan.

  • Add the following information to this dialplan:

Tag

Type

Data

Group

Order

Enabled

condition

${sip_h_X-CALL-ID}

^$

2

5

true

action

set

sip_h_X-CALL-ID=${sip_call_id}

2

10

true

action

set

sip_rh_X-CALL-ID=${sip_call_id}

2

15

true

Tag

Type

Data

Group

Order

Enabled

condition

${sip_h_X-CALL-VARIABLE0}

^$

3

5

true

action

set

sip_h_X-CALL-VARIABLE0=${uuid}

3

10

true

action

set

sip_rh_X-CALL-VARIABLE0=${uuid}

3

15

true

Tag

Type

Data

Group

Order

Enabled

action

export

sip_h_X-CALL-ID=${sip_h_X-CALL-ID}

4

5

true

action

export

sip_rh_X-CALL-ID=${sip_h_X-CALL-ID}

4

10

true

action

export

sip_h_X-CALL-VARIABLE0=${sip_h_X-CALL-VARIABLE0}

4

15

true

action

export

sip_rh_X-CALL-VARIABLE0=${sip_h_X-CALL-VARIABLE0}

4

20

true

  • The result will look like:

  • Save the changes by pressing SAVE button in top right corner.

Configure SIP Trunk(Gateway) for outbound calls

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open the Gateways section under the Accounts tab.

    image-20240222-095737.png
  • Press the ADD button in the top right.

    image-20240222-095900.png
  • Set the following fields:

    1. Gateway: A name of your choice e.g. MySipTrunk

    2. Username: The username of the SIP Trunk. Not needed for IP-based SIP trunks.

    3. Password: The password of the SIP Trunk. Not needed for IP-based SIP trunks.

    4. Proxy: The IP address and port of the SIP trunk e.g. 192.168.25.35:5060.

    5. Register: Set to True. Set to False for IP-based SIP trunks.

      image-20240222-100014.png
  • Press the SAVE button on the top right.

  • Open this newly created gateway and note the URL opened in the browser.

  • image-20240222-110233.png
  • Add the IP address of the SIP trunk to the EFSwitch ACL:

    • Open SIP Profiles under the Advanced tab.

      image-20240222-100519.png
  • Open the external profile and note the value of the apply-register-acl field.

    image-20240222-100419.png
  • Open Access controls under the Advanced tab.

    image-20240222-100249.png
  • Open the entry that matches the aforementioned apply-register-acl field.

    image-20240222-100648.png
  • At the bottom add an entry where the the Type is set to ‘allow’ and the CIDR field contains the address of the SIP Trunk.

  • Press the SAVE button on the top right.

  • Open SIP Status under the Status tab.

    image-20240222-100938.png
  • Press the Reload ACL button at the top right.'

  • Open SIP Profiles under the Advanced tab.

    image-20240222-100519.png
  • Open the external profile and note the value of the sip-port field.

    4edxejLLTs8BSroVy-I2z6eL8--Hfdz8v1gW1GdAMElNj-zSsmUdTG_UyhTvdnVKsHn33GJrkL4C8tQ8YImhJU4VW3j8krNbeImQIgG9kFSTPZqQc1awS-R27kB22tg7UUB5iZ0U8I9tlQf9SagoM1M
  • Back out via the BACK button on the top right.

  • Open the internal profile and note the value of the sip-port field.

    Ut43rIqZ-gmOwcst_HOJmSqyMiUcQ0nLDrqFCzh6lR1ouKUqHwAgUuP5p2mp4xl8QMOG6p7opB74bm6_hcSD-WFw3OreKW2TjPmoJLob6NHFq3q21QBsBWQ4XIn0gq3lgamz9kM89UkzWZww3bhyY1A
  • Open a terminal and SSH into the EFSwitch machine via the command

    • CODE
      ssh EFSwitch-Server-Username@EFSwitch-Server-IP-Address
  • Enter the EFSwitch server SSH password when prompted.

  • Enter and run the command

    • CODE
      su
  • And enter the EFSwitch server root password.

  • Run the command

    • CODE
      sudo iptables -A INPUT -p tcp -m tcp --dport PORT -j ACCEPT
    • Where PORT is the port noted down in the previous steps. Run the command once for each port.

  • Run the command

    • CODE
      sudo iptables-save
  • Contact the SIP Trunk provider and have all traffic from the EFSwitch machine public IP address allowed.

Configuring route For Outbound calls

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open the Outbound Routes section under the Dialplans tab.

  • Press the ADD button in the top right.

  • Set the following fields :

    • Gateway = The name of the gateway configured above.

    • Condition 1 =  The format of the number accepted by the SIP trunk e.g. for 11 digits the format is ^(\d{11})$

  • Press the SAVE button on top right Corner.

Configuring route For Inbound calls

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open the Destinations section under the Dialplans tab.

  • Press the ADD button in the top right.

  • In the Destination field set the inbound dialing number provided by the SIP trunk provider.

  • Press the SAVE button on top right Corner.

  • Open the Inbound Routes section under the Dialplans tab.

  • Press the ADD button in the top right.

  • Set the following fields :

    • Name = A name of your choice.

    • Destination Number =  The destination created above.

    • Action = From the Extensions list select the number chosen as the destination number in the CxIvr dialplan section above.

  • Press the SAVE button on top right Corner.

Configure Access Control List (ACL)

For the Voice Connector and Dialer to be able to access the Freeswitch ESL for communicating with EFSwitch, their IP address must be added to the ACL.

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open the Access Control List from the Advanced tab.

  • Create a new ACL with the Add button.

  • Set the name to esl,  the Default to allow and add the following IP addresses:

    • 127.0.0.1

    • The IP address of the server the EFSwitch is running on e.g. 192.168.1.17.

    • The IP address of the server the Voice connector is running on e.g. 192.168.1.201.

    • The IP address of the server the Dialer is running on e.g. 192.168.1.106.

    • Lastly, add the IP addresses of the docker containers for the Voice connector and Dialer.

      • On the Voice connector and Dialer servers, use the command docker ps to list the containers.

      • Run the command:

        • CODE
          docker inspect containerID
      • Scroll down to the Networks object and find the Gateway and IPAddress fields.

      • Copy these two addresses to the esl ACL.

      • Make sure to do this process for both the Voice connector and dialer.

  • Click the Save button and go to the SIP Status with from the Status tab.

  • Click the Reload ACL button on the top right.

Configure Event Socket Library (ESL)

  • Login to EFSwitch web interface. 

    • Open in browser: https://IP-addr, where IP-addr is the IP address of the server that EFSwitch is deployed on.

    • Add the username and password that was shown upon installation of EFSwitch and press LOGIN.

  • Press the IP address in the top right and select the Domain created in the Domain creation section above:

  • Open Settings from the Advanced tab.

  • Change the Event Socket IP Address to 0.0.0.0, and the Event Socket ACL to esl.

    • Optionally, change the Event Socket Password to the a different value, or leave as default ClueCon.

      • If the password is changed, then the same must be set in the environment files for the voice connector and dialer.

    • If the password is changed, update it in the environment variables for the and Dialer docker containers.

    • SSH into the Debian server onto which EFSwitch is installed.

      • Use command

        CODE
        ssh username@server-ip
      • Enter user password and press ENTER.

      • Use command

        CODE
        su
      • Enter root password and press ENTER.

    • Run the command to restart EFSwitch with the new ESL settings:

      CODE
      systemctl restart freeswitch
  • Log out of the EFSwitch web interface and log back in.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.