专注三网融合之接入网/核心网等技术,音视频信令和媒体传输相关协议,关注前沿技术 专家前辈入驻,谈笑有鸿儒,往来无白丁,共同学习探讨IMS/IPPBX相关技术
欢迎同行加入IMS/IPPBX/VoIP/SIP QQ交流群:255404741(猛戳直接加群)
freeswitch@internal> sofia status profile Profile::Gateway-Name Data State IB Calls(F/T) OB Calls(F/T) ================================================================================================= external::example.com sip:[email protected] NOREG 0/0 0/0 ================================================================================================= 1 gateway: Inbound(Failed/Total): 0/0,Outbound(Failed/Total):0/0 freeswitch@internal>
[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:[email protected] ./autoload_configs/erlang_event.conf.xml:8: eg. freeswitch@example or [email protected]. ./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]#
注册到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
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 18:12:38.392750 [DEBUG] sofia.c:3725 inbound-zrtp-passthru [true] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 rtp-ip [114.215.115.159] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 sip-ip [114.215.115.159] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 ext-rtp-ip [auto-nat] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 ext-sip-ip [auto-nat] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 rtp-timeout-sec [300] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 rtp-hold-timeout-sec [1800] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls [false] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls-only [false] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls-bind-params [transport=tls] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls-sip-port [5081] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls-cert-dir [/usr/local/freeswitch/conf/ssl] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls-passphrase [] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls-verify-date [true] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls-verify-policy [none] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls-verify-depth [2] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls-verify-in-subjects [] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:3725 tls-version [tlsv1,tlsv1.1,tlsv1.2] 2014-05-25 18:12:38.392750 [NOTICE] sofia.c:4874 Started Profile external [sofia_reg_external] 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:2413 Creating agent for external 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:2514 Created agent for external 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:2557 Set params for external 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:2601 Activated db for external 2014-05-25 18:12:38.392750 [INFO] switch_core_sqldb.c:1454 sofia:external Starting SQL thread. 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:2639 Starting thread for external 2014-05-25 18:12:38.392750 [DEBUG] sofia.c:2313 Launching worker thread for external 2014-05-25 18:12:38.392750 [NOTICE] sofia_reg.c:3071 Added gateway 'imsclub.com' to profile 'external' 2014-05-25 18:12:38.392750 [NOTICE] sofia_reg.c:3071 Added gateway 'example.com' to profile 'external' 2014-05-25 18:12:38.392750 [NOTICE] sofia_reg.c:423 Registering imsclub.com freeswitch@internal>
Name Type Data State ================================================================================================= external profile sip:[email protected]:5080 RUNNING (0) external::example.com gateway sip:[email protected] NOREG external::imsclub.com gateway sip:[email protected] REGED 114.215.115.159 alias internal ALIASED internal profile sip:[email protected]:5060 RUNNING (0) ================================================================================================= 2 profiles 1 alias freeswitch@internal>
Registrations: ================================================================================================= Call-ID: 1968b168-e3f5-11e3-bbfc-7b46ccff5596 User: [email protected] Contact: "user" <sip:[email protected]:5080;transport=udp;gw=imsclub.com> Agent: FreeSWITCH-mod_sofia/1.2.23~64bit Status: Registered(UDP)(unknown) EXP(2014-05-26 03:13:38) EXPSECS(3477) Host: localhost.localdomain IP: 114.215.115.159 Port: 5080 Auth-User: 1019 Auth-Realm: 122.112.86.102 MWI-Account: [email protected] Call-ID: cbcc3730-0443-cd2f-0506-40e32137a798 User: [email protected] Contact: "user" <sip:[email protected]:56688;transport=udp> Agent: unknown Status: Registered(UDP)(unknown) EXP(2014-05-26 02:19:05) EXPSECS(204) Host: localhost.localdomain IP: 113.116.41.44 Port: 56688 Auth-User: 1001 Auth-Realm: 122.112.86.102 MWI-Account: [email protected] Total items returned: 2 ================================================================================================= freeswitch@internal>