freeswitch隐藏fs标识
概述
freeswitch是一款好用的开源软交换平台。
fs的默认配置环境下,sip消息中有很多freeswitch的标识,比如“user-agent”,“contact”头域等等。
对于某些场景,我们希望隐藏掉这些有识别性的标识。
环境
centos:CentOS release 7.0 (Final)或以上版本
freeswitch:v1.6.19
GCC:4.8.5
默认的invite消息
freeswitch默认的invite消息如下。
INVITE sip:10011@10.55.55.137:5080;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.55.55.138:5080;rport;branch=z9hG4bKFrH7aXtvQyKSc
Max-Forwards: 66
From: "" <sip:10012@10.55.55.138>;tag=Z3gB0ygy8F4ep
To: <sip:10011@10.55.55.137:5080>
Call-ID: 2f8fa2b9-baa0-123b-d08b-0cc47a9bab4c
CSeq: 57675850 INVITE
Contact: <sip:mod_sofia@10.55.55.138:5080>
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: <sip:10012@10.55.55.138>
v=0
o=FreeSWITCH 1664417843 1664417844 IN IP4 10.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: <sip:mod_sofia@10.55.55.138:5080>
User-Agent: FreeSWITCH-mod_sofia/1.8.7~64bit
o=FreeSWITCH 1664417843 1664417844 IN IP4 10.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=phone SIP/2.0
Via: SIP/2.0/UDP 10.55.55.138:5080;rport;branch=z9hG4bKQBg4gFvQKXKUK
Max-Forwards: 57
From: "" <sip:10012@10.55.55.138>;tag=j26Bv08Ne8a5D
To: <sip:10011@10.55.55.137:5080>
Call-ID: e3d32a8e-c008-123b-df8b-0cc47a9bab4c
CSeq: 57973213 INVITE
Contact: <sip:SBC001@10.55.55.138:5080>
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: <sip:10012@10.55.55.138>
v=0
o=sbc001 1665013537 1665013538 IN IP4 10.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: <sip:SBC001@10.55.55.138:5080>
User-Agent: sbc001
o=sbc001 1665013537 1665013538 IN IP4 10.55.55.138
s=sbc001
总结
freeswitch的模块化和配置项非常多,初期学习比较困难,首先要学会查找文档资料,配置一个测试环境,随时测试。
遗留问题,“X-FS-Support”头域。
空空如常
求真得真