, , ,

FreeSWITCH

Getting Started with FreeSWITCH

The below configuration should be used as an example.

Setting up the Gateway
<include>
  <gateway name="surevoip">
    <param name="username" value="[my SureVoIP account number]"/>
  <!--/// account password required by freeswitch but will be ignored if authenticating by IP ///-->
    <param name="password" value="pass"/> 
 
  <!-- proxy name depends on method for authentication -->
    <param name="proxy" value="XXXX.surevoip.co.uk"/>
    <param name="register" value="false"/>
 
  <!--send an options ping every x seconds, failure will unregister and/or mark it down-->
    <param name="ping" value="60"/>
  </gateway>
</include>

:!: Don't forget to start the new gateway on the FreeSWITCH console:

freeswitch> sofia profile external rescan reloadxml

This assumes the gateway was created in the external profile.

Inbound Routing
<include>
  <extension name="inbound_surevoip">
    <condition field="destination_number" expression="^([my SureVoIP phone number])$">
      <action application="set" data="domain_name=$${domain}"/>
      <!-- Our main incoming greeting extension is called 'frontdoor' -->
      <action application="transfer" data="frontdoor XML default"/>
    </condition>
  </extension>
</include>

Example:

<include>
  <extension name="01134960000_Reception">
    <condition field="destination_number" expression="^(01134960000)$">
      <action application="set" data="domain_name=$${domain}"/>
      <!-- Our main incoming greeting extension is called 'frontdoor' -->
      <action application="transfer" data="frontdoor XML default"/>
    </condition>
  </extension>
    <extension name="01134960001_DDI_extension">
    <condition field="destination_number" expression="^(01134960001)$">
      <action application="set" data="domain_name=$${domain}"/>
      <!-- This DDI transfers directly to extension 5001 -->
      <action application="transfer" data="5001 XML default"/>
    </condition>
  </extension>
</include>
Outbound Routing

The below matches the number dialled by an internal extension and routes it out to the gateway (defined above).

This is UK number format. It matches optional 9 prefix and either national significant format or e.164 format (ie 01224900123 or +441224900123).

<include>
  <extension name="UK_Outbound">      
    <condition field="destination_number" expression="^9?(?:0|\+?44)([1-9]\d{8,9})$">
     <!-- effective_caller_id can be set if authenticating by IP and caller ID -->
     <action application="set" data="effective_caller_id_number=[my SureVoIP SIP user account]" />
     <action application="set" data="effective_caller_id_name=[the CLI to display]" />
      <action application="bridge" data="sofia/gateway/surevoip/44$1" />
    </condition>
  </extension>
</include>

International dialling, with optional 9 prefix. Number to call must have either + or 00 to indicate international number.

<include>
  <extension name="Intl_Outbound">      
    <condition field="destination_number" expression="^9?(?:00|\+)([1-9]\d{6,19})$">
     <!-- effective_caller_id can be set if authenticating by IP and caller ID -->
     <action application="set" data="effective_caller_id_number=[my SureVoIP SIP user account]" />
     <action application="set" data="effective_caller_id_name=[the CLI to display]" />
      <action application="bridge" data="sofia/gateway/surevoip/$1" />
    </condition>
  </extension>
</include>

Emergency dialling, includes 999 and 112 and non-emergency including 101, 105, 111, 116xxx with optional 9 prefix.

<include>
  <extension name="Emergency_Outbound">      
    <condition field="destination_number" expression="^9?(999|112|101|105|111|116\d{3})$">
     <!-- effective_caller_id can be set if authenticating by IP and caller ID -->
     <action application="set" data="effective_caller_id_number=[my SureVoIP SIP user account]" />
     <action application="set" data="effective_caller_id_name=[the CLI to display]" />
      <action application="bridge" data="sofia/gateway/surevoip/$1" />
    </condition>
  </extension>
</include>

Further Reading