FreeSWITCH 版本:1.10.12,以下简称 Fs
SIP 终端:Eyebeam 1.5.14.4
Eyebeam 设置注册的过期时间为 30
Fs 设置为 120,下面是详细配置:
<param name="sip-force-expires-max" value="120"/>
<param name="sip-force-expires-min" value="120"/>
<param name="sip-force-expires" value="120"/>
测试结果为:Eyebeam 续注册的时间大约为 110 秒,尊重了 Fs,只提前了一点点
第一次注册请求的日志为:
recv 547 bytes from udp/[192.168.31.166]:42690 at 11:56:12.650412:
REGISTER sip:192.168.31.166 SIP/2.0
Via: SIP/2.0/UDP 192.168.31.166:42690;branch=z9hG4bK-d87543-c1699257fe720f17-1--d87543-;rport
Max-Forwards: 70
Contact: <sip:1001@192.168.31.166:42690;rinstance=c3f76577875a4ccd;transport=udp>
To: <sip:1001@192.168.31.166>
From: <sip:1001@192.168.31.166>;tag=1f43d91c
Call-ID: ZjIzNDI3YzE5NTIyMjBhNDUzOWZjOGNlNTg2ZTUzODE.
CSeq: 1 REGISTER
Expires: 30
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: eyeBeam release 1011d stamp 40820
Content-Length: 0
请留意,Expires 为 30,是一个独立的 SIP 头
Fs 回应 200 OK 的日志为:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.31.166:42690;branch=z9hG4bK-d87543-294609005238a479-1--d87543-;rport=42690
From: <sip:1001@192.168.31.166>;tag=1f43d91c
To: <sip:1001@192.168.31.166>;tag=4aXXDKc0agt6N
Call-ID: ZjIzNDI3YzE5NTIyMjBhNDUzOWZjOGNlNTg2ZTUzODE.
CSeq: 2 REGISTER
Contact: <sip:1001@192.168.31.166:42690;rinstance=c3f76577875a4ccd;transport=udp>;expires=120
Date: Fri, 18 Oct 2024 11:56:12 GMT
User-Agent: FreeSWITCH-mod_sofia/1.10.12-dev-5976~218a00e2e9~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Content-Length: 0
请留意,Fs 回应的 Expires 为 120,Expires 放到了 Contact 的参数里面(这是标准做法)
下面是 Eyebeam 的续注册日志:
recv 800 bytes from udp/[192.168.31.166]:42690 at 11:58:01.158276:
REGISTER sip:192.168.31.166 SIP/2.0
Via: SIP/2.0/UDP 192.168.31.166:42690;branch=z9hG4bK-d87543-832df92ea024f538-1--d87543-;rport
Max-Forwards: 70
Contact: <sip:1001@192.168.31.166:42690;rinstance=c3f76577875a4ccd;transport=udp>
To: <sip:1001@192.168.31.166>
From: <sip:1001@192.168.31.166>;tag=1f43d91c
Call-ID: ZjIzNDI3YzE5NTIyMjBhNDUzOWZjOGNlNTg2ZTUzODE.
CSeq: 3 REGISTER
Expires: 30
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: eyeBeam release 1011d stamp 40820
Authorization: Digest username="1001",realm="192.168.31.166",nonce="ab6f2109-7bde-4b22-96fd-aec46a6b1f13",uri="sip:192.168.31.166",response="c3db123ada2a70362bdccb9208fa9c69",cnonce="5de6948dfa75d6d5ef669c640866b628",nc=00000002,qop=auth,algorithm=MD5
Content-Length: 0
请注意下面几个信息:
-
Call-ID 是同一个, CSeq 有增加,这明显是续注册请求;同时带了 Authorization 头(认证信息)。如果服务器设置的随机数没有过期,就不用再挑战了,直接回 200 OK
-
11:58:01 同 11:56:12 之间大致相差 110秒, Eyebeam 尊重 Fs 的选择,而不是固执地使用自己 30 秒的设置