FreeSWITCH through the Ip_trunk Way and Datang Gateway connection, Datang Gateway connected outside line, through the number prefix 9 dial outside line, FreeSWITCH through Datang Gateway and external line connection.
1. Modify FreeSWITCH
(1) Modify FreeSWITCH to add Datang Gateway, refer to the following article:
Http://wiki.freeswitch.org/wiki/Clarification:gateways
(2) Change the dialing rule of outgoing calls DialPlan
2. Modify Datang Gateway
(1) Modifying IP routing
Outside the line number before adding 9,ip point to FreeSWITCH
(2) Modify the called
Swallow Phone number prefix 9
(3) Modify the Calling
FreeSWITCH registration number 4 bits such as 1010, then the main call Delete 4 bits, and customize a 8-digit number as the call center unified calling Number
Link Original
Http://wiki.freeswitch.org/wiki/Clarification:gateways
Clarification:gateways
Introduction
This have been a source of confusion for some, but it's really rather simple.
A bare-bones Gateway Setup for outbound calls and no Username/pass (because you have ACL permission):
<include>
<gateway name= "Provider" >
<param name= "proxy" value= "199.96.248.140"/>
<param name= "Register" value= "false"/>
<param name= "Caller-id-in-from" value= "true"/> <!--most gateways seem to want this-->
<param name= "username" value= "not-used"/>
<param name= "Password" value= "not-used"/>
</gateway>
</include>
SIP gateways can defined in the directory sections _or_ the configuration section. In the default Config, there is example gateways defined under the
Conf/sip_profiles/external/example.xml
File, like so:
<include>
<!--<gateway name= "asterlink.com" >-->
<!--//account username *required*///-->
<!--<param name= "username" value= "Cluecon"/>-->
<!--//auth realm: *optional* same as gateway name, if blank///-->
<!--<param name= "Realm" value= "asterlink.com"/>-->
<!--//username to use on from: *optional* same as username, if blank///-->
<!--<param name= "From-user" value= "Cluecon"/>-->
<!--///domain to use with from: *optional* Same as realm, if blank; Can also BES set to "Auto-aleg-full" or "Auto-aleg-domain"///-->
<!--<param name= "From-domain" value= "asterlink.com"/>-->
<!--//account password *required*///-->
<!--<param name= "password" value= "/>-->"
<!--//extension for inbound calls: *optional* Same as username, if blank. To use what ' s in ${sip_to_user}, set it to the value "Auto_to_user"///-->
<!--<param name= "extension" value= "Cluecon"/>-->
<!--//proxy host: *optional* same as Realm, if blank///-->
<!--<param name= "proxy" value= "asterlink.com"/>-->
<!--///Send register to this proxy: *optional* same as proxy, if blank///-->
<!--<param name= "Register-proxy" value= "mysbc.com"/>-->
<!--//expire in seconds: *optional* 3600, if blank///-->
<!--<param name= "expire-seconds" value= "/>-->"
<!--//do not register///-->
<!--<param name= "register" value= "false"/>-->
<!--which transport to use for register--
<!--<param name= "register-transport" value= "UDP"/>-->
<!--How many seconds before a retry when a failure or timeout occurs-
<!--<param name= "retry-seconds" value= "/>-->"
<!--Use the CallerID of a inbound call in the From field on outbound calls via this gateway--
<!--<param name= "Caller-id-in-from" value= "false"/>-->
<!--extra SIP params to send in the contact-->
<!--<param name= "Contact-params" value= "Tport=tcp"/>-->
<!--send an options ping every x seconds, failure'll unregister and/or mark it down-->
<!--<param name= "ping" value= "/>-->"
<!--</gateway>-->
</include>
And also in the user directory, conf/directory/default/example.com.xml as well as Brian.xml
Conf/directory/default/example.com.xml
<!--
Shell provider account should work with most providers.
-
<include>
<user id= "$${default_provider}" >
<gateways>
<gateway name= "$${default_provider}" >
<param name= "username" value= "$${default_provider_username}"/>
<param name= "Password" value= "$${default_provider_password}"/>
<param name= "From-user" value= "$${default_provider_username}"/>
<param name= "From-domain" value= "$${default_provider_from_domain}"/>
<param name= "expire-seconds" value= "/>"
<param name= "register" value= "$${default_provider_register}"/>
<param name= "retry-seconds" value= "/>"
<param name= "extension" value= "$${default_provider_contact}"/>
<!--<param name= "Contact-params" value= "Domain_name=$${domain}"/>-->
<param name= "Context" value= "public"/>
</gateway>
</gateways>
<params>
<param name= "Password" value= "$${default_provider_password}"/>
</params>
</user>
</include>
Conf/directory/default/brian.xml
<include>
<!--
Ipauth If you have a cidr= in the user attributes ie Cidr= "1.2.3.4/32"
See <node type= ' Allow ' domain= ' $${domain} '/> in default Acl.conf.xml
-
<user id= "Brian" Cidr= "192.0.2.0/24" >
<!--Outbound registrations related to this user--
<gateways>
<!--<gateway name= "asterlink.com" >-->
<!--//account username *required*///-->
<!--<param name= "username" value= "Cluecon"/>-->
<!--//auth realm: *optional* same as gateway name, if blank///-->
<!--<param name= "Realm" value= "asterlink.com"/>-->
<!--//username to use on from: *optional* same as username, if blank///-->
<!--<param name= "From-user" value= "Cluecon"/>-->
<!--///domain to use with from: *optional* Same as Realm, if blank///-->
<!--<param name= "From-domain" value= "asterlink.com"/>-->
<!--//account password *required*///-->
<!--<param name= "password" value= "/>-->"
<!--///Replace the INVITE from user with the channel ' s Caller-id///-->
<!--<param name= "Caller-id-in-from" value= "false"/>-->
<!--//extension for inbound calls: *optional* Same as username, if blank///-->
<!--<param name= "extension" value= "Cluecon"/>-->
<!--//proxy host: *optional* same as Realm, if blank///-->
<!--<param name= "proxy" value= "asterlink.com"/>-->
<!--///Send register to this proxy: *optional* same as proxy, if blank///-->
<!--<param name= "Register-proxy" value= "mysbc.com"/>-->
<!--//expire in seconds: *optional* 3600, if blank///-->
<!--<param name= "expire-seconds" value= "/>-->"
<!--//do not register///-->
<!--<param name= "register" value= "false"/>-->
<!--which transport to use for register--
<!--<param name= "register-transport" value= "UDP"/>-->
<!--How many seconds before a retry when a failure or timeout occurs-
<!--<param name= "retry-seconds" value= "/>-->"
<!--Use the CallerID of a inbound call in the From field on outbound calls via this gateway--
<!--<param name= "Caller-id-in-from" value= "false"/>-->
<!--extra SIP params to send in the contact-->
<!--<param name= "Contact-params" value= "Tport=tcp"/>-->
<!--send an options ping every x seconds, failure'll unregister and/or mark it down-->
<!--<param name= "ping" value= "/>-->"
<!--</gateway>-->
</gateways>
<params>
<!--omit password for authless registration--
<param name= "Password" value= "$${default_password}"/>
<param name= "Vm-password" value= "9999"/><!--if Vm-password is omitted password param is used-->
<!--<param name= "email-addr" value= "me@mydomain.com"/>-->
<!--<param name= "Vm-delete-file" value= "true"/>-->
<!--<param name= "Vm-attach-file" value= "true"/>-->
<!--<param name= "Vm-mailto" value= "me@mydomain.com"/>-->
<!--<param name= "Vm-email-all-messages" value= "true"/>-->
<!--Optionally use this instead if you want to store the hash of user:domain:pass-->
<!--<param name= "A1-hash" value= "c6440e5de50b403206989679159de89a"/>-->
<!--What's this user was allowed to acces--
<!--<param name= "Http-allowed-api" value= "Jsapi,voicemail,status"/>--
</params>
<variables>
<!--all variables, here would be, set on all inbound calls, originate from this user--
<variable name= "User_context" value= "Default"/>
<variable name= "Effective_caller_id_name" value= "Brian West"/>
<variable name= "Effective_caller_id_number" value= "/>"
<!--Don ' t write a CDR If this is false valid values Are:true, False, A_leg and B_leg--
<variable name= "Process_cdr" value= "true"/>
<!--Sip_secure_media would offer mandatory SRTP on invite aes_cm_128_hmac_sha1_32, aes_cm_128_hmac_sha1_80 or TRUE--&G T
<variable name= "Sip_secure_media" value= "true"/>
<!--limit the max number of outgoing calls for this user--
<!--<variable name= "Max_calls" value= "2"/>-->
<!--send presence information if FS is configured
<!--<variable name= "presence_id" value= "1000@$${domain}"/>-->
<!--set these to take advantage of a dialplan localized to this user--
<!--<variable name= "Numbering_plan" value= "US"/>-->
<!--<variable name= "Default_area_code" value= "434"/>-->
<!--<variable name= "Default_gateway" value= "asterlink.com"/>-->
<!--
Ndlb-connectile-dysfunction-rewrite Contact IP and port
Ndlb-tls-connectile-dysfunction-rewrite Contact Port only.
-
<!--<variable name= "sip-force-contact" value= "Ndlb-connectile-dysfunction"/>-->
<!--<variable name= "Sip-force-expires" value= "ten"/>-->
<!--<variable name= "Sip-register-gateway" value= "cluecon.com"/>-->
<!--Set The file format for a specific user--
<!--<variable name= "Vm_message_ext" value= "MP3"/>--
</variables>
<vcard>
<!--Insert Optional compliant vcard XML here-->
</vcard>
</user>
</include>
Clarification
So, what is it presented 3 different ways?
In a nutshell, the Sip_profile declaration puts the gateway in the context of the. Sip_profile, insofar as when you stop/s Tart/restart that Sofia profile The gateway would stop/start/restart with it. In the second case, the Default_provider example, the gateway comes to the default directory (always). And in the final example, the gateway can being made to come up and down if the user Brian is registered.
Gateway Options
Params
Caller ID
If you want the caller ID of the ' From: ', which is CID Type=none
<param name= "Caller-id-in-from" value= "true"/>
Inbound Destination
By default, incoming calls on this gateway would go to the username.
If you want FreeSWITCH to respect the ${sip_to_user}, set the value to "Auto_to_user". Be sure the context
<param name= "extension" value= "Auto_to_user"/>
Registration
If This gateway was only for outbound calling, then there's rarely a need to maintain a registration ahead of time.
<param name= "Register" value= "false"/>
Variables
In addition to the parameters you can optionally set variables to set on either incoming or outgoing calls through this GA Teway. You set a direction, which sets it on both incoming and outgoing calls if omitted.
<gateway>
.... Params ...
<variables>
<variable name= "Inbound_var_name" value= "This is inbound" direction= "Inbound"/>
<variable name= "Outbound_var_name" value= "This is outbound" direction= "Outbound"/>
<variable name= "Both_var_name" value= "This on any direction"/>
</variables>
</gateway>
IRC Discussions
So should gateways go to configuration or in directory?
This question were answered by anthm A and back on IRC, here's what he said:
<branchcut> me too ...
<rpm> my gateway is defined in Sofia.conf.xml not in Directory.xml
<branchcut> I ' m kinda confused by the fact it can be defined in both places. Whats the difference?
<anthm> Enterprise vs Shuttlecraft
<[intra]lanman> lol
<branchcut> heh
<anthm> If you put them in a user tags in your directory you can and tell Sofia to manage the whole
Domain and it would iterate all the users on that domain and reg the gateways
<anthm> If you don ' t need so can just put them in the Sofia Conf
What I gather from this is so if you are want certain extensions to being registered with your VoIP provider when a SPECIF IC User registers with FreeSWITCH-should define gateways in the directory sections rather than in the Sofia Configurati On. Conversely, if you are want an extension registered with a provider you would define the gateway as part of the SIP Pro File.