Hi David,
Some idea:
1: Bookmark this: http://intermapper.com/docs/DevWebHelp/
intermapper_developer_guide.htm
2: The 4 EXPT lines you have seem redundant, if you look in the dev-
guide above.
3: Your MTCH statement needs some GREP.. :-) You're looking for 1 or
more numbers in a line, after the 'Messages: ' text.
You can find that with: MTCH "Messages: #+"ri
That just won't save the number to anything you can STOR. Use the
GREP store feature: (var), so your query becomes:
MTCH "Messages: (#+)"ri
- The + sign means 'more of the same type' ie. numbers in this case.
- The (..) assigns the string found inside to $1
- The i is InCaseSensitive, and the r is Regex Lite (m"bla" is
deprecated as of vers. 3.6 !)
So, your script should look like this:
EXPT "NewMessages:"
MTCH "NewMessages: (#+)"ri else #+2
STOR "NewMess" "${1}"
Hope it helps,
Jakob Peterh�nsel
"Tell me why, don't we try, not to break our hearts
and make it so hard for our selfs"
P.S.B. 1987
Email: [EMAIL PROTECTED]
AIM: Marook
Phone: +45 22684961
On 13/06/2005, at 20:05, David Reddy wrote:
Hi,
Been working on a custom TCP probe to check voicemail message
counts from Asterisk PBX.
So far the prob authenticates to the manager API and returns
relevant data.
Problem is that I want to STOR the message counts in a VAR so they
can be charted.
I've followed some hints from the mail digest but can't seem to
pattern match the '33' below into a variable....
No expert on regexp by any means....
Aware that the overall script may seem messy which is ok, just need
MTCH and STOR commands to work correctly..
Any ideas???
(BTW: deployed IM from Windows 2003 server)
Thanks,
Dave.
Output from PBX after query is run:
-> Response: Success
-> Message: Mailbox Message Count
-> Mailbox: 0033
-> NewMessages: 33
-> OldMessages: 1
<script>
STOR "NewMess" "n/a"
STOR "OldMess" "n/a"
CONN #60 (connect timeout in secs)
WAIT #2 @IDLE (idle timeout in secs)
SEND "Action: login\r\n"
WAIT #3
SEND "Username: ${User}\r\n"
WAIT #3
SEND "Secret: ${Secret}\r\n"
WAIT #3
SEND "Events: off\r\n\r\n"
WAIT #3
EXPT "Response: Success"
EXPT "Message: Authentication accepted"
WAIT #3
SEND "Action: Mailboxcount\r\n"
WAIT #3
SEND "Mailbox: ${Mailbox}\r\n\r\n"
WAIT #3
EXPT "Response: Success"
EXPT "Message: Mailbox Message Count"
EXPT "Mailbox: "
EXPT "NewMessages:"
MTCH m"Messages:\\s#"i else #+2
STOR "NewMess" "${1}"
LINE OFF
DONE OKAY "Response was \"${_LINE:50}\""
WAIT #3
LINE ON
SEND "Action: Logoff\r\n\r\n"
DONE OKAY
@LOGOUT
WAIT #3
SEND "Action: Logoff\r\n\r\n"
EXIT
</script>
<script-output>
�B5�Mailbox Information�0P�
�4�Time to establish connection:�0� ${_connect} msecs
�4�Time spent connected to host:�0� ${_active} msecs
�4�New Messages:�0� ${NewMess}
�4�Old Messages:�0� ${OldMess}
</script-output>
____________________________________________________________________
List archives: http://www.mail-archive.com/intermapper-talk%
40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]
____________________________________________________________________
List archives: http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]