Monthly Archives: December 2012

Freeswitch Integration with Telecom Carrier

This articles is a follow up of the earlier freeswitch capability introduction and some generic usecases around dialplans and contexts. This post contains instructions on how to integrate your SIP VOIP Freeswitch server to ITSP ( Internet Telephony Service Providers) which are basically part of large telecommunications companies.

First we check the external profile via sofia status . We should’ve configured the internal ip to listen to domain address or public ip. The external profile on port 5080 is used for outgoing and incoming connections .

Screen Shot 2018-09-28 at 9.32.31 AM

Create a user profile for interacting with outside world

<user id="1001">
<param name="password" value="pass1234"/>

Next we should try and register any sip softphone with the freeswitch server . I used Xlite , screenshot below

Screen Shot 2018-09-28 at 9.30.07 AM

Configuring a SIP gateway  in sip_profiles -> external

Goto /usr/src/freeswitch-debs/freeswitch/conf/vanilla/sip_profiles/external and create a profile such as telco_profile.xml

<gateway name="telcoCompany">
<param name="realm" value=""/>
<param name="username" value="admin"/>
<param name="password" value="123456"/>
<param name="register" value="true"/>

and add the bridge to dialplan under usage

<extension name="telco gateway bridge">
<condition field="destination_number" expression="^(\d{10})$">
<action application="bridge" data="sofia/gateway/telcoCompany/$1"/>

note $1 contains the dialled number which will be passed to bridge to telcoCompany gateway. Therefore to add prefix for USA use +1$1 or for India +91$1 (  E.164 format) or some inline variable such as ${customercode}$1

After adding reloadxml and also run sofia profile external rescan to let freeswitch find the gateways

Monitoring gateways using OPTIONS

<param name="ping" value="20"/&gt;

Codec Negotiation 

Late negotiations reduces re-sampling and codec changes

<param name="inbound-late-negotiation" value="true"/>

Other dial plan variables can also be set such as absolute_codec_string, inherit_codec , ep_codec_string. To avoid any codec negotiation on SDP use bypass_media=true .

<param name="inbound-codec-prefs" value="${global_codec_prefs}"/>
<param name="outbound-codec-prefs" value="${outbound_codec_prefs}"/>
<param name="inbound-codec-negotiation" value="generous"/>

CDR ( Call Detail Records )

can be used with modules mod_xml_cdr , mod_csv_cdr , mod_cdr_mongodb, mod_odbc_cdr , mod_cdr_pg_csv , mod_cdr_sqlite , mod_json_cdr , mod_radius_cdr

<configuration name="cdr_csv.conf" description="CDR CSV Format">
<!-- 'cdr-csv' will always be appended to log-base -->
<!--<param name="log-base" value="/var/log"/>-->
<param name="default-template" value="example"/>
<!-- This is like the info app but after the call is hung up -->
<!--<param name="debug" value="true"/>-->
<param name="rotate-on-hup" value="true"/>
<!-- may be a b or ab -->
<param name="legs" value="a"/>
<!-- Only log in Master.csv -->
<!-- <param name="master-file-only" value="true"/> -->
<template name="sql">INSERT INTO cdr VALUES ("${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}");</template>

event socket library (ESL)




Call Between Web client and SIP client

  1. HTML5 and WebRTC enabled Web Client :

We are using open source HTML5 SIP client entirely written in javascript to make it light and to have easy integration with the SIP server. No extension, plugin or gateway is needed to initiate the call from the web Client. The media stack rely on WebRTC. The client can be used to connect to any SIP or IMS network from HTML5 and WebRTC enabled browser to make and receive audio/video calls and instant messages.

  1.  Proxy Server / WS to UDP Translator :

For the Proposed Solution we are proposing the Freeware light SIP – Server which besides acting like the normal Sip Server and Registrar can also act like the Translator Engine to convert the SIP over WS message to SIP over UDP. As one of the requirement we need to terminate the call on the hard-phone like Turret which supports only SIP over UDP we need to have the translator in the overall picture which can convert the SIP over WS request to SIP over UDP. Through this component the use case like initiating the call from the web Browser the terminating the call at the Hard-phone is possible.

  1. Soft Phone/ SIP  Client :

We are using the Boghe IMS client to act like the Soft phone which supports the Audio Codec required to talk with web Client like PCMU And PCMA audio Codec.

Working on the discussed Components we have successfully established the following Use- Case Scenario.

  1. Call Initiated from the Browser and Terminated on Browser :

(a)   Signalling Part – Initial Handshake is done and Call is established. (Captured from Wire-Shark)

(b)   Media Part – SDP is being exchanged as capture by Wire-shark and both the client can exchange Voice.

  1. Call initiated from the Browser and Terminated on the Softphone and Vice-Vera :

(a)    Signalling Part – Initial Handshake is done and Call is established. (Captured from Wire-Shark)

(b)   Media Part – SDP is being exchanged as capture by Wire-shark and both the client can exchange Voice but have some dependency on machine being used.

  1. Call initiated from the Softphone and Terminating on SoftPhone.

(a)   Signalling Part : Initial Handshake is done and Call is established. (Captured from Wire-Shark)

(b)   Media Part : No hiccup its working fine.

The structure for multi network traversal using ICE – STUN and TURN is described in the following diagram .

Call Between Web client and SIP client (1)

You can read more about NAT traversal using STUN and TURN here .

Detailed TURN server for WebRTC – RFC5766-TURN-Server , Coturn , Xirsys is here .