Telephone system:FreeSWITCH tricks

From Hackerspace ACKspace
Jump to: navigation, search

This page provides a couple of tricks to ease working and debugging with FreeSWITCH

config snippets

dial by incoming domain

Typically, FreeSWITCH only looks at the destination number, so is treated the same as in the public dialplan.

This snippet routes all calls destined to either the domain or the illegaleshow extension to 1200 in its own dialplan.

Note that there aren't many sip_to_host examples on the net (or the less predictable alternative sip_req_host for that matter, also see this stackoverflow thread):

  • req or Request Uri is where the INVITE goes (he next hop address, a proxy if you will)
  • To Uri is the actual destination to call
  <extension name="Illegale show">
    <condition regex="any">
      <!-- sip_req_host -->
      <regex field="${sip_to_host}" expression=""/>
      <regex field="destination_number" expression="^illegaleshow$"/>

      <action application="set" data=""/>
      <action application="transfer" data="1200 XML illegaleshow"/>

You only need to set some DNS SRV records and you're off to go: 384 IN SRV 10 20 5060 384 IN SRV 10 20 5060

Verify that they're active with: dig -t srv

dial-string for Skinny and SIP


command line examples

You can run command line commands either as fs_cli -x "COMMAND" or by running the command line interface fs_cli and typing the COMMAND there

user_exists and user_data

Note that directory users have an id and optionally, a number-alias. Both can be used to register and check if it exists in the directory.

Typical for desk phones:

user_exists id 101

Typical for soft-phones (SIP client):

user_exists id slackspace

Number from name or number

user_data attr number-alias and user_data attr number-alias

Name from name or number

user_data attr id and user_data attr id

Group call information:


Note that for both number and name group calling, you need two identical groups.

dial-string and sofia_contact

There is a user/ endpoint that uses the user's (or more regularly, the directory domain's) dial-string value to lookup the dial string address of the dialed user. This string usually contains the sofia_contact command:


Note: the contact URI only works on the registered user (use a number instead of a name if the user registered numerically; it happens, see Fritz!Box)

You can call a user by using: originate user/ 09008002 xml ackspace or originate user/ 09008002 xml ackspace. Also, to inject variables like experimenting with callerid, you can use: originate {caller_id_number=31457112345}user/ xopr xml public