Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

170.9. 网关配置

参考 /etc/freeswitch/sip_profiles/external/example.xml 文件

			
[root@netkiller ~]# cat /etc/freeswitch/sip_profiles/external/example.xml
<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 in from: *optional* same as  username, if blank ///-->
  <!--<param name="from-user" value="cluecon"/>-->
  <!--/// domain to use in from: *optional* same as  realm, if blank ///-->
  <!--<param name="from-domain" value="asterlink.com"/>-->
  <!--/// account password *required* ///-->
  <!--<param name="password" value="2007"/>-->
  <!--/// 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="60"/>-->
  <!--/// 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="30"/>-->
  <!--Use the callerid of an 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=""/>-->
  <!-- Put the extension in the contact -->
  <!--<param name="extension-in-contact" value="true"/>-->
  <!--send an options ping every x seconds, failure will unregister and/or mark it down-->
  <!--<param name="ping" value="25"/>-->
  <!--<param name="cid-type" value="rpid"/>-->
  <!--rfc5626 : Abilitazione rfc5626 ///-->
  <!--<param name="rfc-5626" value="true"/>-->
  <!--rfc5626 : extra sip params to send in the contact-->
  <!--<param name="reg-id" value="1"/>-->
  <!--</gateway>-->
</include>
			
		

配置网关

			
[root@netkiller ~]# cat > /etc/freeswitch/sip_profiles/external/hamsoverip.xml <<EOF
<include>
	<gateway name="hamsoverip.com">
		<param name="username" value="300177"/>
		<param name="realm" value="pbx-ap.hamsoverip.com:5160"/>
		<param name="password" value="178aee323ef95"/>
		<param name="register" value="true"/>
		<param name="register-transport" value="udp"/>
	</gateway>
</include>
EOF
			
		

配置拨号规则

			
[root@netkiller ~]# cat > /etc/freeswitch/dialplan/default/hamsoverip.com.xml <<"EOF"
<include>
	<extension name="hamsoverip.com">
		<condition field="destination_number" expression="^300(\d+)$">
			<action application="bridge" data="sofia/gateway/hamsoverip.com/300$1"/>
		</condition>
	</extension>
</include>
EOF
			
		

再举一个例子, 0 作为外拨号码

			
cat > /etc/freeswitch/sip_profiles/external/netkiller.xml <<EOF
<include>
	<gateway name="netkiller.cn">
		<param name="username" value="6000"/>
		<param name="realm" value="sip.netkiller.cn:5060"/>
		<param name="password" value="6000"/>
		<param name="register" value="true"/>
		<param name="register-transport" value="udp"/>
	</gateway>
</include>
EOF

cat > /etc/freeswitch/dialplan/default/netkiller.cn.xml <<"EOF"
<include>
	<extension name="netkiller.cn">
		<condition field="destination_number" expression="^0(\d+)$">
			<action application="bridge" data="sofia/gateway/netkiller.cn/$1"/>
		</condition>
	</extension>
</include>
EOF