FreeSWITCH技巧:notify与message-waiting
@(Freeswitch经验点滴)
现象描述
在客户端登陆抓包时,发现了FreeSWITCH发来的包:
NOTIFY sip:9988002@192.168.168.106:63984;transport=udp SIP/2.0
Via: SIP/2.0/UDP 192.168.168.204:11160;rport;branch=z9hG4bKyDmpeXc5757jD
Max-Forwards: 70
From: sip:9988002@192.168.168.204;tag=2r7dkoK0sQmO
To: sip:9988002@192.168.168.204;tag=46645800
Call-ID: 27392434-dc88-1daf-88da-27412056899c
CSeq: 1086796376 NOTIFY
Contact: sip:9988002@192.168.168.204:11160;transport=udp
User-Agent: FreeSWITCH-mod_sofia/1.2.23~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, path, replaces
Event: message-summary
Allow-Events: talk, hold, conference, presence, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Subscription-State: active;expires=120
Content-Type: application/simple-message-summary
Content-Length: 70
...(下面为消息体)
Messages-Waiting: no
Message-Account: sip:9988002@192.168.168.204
该消息的目的是在话机登陆的时候,即通知话机目前有几个未读的消息
具体可参阅RFC文档:http://tools.ietf.org/html/rfc3842
问题分析
之所以在客户端一登陆就发送该条消息,可在Athnomy的邮件回复中找到答案:
You must be new to SIP, you will soon learn that almost every SIP device just stupidly expects you to send this and never does it the correct way by subscribing to it which is why this option is the default.
FreeSWITCH设置
将该项功能关闭,配置如下:
文件:conf/sip-profiles/internal.xml
修改项:
<!-- 'true' means every time 'first-only' means on the first register -->
<param name="send-message-query-on-register" value="false"/>
或者,将值修改为first-only,只在客户端登陆时发,其他时间不发。