Call Routing Between FCSDK Gateway & SIP Infrastructure.

This is a step-by-step guide & overview to enable calling between the FCSDK Web Gateway and a SIP phone, using CUCM or Asterisk. This guide will cover:

  • High Level Overview & Call Flows
  • FAS Control Domains
  • FCSDK Outbound & Inbound Calling
  • Asterisk Configuration
  • CUCM Configuration
  • References to more detailed articles on topics covered within

This guide assumes you have FAS, FCSDK & a SIP Communications Device pre-installed.

For these steps we will be using the CSDK-Sample app (https://SERVER_ADDRESS:8443/csdk-sample/) With user 1001 (1001@SERVER_ADDRESS) as an example.

For a previous version of this Article, please see here: 

https://support.cafex.com/hc/en-us/articles/200633372-Configuring-CUCM-with-Cafex-

 

Infrastructure Overview

 

 

FAS Controlled Domain

FAS is able to host multiple HTTP/SIP applications. In order for SIP messages to be routed to the correct application FAS allows each application to have a number of Controlled Domains. The Controlled Domain is used to uniquely identify the FCSDK Web Gateway within a network, allowing it to communicate with other network devices. The SIP container will inspect an initial SIP Request to determine if there is a suitable Domain for the Request. 

The FAS Controlled Domain is located here: https://<SERVER_ADDRESS>:9990/ --> Profiles --> SIP --> Application Routers --> FCSDKgatewayAppRouter --> Controlled domains.

FCSDK Outbound Calling

Outbound Call Flow Overview

Outbound calling describes the scenario where a call is place from a FCSDK client out to a SIP endpoint via the gateway and PBX/Contact Centre.

 

  1.  To dial from a FCSDK client to a SIP endpoint connected to a PBX/Contact Centre the Remote Address that is dialled in the WS CONNECT should use a control address outside the Gateway. Using "rewrite Outbound SIP URIs in the WebPlugin Framework (See below) means that the URI used in the remote address can be of any value that is not in the Gateways contolled domains (e.g. @another.domain, @randomstring). It does not need to be the control domain of the PBX/Contact Centre providing the Rewrite SIP URIs option is enabled.
  2. The gateway will create a SIP INVITE to the PBX/Contact Centre, rewriting the request URI in the remote address from message 1 (@another.domain), to have the request URI of the Outbound SIP Server(@pbx.domain). Note that this does not affect the to URI in the SIP INVITE which will remain as the remote address (@another.domain). The Contact address will be for the WebRTC client @gateway-ip or @gateway-domain.
  3. & 4. All subsequent SIP requests from the gateway to the SIP PBX/Contact Centre will use Request URIs addressed to @pbx.domain

 Configuring Outbound Calling from FCSDK Gateway.

Setting up outbound calling in FCSDK is managed in the Web Plugin Framework, under Gateway > General Administration.

(https://SERVER_ADDRESS:8443/web_plugin_framework/webcontroller/admin/)

 

Outbound Sip Server should be set to sip:sipserver.domain.

The Rewrite Outbound SIP URI's checkbox will result in the Gateway overwriting everything after the @ in the  request URI of the SIP Invite to the outbound SIP server address. In the above example;

INVITE sip:1001@sipserver.domain will be rewritten to INVITE sip:1001@cs-asterisk.cafex.com.

Only do this if you only dial to one SIP destination.

FCSDK Inbound Calling

Inbound calling describes the scenario where a call is place from a SIP endpoint in to a FCSDK client via the gateway.

Configuring Inbound calling to the FCSDK Gateway

Asterisk

You will need a trunk set up from Asterisk FreePBX to the FCSDK Gateway in order for calls placed on the SIP network to be directed into CSDK.

Creating the Outbound Trunk

Please go to Connectivity > Trunks to create a new trunk, and enter the Trunk Name.

 

Under Dialed Number Manipulation Rules, input your Dial Pattern. In this example, we are routing all calls from sip:1001@asterisk.cafex.com to sip:7XXX@csdk.cafex.com to the CSDK gateway.

Under SIP settings, set the required PEER details for the route. Please see below for a Non-Production example.

Now you are ready to register a SIP device on Asterisk, and Dial into CSDK! Dial sip:7XXX@csdk.cafex.com when logged into csdk with your sample agent.

 

CUCM

Trunk Configuration

You will need a trunk set up from CUCM to the FCSDK Gateway in order for calls placed on the SIP network to be directed into CSDK. Once your trunk is set up there are two further steps required for the calls to be placed successfully.

  • Creation of a Route Pattern
  • Applying a Normalization Script to the Trunk

 

Route Pattern

The Route Pattern will direct any traffic matching that pattern to the Gateway/Route List specified. route patterns may be a complete dial number or a section (e.g. 7951 or 79XX). To configure first go to the Route Pattern section of your CUCM Administration page

Click Add new and complete the pattern required and Gateway/Route List. The image eblow shows a pattern of 7951 being directed to cs-gclabon1.cafex.com

Save the pattern, this step is now complete. In this setup when the exact number 7951 is dialed it will be directed to cs-gclabon1.cafex.com. Equally we could use 79XX which would direct any 4 digit number begining with 79 to cs-gclabon1.cafex.com.

 

Normalization Scripts

Normalization scripts are used to modify SIP message headers sent out using one or more trunks. For interoperability between CUCM and CSDK Gateways a normalization script is needed to apply changes to the Request URI. a standard Request URI sent from CUCM will be in the format:

INVITE sip:7951@cs-gclabon1.cafex.com;5060 SIP/2.0

It is the ;5060 in bold above that the normalization script will remove as CSDK control domains do not, by default, include this suffix meaning the messages sent with this suffix will receive a 404 back from CSDK Gateways. The Request URI, after the normalization script is applied will appear as:

INVITE sip:7951@cs-gclabon1.cafex.com SIP/2.0

 

To configure the normalization script first go to SIP Normalization Script section of the CUCM administration page:

 

Now click Add New, name your script something easily recognisable e.g. fcsdk-gateway script and provide an appropriate description. For content see below.

There are several options for nromalization scripts available, the recommended script is the most basic, this will rewrite the Request URI on SIP messages, replacing everything after the @ symbol in the URI with a substring of the original URI that does not include ;5060.


M = {}
function M.outbound_INVITE(msg)
local method, ruri, ver = msg:getRequestLine()
local uri = string.gsub(ruri, "@(.*):%d+", "@%1")
msg:setRequestUri(uri)
end
return M

Other options include modifying the URIs in the Request URI and to URI fields. Again this is carried out by replacing everything after the @ symbol in the URI with a substring of the original URI that does not include ;5060.

M = {}
function M.outbound_INVITE(msg)
local method, ruri, ver = msg:getRequestLine()
local uri = string.gsub(ruri, "@(.*):%d+", "@%1")
msg:setRequestUri(uri)
local toheader = msg:getHeader("To")
local touri = string.gsub(toheader, "@(.*)>", "@%1>")
msg:modifyHeader("To", touri)
end
return M

Finally it is possible to manually specify the required URI for the CSDK gateway as below:


M = {}
function M.outbound_INVITE(msg)
local method, ruri, ver = msg:getRequestLine()
local uri = string.gsub(ruri, "@(.*):%d+", "@CSDK-ControlDomain.COM")
msg:setRequestUri(uri)
local toheader = msg:getHeader("To")
local touri = string.gsub(toheader, "@(.*)>", "@CSDK-ControlDomain.COM>")
msg:modifyHeader("To", touri)
end
return M

Save your new script.

You will now need to apply this to the trunk from CUCM to your CSDK gateway. Go to trunks:

Scroll down to Normalization Script and select your newly created script from the dropdown menu.

Now save the changes to the Trunk, you will be prompted to reset the trunk, accept this.

 

If you have any queries about this behaviour or need to request access to the latest versions of Cafex software please contact support@cafex.com.

 

 

 

Have more questions? Submit a request

Comments

Powered by Zendesk