转载自:https://blog.51cto.com/908405/1948254
1、/etc/freeswitch/autoload_configs/switch.conf.xml
<param name="switchname" value="Root.Lee.Sofia"/>
<!--系统“主机名”注册时显示的HOST及进入fs_cli后显示的主机名-->
如下:"freeswitch@Root.Lee.Sofia"不再显示操作系统主机名,同时"Host:"显示名称也不再显示主机名
freeswitch@Root.Lee.Sofia> sofia status profile internal reg
Registrations:
=================================================================================================
Call-ID: 153661815917590-21938109132906@172.16.100.232
User: 8001@172.16.100.229
Contact: "8001" <sip:8001@172.16.100.232:6060>
Agent: Fanvil X5 1.3.256.1566
Status: Registered(UDP)(unknown) EXP(2017-07-17 21:37:03) EXPSECS(2739)
Ping-Status: Reachable
Ping-Time: 0.00
Host: Root.Lee.Sofia
IP: 172.16.100.232
Port: 6060
Auth-User: 8001
Auth-Realm: 172.16.100.229
MWI-Account: 8001@172.16.100.229
Total items returned: 1
=================================================================================================
2、/etc/freeswitch/sip_profiles/external.xml internal.xml
<param name="user-agent-string" value="Root.Lee.Sofia"/>
<!--SIP信令中显示的user-agent,默认是FreeSWITCH+版本号-->
如下:发送出去的INVITE消息里面包含的User-Agent: 名称改变
------------------------------------------------------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.16.100.232:6060;branch=z9hG4bK1532632258519713600;rport=6060
From: 8001 <sip:8001@172.16.100.229:5060>;tag=815319820
To: "9910000" <sip:9910000@172.16.100.229;user=phone>;tag=evapmZN4Z6jjH
Call-ID: 25922284821475-15969885731081@172.16.100.232
CSeq: 2 INVITE
Contact: <sip:9910000@172.16.100.229:5060;transport=udp>
User-Agent: Root.Lee.Sofia
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 176
Remote-Party-ID: "Outbound Call" <sip:910000@172.16.100.229>;party=calling;privacy=off;screen=no
3、源码./src/mod/endpoints/mod_sofia/sofia.c
if (!profile->sdp_username) {
profile->sdp_username = switch_core_strdup(profile->pool, "FreeSWITCH");
}
#修改此处"FreeSWITCH"可修改SIP消息SDP的FreeSWITCH标识,这个文件有几处"FreeSWITCH",均是显示,名称的,可以一并修改
#修改后需要重新编译sofia模块,并将编译出来的"mod_sofia.so"复制到FreeSWITCH相应的库文件位置
如下:SIP消息SDP中”o=****** s=******“不再显示"FreeSWITCH"
o=Root.Lee.Sofia 1500262855 1500262856 IN IP4 172.16.100.229
s=Root.Lee.Sofia
------------------------------------------------------------------------
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.16.100.232:6060;branch=z9hG4bK1532632258519713600;rport=6060
From: 8001 <sip:8001@172.16.100.229:5060>;tag=815319820
To: "9910000" <sip:9910000@172.16.100.229;user=phone>;tag=evapmZN4Z6jjH
Call-ID: 25922284821475-15969885731081@172.16.100.232
CSeq: 2 INVITE
Contact: <sip:9910000@172.16.100.229:5060;transport=udp>
User-Agent: Root.Lee.Sofia
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 176
Remote-Party-ID: "Outbound Call" <sip:910000@172.16.100.229>;party=calling;privacy=off;screen=no
v=0
o=Root.Lee.Sofia 1500262855 1500262856 IN IP4 172.16.100.229
s=Root.Lee.Sofia
c=IN IP4 172.16.100.229
t=0 0
m=audio 32756 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=ptime:20
4、SIP消息头中不带号码而是显示FreeSwitch问题,如下:
INVITE sip:7999@172.16.100.240:5060 SIP/2.0
Via: SIP/2.0/UDP 172.16.100.247:5080;rport;branch=z9hG4bKNvrZg7ZS0393e
Max-Forwards: 69
From: "ligen" <sip:FreeSWITCH@172.16.100.240:5060>;tag=66Sm8SUjvc4pp
To: <sip:7999@172.16.100.240:5060>
当送出的INVITE中From字段显示的是“FreeSWITCH@ip:端口”时,需要在网关中添加
<
param
name
=
"caller-id-in-from"
value
=
"true"
/>
否则,可能对端显示号码是88888888(华为呼叫中心就是这样子的)。