FreeSWITCH: “From” domain name in outbound calls

This feature is difficult to find in documentation,  so I had to look into mod_sofia sources.

For outgoing SIP calls to other public domains in the Internet, you want to set your host name in From: address so, that the called party would be able to call back. By default the remote party would see the call as coming from username@<ipaddress>, which is usually not usable for calling back.

The channel variable “sip_invite_domain” does the trick and sets the correct From domain.

So, in “conf/dialplan/default/99_internet_voip_outbound.xml“, the following example sets the From domain name to “pub.example.com” and optionally sets the caller ID from a user variable “public_sip_caller_username”. The matching pattern allows only addresses starting with a letter, because leading digits are usually used for the local dialplan.

<include>
  <extension name="internet_voip_outbound">
    <condition field="${sip_to_uri}" expression="^([a-z][0-9a-z-]*\@[0-9a-z.-]+)$">
      <action application="set" data="internet_destination=$1"/>
    </condition>

    <condition field="${public_sip_caller_username}" expression="^(.+)$" break="never">
      <action application="set" data="effective_caller_id_number=$1"/>
    </condition>

    <condition>
      <action application="bridge"
         data="{sip_invite_domain=pub.dvop.net}sofia/external/${internet_destination}"/>
    </condition>
  </extension>
</include>
Advertisements

, ,

  1. #1 by sean on February 22, 2016 - 6:38 am

    Hi,

    YES, finally a working solution. I was wasting my time poking around in conf/dialplan/default.xml

    There’s tons of channel variables: https://freeswitch.org/confluence/display/FREESWITCH/Channel+Variables but I found it difficult to know the correct one to use.

    Thanks for this article.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: