I have been trying to use the SIPnotify api in order to send a MWI to a sip based phone without much success. I created the following PHP code:
public function sipNotify($queue, $handset)
{
$this->_checkSocket();
$command = "Action: SIPnotify\r\n"
."Channel: SIP/8693949661\r\n"
."Variable: Event=message-summary,"
."Content-type: application/simple-message-summary,"
."Messages-Waiting=yes,"
."Message-Account=sip:asterisk@127.0.0.1,"
."Voicemail=1/0 (0/0)\r\n";
$this->_sendCommand($command."\r\n");
return true;
}
When I send this request to a server running Asterisk 1.8.11-cert3-rc2 I get the following response back:
[i]Action: SIPnotify
Channel: 8693949661
Variable: Event=message-summary,Content-type: application/simple-message-summary,Messages-Waiting=yes,Message-Account=sip:asterisk@127.0.0.1,Voicemail=1/0 (0/0)
Response: Success
Message: Notify Sent
Server: localhost[/i]
I get this in the Asterisk log:
NOTIFY sip:8693949661@192.168.1.3 SIP/2.0
Via: SIP/2.0/UDP 127.0.1.1:5060;branch=z9hG4bK3f5866ed;rport
Max-Forwards: 70
From: “asterisk” sip:asterisk@127.0.1.1;tag=as270f207a
To: sip:8693949661@192.168.1.3
Contact: sip:asterisk@127.0.1.1:5060
Call-ID: 15acad990e486b6f3482ec4134130871@127.0.1.1:5060
CSeq: 102 NOTIFY
User-Agent: Asterisk PBX 1.8.11-cert3-rc2
Date: Fri, 29 Jun 2012 04:20:47 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Subscription-State: terminated
Voicemail: 1/0 (0/0)
Message-Account: sip:asterisk@127.0.0.1
Messages-Waiting: yes
Event: message-summary
Content-Length: 0
which does not look like a value message like I get when I send a set-mwi message from the command line:
/>sip notify set-mwi 8693949661
Sending NOTIFY of type ‘set-mwi’ to ‘8693949661’
== GOOD RESPONSE ==
[i]NOTIFY sip:8693949661@192.168.1.3 SIP/2.0
Via: SIP/2.0/UDP 127.0.1.1:5060;branch=z9hG4bK6e08d640;rport
Max-Forwards: 70
From: “asterisk” sip:asterisk@127.0.1.1;tag=as4d116ddc
To: sip:8693949661@192.168.1.3
Contact: sip:asterisk@127.0.1.1:5060
Call-ID: 7d61b6cd496325e3092683830cb3b047@127.0.1.1:5060
CSeq: 102 NOTIFY
User-Agent: Asterisk PBX 1.8.11-cert3-rc2
Date: Fri, 29 Jun 2012 02:58:23 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Subscription-State: terminated
Event: message-summary
Content-type: application/simple-message-summary
Content-Length: 89
Messages-Waiting: no
Message-Account: sip:asterisk@127.0.0.1
Voice-Message: 0/0 (0/0)[/i]
My Wireshark trace does show that I am not sending any message body only a header.
I am not sure I am building the request correctly and would appreciate some advice on how to resolve this. Thank you very much!