This article comes from CSDN LIDP HTTP://BLOG.CSDN.NET/PERFECTPDL, reprint indicates the source, thanks .
I built a Freeswitch core research Exchange Group, 45211986, Welcome to join, in addition, the provision of SIP based communication server and client solutions,
Clients registered to FreeSWITCH can dial each other, but what happens when the client wants to call through the FreeSWITCH to clients who are not registered to the FreeSWITCH. This requires FreeSWITCH links to external gateways, such as those with another SIP server or a PSTN-tested carrier network. FreeSWITCH the introduction of the gateway to deal with the problem of external links.
The gateway configured in FreeSWITCH is registered to another SIP server at system startup, similar to the SIP client registration to FreeSWITCH.
Configuring a gateway typically requires a username, password, and the IP address of the SIP server to which you want to register.
Gateway-related configuration saved in directory/conf/sofia_profiles/external
/usr/local/freeswitch/conf/sip_profiles/external.xml the global configuration for FreeSWITCH to be registered to another gateway as a client,
A gateway can be added to the/usr/local/freeswitch/conf/sip_profiles/external/directory.
For example, add registration to Asterisk Gateway,/usr/local/freeswitch/conf/sip_profiles/external/reg_to_asterisk.xml
Reg_to_asterisk.xml content:
<include>
<gatewayname= "Asterisk" >
<paramname= "username" value= "FreeSWITCH"/>
<paramname= "Password" value= "FreeSWITCH"/>
<paramname= "Realm" value= "demo.asterisk.org"/>
<paramname= "proxy" value= "demo.asterisk.org"/>
</gateway>
</include>
~
Save, console reboot Sipprofile
Freeswitch@openser-dev>sofia Profile External Restart
2012-08-18 20:21:47.254868[info] mod_enum.c:871 enum Reloaded
2012-08-18 20:21:47.254868[info] switch_time.c:1163 Timezone Reloaded 530 Definitions
Reload XML [Success]
Restarting:external
Freeswitch@openser-dev>2012-08-18 20:21:47.295211 [NOTICE] sofia.c:2500 waiting for worker thread
2012-08-18 20:21:47.956692[notice] sofia_glue.c:5707 deleted gateway example.com from profile external
2012-08-18 20:21:47.956692[notice] sofia.c:5202 started profile external [sofia_reg_external]
2012-08-18 20:21:47.984023[notice] sofia_reg.c:2944 Added Gateway ' asterisk ' to profile ' external '
2012-08-18 20:21:47.984023[notice] sofia_reg.c:2944 Added Gateway ' example.com ' to profile ' external '
2012-08-18 20:21:49.975233[notice] sofia_reg.c:415 registering asterisk
Freeswitch@openser-dev>
Freeswitch@openser-dev>
View registration Status
Freeswitch@internal> Sofiastatus
Name Type Data State
=================================================================================================
Internal-ipv6 profile sip:mod_sofia@[::1]:5060 RUNNING (0)
Internal profile sip:mod_sofia@192.168.16.111:5060 RUNNING (0)
External profile sip:mod_sofia@192.168.16.111:5080 RUNNING (0)
external::example.com Gateway sip:joeuser@example.com Noreg
External::asterisk Gateway sip:freeswitch@demo.asterisk.org Trying (retry:never)
192.168.16.111 alias Internal aliased
=================================================================================================
3 Profiles 1 Alias
A. Exhale through gateways
Need to modify DialPlan, add Route_to_asterisk.xml in conf/dialplan/default/directory
<include>
<extension name= "Dial out Asteriskgateway" >
<condition field= "Destination_number" expression= "^9 (one) $" >
<actionapplication= "Bridge" data= "sofia/gateway/asterisk/$1"/>
</condition>
</extension>
</include>
FS_CLI executes Reloadxml, the client calls 911, and the call is routed to the Asterisk gateway.
B. Receiving a call from a gateway
Usually, for those unauthenticated calls, FreeSWITCH is considered unsafe, including calls from gateways, FreeSWITCH will route such calls to the Publicdialplan context.
/usr/local/freeswitch/conf/dialplan/public.xml the DialPlan for this type of call, you can
/usr/local/freeswitch/conf/dialplan/public/directory add corresponding gateway sent over DialPlan
Such as:
Vim/usr/local/freeswitch/conf/dialplan/public/asterisk.xml
<include>
<extensionname= "Asterisk-inbound" >
<condition field= "Destination_number"
expression= "^ (FreeSWITCH) $" >
<actionapplication= "Set" Data= "Domain_name=$${domain}"/>
<actionapplication= "Transfer" data= "1000 XML Default"/>
</condition>
</extension>
</include>
When the asterisk sent over the call number for FreeSWITCH registered to the asterisk on the user number, FreeSWITCH transferred to its user 1000.
(3) Do not need to manually configure the gateway, but with external links
If the external gateway requires diguest authentication, you need to configure the gateway on the FreeSWITCH, if the external gateway does not need Digesut authentication, then freeswitch the process in manual configuration (2), some gateways through IP authentication, this way is relatively simpler, But not as safe as in (2).
Like in Default.xmldialplan.
<actionapplication= "Bridge" data= "sofia/${use_profile}/$1@conference.freeswitch.org"/>
That is, through the Internalsip profile sent to the freeswitch.org of the network closed.
Welcome to add:)