1. Brekeke Product Name and Version: Brekeke SIP SEVER, 3.4.x.x release
2. Java version: 1.8.0_45
3. OS type and the version: 8.1
4. UA (phone), gateway or other hardware/software involved: does not master
5. Your problem:
I create below rule to check a NOTIFY message then inform to user for a number of new voicemail messages come to his mailbox. A number of new voiemail message is filtered out from NOTIFY message by this expression "expression $body("Voice-Message: (\d+)/") = (.+)". But this expression always returns a null value instead of a number (4) as I expect from this body content "Voice-Message: 4/0 (0/0)".
Could any one tell me if any thing wrong with the expression. Please see below for detail of the problem.
Thanks,
======================================================
Create below dial plan rule:
Rule name: "PN3_NotifyVoiceMes"
[Matching Patterns]
$request = ^NOTIFY
$getSIPuser(To) = (.+)
$pn.user("%1") = true
Content-Type = application/simple-message-summary
$body("Messages-Waiting: (.+)") = yes
$body("Voice-Message: (\d+)/") = (.+)
[Deploy Patterns]
&pn.notify.user = %1
&pn.notify.message = You got new voice message
$pn.notify.counter = %2
$continue = true
*Below is actual NOTIFY message I got.
============
NOTIFY Message:
NOTIFY sip:1003@127.0.0.1 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5054;rport=5054;branch=z9hG4bKc5b4f5dbe82b
From: sip:1003@127.0.0.1;tag=b26505fa7p
To: <sip:1003@127.0.0.1>
Max-Forwards: 20
Contact: <sip:127.0.0.1:5054>
Call-ID: 9ed9392b-463ebb8d-7da3c79-e8e3b40b
User-Agent: Brekeke PBX
CSeq: 1 NOTIFY
Event: message-summary
Content-Type: application/simple-message-summary
Content-Length: 85
Messages-Waiting: yes
Message-Account: sip:8@192.168.0.3
Voice-Message: 4/0 (0/0)
=> With the input "Voice-Message: 4/0 (0/0)". The expression "$body("Voice-Message: (\d+)/") = (.+)" should return "4" instead of "null"
*Detail log:
============================================
Rule [PN3_NotifyVoiceMes]
Pattern: $request = ^NOTIFY
Input: $request = NOTIFY sip:1005@127.0.0.1 SIP/2.0
Result: true
Pattern: $getSIPuser(To) = (.+)
Input: $getSIPuser(To) = 1005
%1 <= 1005
Result: true
Pattern: $pn.user("%1") = true
Input: $pn.user("1005") = true
Result: true
Pattern: Content-Type = application/simple-message-summary
Input: Content-Type = application/simple-message-summary
Result: true
Pattern: $body("Messages-Waiting: (.+)") = yes
Input: $body("Messages-Waiting: (.+)") = yes
Result: true
Pattern: $body("Content-Length: (\d)") = (.+)
Input: $body("Content-Length: (\d)") = null
Result: false
============================================
2. Java version: 1.8.0_45
3. OS type and the version: 8.1
4. UA (phone), gateway or other hardware/software involved: does not master
5. Your problem:
I create below rule to check a NOTIFY message then inform to user for a number of new voicemail messages come to his mailbox. A number of new voiemail message is filtered out from NOTIFY message by this expression "expression $body("Voice-Message: (\d+)/") = (.+)". But this expression always returns a null value instead of a number (4) as I expect from this body content "Voice-Message: 4/0 (0/0)".
Could any one tell me if any thing wrong with the expression. Please see below for detail of the problem.
Thanks,
======================================================
Create below dial plan rule:
Rule name: "PN3_NotifyVoiceMes"
[Matching Patterns]
$request = ^NOTIFY
$getSIPuser(To) = (.+)
$pn.user("%1") = true
Content-Type = application/simple-message-summary
$body("Messages-Waiting: (.+)") = yes
$body("Voice-Message: (\d+)/") = (.+)
[Deploy Patterns]
&pn.notify.user = %1
&pn.notify.message = You got new voice message
$pn.notify.counter = %2
$continue = true
*Below is actual NOTIFY message I got.
============
NOTIFY Message:
NOTIFY sip:1003@127.0.0.1 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5054;rport=5054;branch=z9hG4bKc5b4f5dbe82b
From: sip:1003@127.0.0.1;tag=b26505fa7p
To: <sip:1003@127.0.0.1>
Max-Forwards: 20
Contact: <sip:127.0.0.1:5054>
Call-ID: 9ed9392b-463ebb8d-7da3c79-e8e3b40b
User-Agent: Brekeke PBX
CSeq: 1 NOTIFY
Event: message-summary
Content-Type: application/simple-message-summary
Content-Length: 85
Messages-Waiting: yes
Message-Account: sip:8@192.168.0.3
Voice-Message: 4/0 (0/0)
=> With the input "Voice-Message: 4/0 (0/0)". The expression "$body("Voice-Message: (\d+)/") = (.+)" should return "4" instead of "null"
*Detail log:
============================================
Rule [PN3_NotifyVoiceMes]
Pattern: $request = ^NOTIFY
Input: $request = NOTIFY sip:1005@127.0.0.1 SIP/2.0
Result: true
Pattern: $getSIPuser(To) = (.+)
Input: $getSIPuser(To) = 1005
%1 <= 1005
Result: true
Pattern: $pn.user("%1") = true
Input: $pn.user("1005") = true
Result: true
Pattern: Content-Type = application/simple-message-summary
Input: Content-Type = application/simple-message-summary
Result: true
Pattern: $body("Messages-Waiting: (.+)") = yes
Input: $body("Messages-Waiting: (.+)") = yes
Result: true
Pattern: $body("Content-Length: (\d)") = (.+)
Input: $body("Content-Length: (\d)") = null
Result: false
============================================