概述
freeswitch是一款好用的開源軟交換平臺翘盖。
fs的默認(rèn)配置環(huán)境下浪听,sip消息中有很多freeswitch的標(biāo)識埠褪,比如“user-agent”切端,“contact”頭域等等。
對于某些場景寂祥,我們希望隱藏掉這些有識別性的標(biāo)識荐虐。
環(huán)境
centos:CentOS? release 7.0 (Final)或以上版本
freeswitch:v1.6.19
GCC:4.8.5
默認(rèn)的invite消息
freeswitch默認(rèn)的invite消息如下。
INVITE sip:10011@10.55.55.137:5080;user=phoneSIP/2.0
Via: SIP/2.0/UDP10.55.55.138:5080;rport;branch=z9hG4bKFrH7aXtvQyKSc
Max-Forwards: 66
From: "";tag=Z3gB0ygy8F4ep
To:
Call-ID: 2f8fa2b9-baa0-123b-d08b-0cc47a9bab4c
CSeq: 57675850 INVITE
Contact:
User-Agent:FreeSWITCH-mod_sofia/1.6.19~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS,MESSAGE, INFO, UPDATE, REGISTER, REFER, PRACK, NOTIFY
Supported: precondition, 100rel, timer, path,replaces
Allow-Events: talk, hold, conference, refer
Privacy: none
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 218
X-FS-Support: update_display,send_info
P-Asserted-Identity:
v=0
o=FreeSWITCH 1664417843 1664417844 IN IP410.55.55.138
s=FreeSWITCH
c=IN IP4 10.55.55.138
t=0 0
m=audio 41442 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
其中丸凭,有3個地方需要修改福扬。
Contact:
User-Agent:FreeSWITCH-mod_sofia/1.8.7~64bit
o=FreeSWITCH 1664417843 1664417844 IN IP410.55.55.138
s=FreeSWITCH
配置
修改配置文件conf/sip_profile/external.xml。影響頭域“User-Agent”和SDP信息惜犀。
<param name="user-agent-string" value="sbc001"/>
<param name="username" value="sbc001"/>
修改配置文件conf/dialplan/test01.xml铛碑。影響頭域“Contact”。
<X-PRE-PROCESS cmd="set" data="sip_contact_user=SBC001"/>
修正后的invite消息
配置后重啟fs虽界,修正后的invite消息如下汽烦。
INVITE sip:10011@10.55.55.137:5080;user=phoneSIP/2.0
Via: SIP/2.0/UDP10.55.55.138:5080;rport;branch=z9hG4bKQBg4gFvQKXKUK
Max-Forwards: 57
From: "";tag=j26Bv08Ne8a5D
To:
Call-ID: e3d32a8e-c008-123b-df8b-0cc47a9bab4c
CSeq: 57973213 INVITE
Contact:
User-Agent: sbc001
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS,MESSAGE, INFO, UPDATE, REGISTER, REFER, PRACK, NOTIFY
Supported: precondition, 100rel, timer,path, replaces
Allow-Events: talk, hold, conference, refer
Privacy: none
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 236
X-FS-Support: update_display,send_info
P-Asserted-Identity:
v=0
o=sbc001 1665013537 1665013538 IN IP410.55.55.138
s=sbc001
c=IN IP4 10.55.55.138
t=0 0
m=audio 40474 RTP/AVP 8 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
影響到的頭域包括。
Contact:
User-Agent: sbc001
o=sbc001 1665013537 1665013538 IN IP410.55.55.138
s=sbc001
總結(jié)
freeswitch的模塊化和配置項非常多莉御,初期學(xué)習(xí)比較困難撇吞,首先要學(xué)會查找文檔資料,配置一個測試環(huán)境礁叔,隨時測試牍颈。
遺留問題,“X-FS-Support”頭域琅关。
空空如常
求真得真