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]

Reply via email to