Call Us Today! 877.742.2583

Page tree
Skip to end of metadata
Go to start of metadata


Small guide on how Gateways are configured in  FreeSWITCH™.

 Click here to expand Table of Contents


This has been a source of confusion for some, but it's really rather simple.

A bare-bones gateway setup for outbound calls with no username/pass (because you have ACL permission):


SIP gateways can be defined in the directory section _or_ the configuration section. In the default config, there are example gateways defined under the

conf/sip_profiles/external/example.xml file, like so:

and also in the user directory, conf/directory/default/ as well as brian.xml



So, why is it presented 3 different ways?

In a nutshell, the sip_profile declaration puts the gateway in the context of that sip_profile, insofar as when you stop/start/restart that sofia profile the gateway will stop/start/restart with it. In the second case, the default_provider example, the gateway comes up with the default directory (always). And in the final example, the gateway can be made to come up and down only when the user brian is registered.

Gateway Options


Caller ID

If you want the caller ID to be in the "From:", which is CID type=none

Inbound Destination

By default, incoming calls on this gateway will go to the username.

If you want FreeSWITCH to respect the ${sip_to_user}, set the value to "auto_to_user". Be sure you have the context



If this gateway is ONLY for outbound calling, then there's rarely a need to maintain a registration ahead of time.



In addition to the parameters you can optionally set variables to set on either incoming or outgoing calls through this gateway. You set a direction, which sets it on both incoming and outgoing calls if omitted.

IRC Discussions

So should gateways go in configuration or in directory?

This question was answered by anthm a while back on IRC, here is what he said:

What I gather from this is that if you only want certain extensions to be registered with your voip provider when a specific user registers with freeswitch you should define gateways in the directory section rather than in the sofia configuration. Conversely, if you always want an extension registered with a provider you would define the gateway as part of the sip profile. 

See Also

  • No labels

1 Comment

  1. Please note that the "sip-register-gateway" field in the brian.xml sample should be "register-gateway" and is used in conjunction with <param name="register" value="false"/> in the <gateway> section.