FreeSWITCH configuration

#1
I've just set up my development server for FreeSWITCH and thought others might benefit from this, or have comments to help make this better.

This example is for UK-based dialling, where extension users dialling 0xxxx will cause that external number to be called. Numbers preceded by 9 will have the leading 9 dropped before being dialled. Incoming calls are transferred to 1002 in the XML dialplan. Dummy values of voipfone username (30123456) and password (654321) are used.

The files to be modified are found in /usr/local/freeswitch/conf/ (tar ball builds) or /etc/freeswitch/ (debian package builds). I don't know of any other locations; I haven't used other versions.

sip_profiles/external/voipfone.xml

Code: Select all

<include>
  <gateway name="voipfone">
    <param name="username" value="30123456"/>
    <param name="realm" value="sip.voipfone.net"/>
    <param name="password" value="654321"/>
    <param name="extension" value="voipfone-incoming"/>
    <param name="expire-seconds" value="60"/>
  </gateway>
</include>
dialplan/default/01_voipfone_out.xml

Get rid of the default example.com by deleting it or renaming it to 01_example.com._xml_ or anything that doesn't end in .xml otherwise it might clash with this:

Code: Select all

<include>
  <extension name="local.voipfone">
    <condition field="${toll_allow}" expression="local"/>
    <condition field="destination_number" expression="^9(\d+)$">
      <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
      <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
      <action application="bridge" data="sofia/gateway/voipfone/$1"/>
    </condition>
  </extension>

  <extension name="domestic.voipfone">
    <condition field="${toll_allow}" expression="domestic"/>
    <condition field="destination_number" expression="^(0[1-9]\d+)$">
      <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
      <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
      <action application="bridge" data="sofia/gateway/voipfone/$1"/>
    </condition>
  </extension>

  <extension name="international.voipfone">
    <condition field="${toll_allow}" expression="international"/>
    <condition field="destination_number" expression="^(00\d+)$">
      <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
      <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
      <action application="bridge" data="sofia/gateway/voipfone/$1"/>
    </condition>
  </extension>

</include>
dialplan/public/01_inbound_voipfone.xml

Code: Select all

<include>
  <extension name="voipfone-incoming">
    <condition field="destination_number" expression="^voipfone-incoming$"/>
    <!-- Only allow calls from Voipfone -->
    <condition field="network_addr" expression="^195\.189\.173\.27$">
      <anti-action application="info" />
      <action application="set" data="domain_name=$${domain}"/>
      <action application="log" data="INFO Voipfone incoming: ${caller_id_number}/${caller_id_name}" />
      <!-- This example transfers voipfone to 1002 in the default context -->
      <action application="transfer" data="1002 XML default"/>
    </condition>
  </extension>
</include>

Re: FreeSWITCH configuration

#2
I know this an old post but I was hoping somebody could help

I've followed these instructions. FreeSWITCH recognises I'm calling the number but never routes it through the extension. I can call internally (1000 to 1001) but I seem to be having trouble actually getting the external call transferred to the extension.

Code: Select all

2015-06-13 09:59:59.184795 [NOTICE] switch_channel.c:1075 New Channel sofia/external/07935101580@195.189.173.27 [21d1b69f-d52d-4cce-b934-a8df2ad085c1]
2015-06-13 09:59:59.184795 [INFO] mod_dialplan_xml.c:635 Processing 079351xxxx <079351xxxx>->voipfone-incoming in context public
2015-06-13 09:59:59.184795 [NOTICE] switch_core_state_machine.c:315 sofia/external/079351xxxx@195.189.173.27 has executed the last dialplan instruction, hanging up.
2015-06-13 09:59:59.184795 [NOTICE] switch_core_state_machine.c:317 Hangup sofia/external/079351xxxxx0@195.189.173.27 [CS_EXECUTE] [NORMAL_CLEARING]
2015-06-13 09:59:59.184795 [NOTICE] switch_core_session.c:1641 Session 3 (sofia/external/079351xxxx@195.189.173.27) Ended
2015-06-13 09:59:59.184795 [NOTICE] switch_core_session.c:1645 Close Channel sofia/external/0793510xxxx@195.189.173.27 [CS_DESTROY]

I've tried adding <action application="log" data="passed transfer"/> after the 1000 XML transfer line but it doesn't seem to log it. Phone call will just beep (it did put me through to voipfone voicemail before I disabled it).

Any suggestions?

Re: FreeSWITCH configuration

#3
A few tips that might help.
  • Set log level to debug. In fs_cli:

    Code: Select all

    freeswitch@internal> console loglevel debug
  • Make sure you understand the difference between dialplan parsing and dialplan execution. Some commands produce log entries during parsing, and some during execution.
  • If you think that there might be a SIP-related problem, you can log SIP transactions:

    Code: Select all

    freeswitch@internal> sofia global siptrace on
  • If you have a large log file or config file, a pastebin is a good thing to use; it keeps your posts uncluttered and colourises the file. https://pastebin.freeswitch.org/ will colourise FreeSWITCH log files as well as many other formats.
Hope this helps.

Who is online

Users browsing this forum: No registered users and 0 guests

Copyright 2004 - 2017, iNet Telecoms® Ltd. All rights reserved.


cron