Freeswitch SIP Trunk 配置(网关gateway配置)

专注三网融合之接入网/核心网等技术,音视频信令和媒体传输相关协议,关注前沿技术 专家前辈入驻,谈笑有鸿儒,往来无白丁,共同学习探讨IMS/IPPBX相关技术

欢迎同行加入IMS/IPPBX/VoIP/SIP QQ交流群:255404741(猛戳直接加群)


查看freeswitch 默认sip trunk配置,即所谓的default_provider
freeswitch@internal> sofia status profile
    Profile::Gateway-Name Data State IB Calls(F/T) OB Calls(F/T)
=================================================================================================
    external::example.com sip:joeuser@example.com NOREG 0/0 0/0
=================================================================================================
1 gateway: Inbound(Failed/Total): 0/0,Outbound(Failed/Total):0/0
freeswitch@internal>


查看example.com到底在那些文件里配置了
[root@localhost conf]# find . ! -wholename "*.svn*" | xargs grep -n --color=auto "example.com"
./dialplan/default/01_example.com.xml:3: <extension name="local.example.com">
./dialplan/default/01_example.com.xml:12: <extension name="domestic.example.com">
./dialplan/default/01_example.com.xml:21: <extension name="international.example.com">
./dialplan/default.xml:336: This extension is used by mod_portaudio so you can pa call sip:someone@example.com
./autoload_configs/erlang_event.conf.xml:8: eg. freeswitch@example or freeswitch@example.com.
./vars.xml:262: These are for conf/directory/default/example.com.xml
./vars.xml:264: <X-PRE-PROCESS cmd="set" data="default_provider=example.com"/>
./vars.xml:267: <X-PRE-PROCESS cmd="set" data="default_provider_from_domain=example.com"/>
[root@localhost conf]#

(这些文件和配置之间的关系有待继续研究...)

sip trunk基本原理

    注册到freeswitch的internal内部终端之间显然可以互相拨打,比如公司内部话机可以互相通话。但公司内部话机要想主动跟外部话机通话怎么办?这是就需要进过公司软交换中心跟external外部建立通信链路,而软交换中心跟external外部建立得通信链路可以是SIP或者PSTN的运营商网络链接。Freeswitch引入所谓网关概念来处理与外部链接问题,这种链路一般称之为Trunk,故对应的有SIP Trunk和PSTN Trunk。

    在Freeswitch中配置在系统启动时注册到另一个sip服务器(即配置文件中所谓的gateway),此时Freeswitch作为一个sip client,跟其下面SIP终端注册到freeswitch是一样的。跟SIP终端一样,配置注册到网关需要用户名,密码,以及要注册到的sip服务器ip地址和端口等参数。

注册到网关的相关配置保存在目录/conf/sofia_profiles/external,/usr/local/freeswitch/conf/sip_profiles/external.xml为freeswitch作为客户端注册到另一个网关的全局配置,/usr/local/freeswitch/conf/sip_profiles/external/目录下可以添加多个网关。


sip trunk注册配置

添加注册到imclub.com的sip server上,增加imsclub.com_sip_trunk.xml内容

/usr/local/freeswitch/conf/sip_profiles/external/imsclub.com_sip_trunk.xml

<include>
    <gateway name="imsclub.com">
        <param name="username" value="1019"/>
        <param name="password" value="1234"/>
        <param name="realm" value="imsclub.com"/>
        <param name="proxy" value="imsclub.com"/>
    </gateway>
</include>
说明:
1. 以上是基本配置,还有其他配置可参考example.xml
2. 确保gateways 上的sip server 已经添加指定的账号,否则毫无意义

重启external生效
freeswitch@internal> sofia profile external restart
Reload XML [Success]
restarting: external
2014-05-25 18:12:36.992758 [INFO] mod_enum.c:876 ENUM Reloaded
2014-05-25 18:12:36.992758 [INFO] switch_time.c:1191 Timezone reloaded 530 definitions
2014-05-25 18:12:37.192751 [NOTICE] sofia_reg.c:135 UN-Registering imsclub.com
2014-05-25 18:12:38.192755 [NOTICE] sofia.c:2682 Waiting for worker thread
2014-05-25 18:12:38.192755 [INFO] switch_core_sqldb.c:1495 sofia:external Destroying SQL queue.
2014-05-25 18:12:38.392750 [INFO] switch_core_sqldb.c:1439 sofia:external Stopping SQL thread.
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:2737 Write lock external
2014-05-25 18:12:38.392750 [NOTICE] sofia_glue.c:6034 deleted gateway example.com from profile external
2014-05-25 18:12:38.392750 [NOTICE] sofia_glue.c:6034 deleted gateway imsclub.com from profile external
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:2749 Write unlock external
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 debug [0]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 sip-trace [no]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 sip-capture [no]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 rfc2833-pt [101]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 sip-port [5080]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 dialplan [XML]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 context [public]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 dtmf-duration [2000]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 inbound-codec-prefs [G722,PCMU,PCMA,GSM]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 outbound-codec-prefs [PCMU,PCMA,GSM]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 hold-music [local_stream://moh]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 rtp-timer-name [soft]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 local-network-acl [localnet.auto]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 manage-presence [false]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 inbound-codec-negotiation [generous]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 nonce-ttl [60]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 auth-calls [false]
2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 inbound-late-negotiation [true]
2014-05-25 1
  • 1
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值