'DTMF_watchguard.vbs: Disable DTMF for a while, if DTMF control received for 'Listen-Only', and re-enable 'Author: JJ De Rey, ON7EQ 'Date: July 23, 2010 'To invoke this script from the command line, type: ' cscript DTMF_watchguard.vbs /A or /D ' ' Where option /A = Announce is active ' /D = Debug mode ' Set oEchoLink = CreateObject("EchoLink.EchoLinkSession") Set oSysConfig = CreateObject("EchoLink.SysopConfig") Set oSetupConfig = CreateObject("EchoLink.SetupConfig") Set oEchoLink = WScript.CreateObject("EchoLink.EchoLinkSession", "EchoLink_") '---------------------------------------------------------------------------- 'Penalty timer is in milleseconds ' 5 min = 300000 '10 min = 600000 '20 min = 1200000 '30 min = 1800000 pTimer1 = 300000 'this is the Short Penalty pTimer2 = 1200000 'this is the Long Penalty '---------------------------------------------------------------------------- pTimer = pTimer1 LpTimer = pTimer2 bDTMFdisable = False bListenOnly = False bDebug = False bAnnounce = False Mode = "Normal" 'Test in which mode running If WScript.Arguments.Count > 0 Then Set objArgs = WScript.Arguments For Each strArg in objArgs If strArg = "/A" then bAnnounce = True If strArg = "/D" then bDebug = True Next End If 'Only 20 and 60 sec patience in debug mode :o) If bDebug = True then pTimer = 20000 If bDebug = True then LpTimer = 60000 vTimer = pTimer 'this is the timer when running penalty, default value set WScript.Echo "Mode: Announce=", bAnnounce, "Debug=",bDebug pTimerSec = pTimer/1000 LpTimerSec = LpTimer/1000 WScript.Echo "Short Penalty Timer=",pTimerSec, "sec"," / Long Penalty Timer=",LpTimerSec, "sec" WaitingDTMF '---------------------------------------------------------------------------- 'Start loop While True On Error Resume Next Err.Clear 'LISTEN ONLY routine -------------------------------------------------------- 'Condition : only disable DTMF if ListeOnly is active AND no station connected If oEchoLink.ListenOnly = 1 and oEchoLink.NumPeers = 0 Then 'ListenOnly mode reset to normal oEchoLink.ListenOnly = False bListenOnly = True Else 'Debug check 'WScript.Echo "No action" 'Test ListenOnly status every 0,2 seconds WScript.Sleep 200 End If 'TEST IF DTMF MUST BE DISABLED If (bDTMFDisable = True) or (bListenOnly = True) Then DTMFDisable Else End If Wend '---------------------------------------------------------------------------- Sub EchoLink_Closing 'EchoLink is shutting down; exit now to avoid picking daisies WScript.DisconnectObject(oEchoLink) Set oEchoLink = Nothing WScript.Echo "Echolink main software has been shut down" WScript.Quit(0) End Sub '---------------------------------------------------------------------------- Sub Echolink_DTMFString(sDigits) WScript.Echo "DTMF code",SDigits,"received at",Time,"on",Date WScript.Echo " " 'This is the general DTMF Blacklist If sDigits = "1111" Then bDTMFdisable = TRUE If sDigits = "11111" Then bDTMFdisable = TRUE If sDigits = "111111" Then bDTMFdisable = TRUE If sDigits = "2222" Then bDTMFdisable = TRUE If sDigits = "22222" Then bDTMFdisable = TRUE If sDigits = "222222" Then bDTMFdisable = TRUE If sDigits = "3333" Then bDTMFdisable = TRUE If sDigits = "33333" Then bDTMFdisable = TRUE If sDigits = "333333" Then bDTMFdisable = TRUE If sDigits = "4444" Then bDTMFdisable = TRUE If sDigits = "44444" Then bDTMFdisable = TRUE If sDigits = "444444" Then bDTMFdisable = TRUE If sDigits = "5555" Then bDTMFdisable = TRUE If sDigits = "55555" Then bDTMFdisable = TRUE If sDigits = "555555" Then bDTMFdisable = TRUE If sDigits = "6666" Then bDTMFdisable = TRUE If sDigits = "66666" Then bDTMFdisable = TRUE If sDigits = "666666" Then bDTMFdisable = TRUE If sDigits = "7777" Then bDTMFdisable = TRUE If sDigits = "77777" Then bDTMFdisable = TRUE If sDigits = "777777" Then bDTMFdisable = TRUE If sDigits = "8888" Then bDTMFdisable = TRUE If sDigits = "88888" Then bDTMFdisable = TRUE If sDigits = "888888" Then bDTMFdisable = TRUE 'If sDigits = "9999" Then bDTMFdisable = TRUE If sDigits = "99999" Then bDTMFdisable = TRUE If sDigits = "999999" Then bDTMFdisable = TRUE If sDigits = "1234" Then bDTMFdisable = TRUE If sDigits = "12345" Then bDTMFdisable = TRUE If sDigits = "123456" Then bDTMFdisable = TRUE If sDigits = "0123" Then bDTMFdisable = TRUE If sDigits = "01234" Then bDTMFdisable = TRUE If sDigits = "012345" Then bDTMFdisable = TRUE 'This is Long Timer Blacklist, in addition to above If sDigits = "6666" Then vTimer = LpTimer If sDigits = "66666" Then vTimer = LpTimer If sDigits = "666666" Then vTimer = LpTimer End Sub '---------------------------------------------------------------------------- Function DTMFdisable 'Not while connected If oEchoLink.NumPeers <> 0 Then bDTMFDisable = False bListenOnly = False WScript.Echo "Error: Suspend is not possible while connected" WaitingDTMF Else 'Show why suspended and reset variables If bDTMFDisable = True Then WScript.Echo "This DTMF code is blacklisted !" Else End If If bListenOnly = True Then WScript.Echo "Suspend is triggered from Listen-Only function !" Else End If bDTMFDisable = False bListenOnly = False 'Disable DTMF decoder oSysConfig.DTMFDecoder = "2" oSysConfig.apply TRUE If bAnnounce = True Then 'Tell the world oEcholink.SayPhrase "9" oEcholink.SayString "DTMF" oEcholink.SayPhrase "8" Else End If 'This handles the Long Timer Blacklist vTimerSec = vTimer/1000 'Debug check WScript.Echo "DTMF Decoding is suspendeed and Penalty timer",vTimerSec,"sec running" WScript.Sleep vTimer vTimer = pTimer 'Reset to default timer 'Enable DTMF internal decoder oSysConfig.DTMFDecoder = "1" oSysConfig.apply TRUE If bAnnounce = True Then 'Tell the world oEcholink.SayPhrase "9" oEcholink.SayString "DTMF" oEcholink.SayPhrase "3" Else End If 'Debug check WScript.Echo "DTMF decoding is now active again" WaitingDTMF End If End Function '---------------------------------------------------------------------------- Function WaitingDTMF WScript.Echo " " WScript.Echo "Waiting for DTMF ..." WScript.Echo " " End Function '----------------------------------------------------------------------------