Sie sind auf Seite 1von 9

Posted 30 July 2007 - 09:35 PM

I needed an automated SIP client, and preferably one with media (audio)
support as well. Couldn't find one that was effective or easy to set up. So I
came up with writing a wrapper to X-Lite and eyeBeam SIP clients through
GUI automation. You can automate this by executing a sequence of
commands with the script below.
The script below does require you to install the AutoItX automation library to
work. Or re-write in C++ or AutoIt script to make into standalone executable.
I'm providing this "as is", with no support.

'''Main Program here''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


Dim args, ibeambot, retVal
Set args = WScript.Arguments

If args.Count = 0 Then
displayInfo
Set args = Nothing
WScript.Quit(0)
End If

Set ibeambot = WScript.CreateObject("AutoItX3.Control")


ibeambot.AutoItSetOption "MouseCoordMode", 0

ibeambot.WinActivate "eyeBeam", ""


'ibeambot.WinWaitActive "eyeBeam", "", 15
ibeambot.WinActivate "X-Lite", ""

'ibeambot.WinWaitActive "X-Lite", "", 15

Select Case args(0)


Case "-?"
displayUsage
Case "-bancall" 'softkey in eyeBeam display
'works like "send to voicemail" all the time until un-banned
'how to un-ban? Also not available on X-Lite
'left-click mouse @ Ban softkey once, ~instantaneously
ibeambot.MouseClick "left", 425, 111, 1, 0
Case "-call" 'make a call
If args.Count = 1 Then
ibeambot.Send "{ENTER}" 'enter to call
Else
ibeambot.Send args(1) 'dial number
ibeambot.Send "{ENTER}" 'enter to call
End If
Case "-close" 'close eyeBeam
ibeambot.Send "^q" 'Ctrl+q
Case "-conf" 'conference on/off - see eyeBeam v1.1 manual
ibeambot.Send "^n" 'Ctrl+n
Case "-dial" 'dial/press DTMF digits
ibeambot.Send args(1)
Case "-detectmwi"
'detect Message Waiting Envelope icon + # of messages in VM
'left-click mouse @ MWI icon, ~instantaneously

ibeambot.MouseClick "left", 315, 144, 1, 0


retVal = ibeambot.WinWaitActive("Messages Waiting", "", 5)
If retVal = 1 Then
ibeambot.Send "{ENTER}"
WScript.Echo "MWI detected"
Else
WScript.Echo "MWI not detected"
End If
Set args = Nothing
Set ibeambot = Nothing
WScript.Quit(retVal)
Case "-dnd"
ibeambot.Send "^d" 'Ctrl+d
Case "-exit" 'close eyeBeam
ibeambot.Send "^q" 'Ctrl+q
Case "-flash"
'left-click mouse @ Flash button once, ~instantaneously
If args.Count > 2 Then
If args(1) = "-ver" And (args(2) = "xlite" Or args(2) = "1.5") Then
ibeambot.MouseClick "left", 318, 236, 1, 0
End If
Else
ibeambot.MouseClick "left", 300, 236, 1, 0
End If
Case "-h"
displayUsage

Case "-help"
displayUsage
Case "-hold"
ibeambot.Send "^o" 'Ctrl+o
Case "-ignorecall" 'softkey in eyeBeam display
'works like "send to voicemail" on Wave (Office mode)
ibeambot.Send "^i" 'Ctrl+i
Case "-line" 'select line 1-6
ibeambot.Send "^" & args(1) 'Ctrl+number
Case "-mute" 'mute on/off
ibeambot.Send "^m" 'Ctrl+number
Case "-offhook"
ibeambot.Send "{ENTER}" 'get dial tone, can start dialing
Case "-onhook"
ibeambot.Send "^h" 'Ctrl+h
Case "-open" 'open eyeBeam
Dim shell
Set shell = WScript.CreateObject("WScript.Shell")
shell.Run(args(1))
Set shell = Nothing
Case "-playwav" 'play a Wave file
'assumes that on the computer running eyeBeam/X-Lite audio
'out is looped back to audio in or microphone input, to be
'transmitted to other end of SIP call.
Dim shell
Set shell = WScript.CreateObject("WScript.Shell")

'launch Windows Sound Recorder to play file then close on completion


shell.Run("sndrec32 /play /close " & args(1))
Set shell = Nothing
Case "-quit" 'close eyeBeam
ibeambot.Send "^q" 'Ctrl+q
Case "-record" 'record audio to file on/off toggle
'left-click mouse @ Record button once, ~instantaneously
If args.Count > 2 Then
If args(1) = "-ver" And (args(2) = "xlite" Or args(2) = "1.5") Then
ibeambot.MouseClick "left", 336, 204, 1, 0
End If
Else
ibeambot.MouseClick "left", 334, 236, 1, 0
End If
Case "-redial"
ibeambot.Send "^r" 'Ctrl+r
Case "-xferblind" 'blind transfer
ibeambot.Send "^t" 'Ctrl+t, initiate blind xfer
ibeambot.Send args(1) 'dial number of xfer target
ibeambot.Send "^t" 'Ctrl+t, complete blind xfer
'check display area if have msg that xfer failed
Case "-xfersup" 'supervised transfer
'assume you have 2 calls in progress, 1 active, 1 on hold
'use xfer button to connect 1 call to the other to complete xfer
'with transfer target as active call
ibeambot.Send "^t" 'Ctrl+t, initiate supervised xfer

ibeambot.Send "^" & args(1) 'Ctrl+number, line of transferee that's on


hold
ibeambot.Send "^t" 'Ctrl+t, complete supervised xfer
'check display area if have msg that xfer failed
Case "-xfervm" 'send/transfer to voicemail
ibeambot.Send "^s" 'Ctrl+s
default:
WScript.Echo "Invalid parameter(s), type ""cscript ibeambot.vbs -help""
for usage details."
End Select

Set args = Nothing


Set ibeambot = Nothing
WScript.Quit(0)

'''Helper methods'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub displayInfo
WScript.Echo "ibeambot.vbs - eyeBeam Command-Line Automation
Interface"
WScript.Echo "--------------------------------------------------------"
WScript.Echo "Version 1.0, July 25, 2007."
WScript.Echo "Requires AutoIt automation program installed. See
documentation."
WScript.Echo ""
WScript.Echo "For automating eyeBeam v1.1, v1.5, and X-Lite v3.0"
WScript.Echo "Designed to automate one instance of eyeBeam per desktop
only."
WScript.Echo "You can automate 1+ eyeBeams via use of psexec, or psexec
& Remote Desktop."

WScript.Echo "Can be used stand-alone or in conjunction with VTS for


automated testing."
WScript.Echo ""
WScript.Echo "Type ""cscript ibeambot.vbs -help"" for usage details"
WScript.Echo "Also refer to the ibeambot documentation"
WScript.Echo ""
End Sub

Sub displayUsage
Dim tab
'tab = Chr(9)
tab = " - "
displayInfo
WScript.Echo "Usage details:"
WScript.Echo "--------------"
WScript.Echo ""
WScript.Echo "cscript ibeambot.vbs -actionOption [data] [-ver] [verData]"
WScript.Echo ""
WScript.Echo tab & "[data] may be required or optional depending on the
action to perform. See action options below."
WScript.Echo tab & "[-ver] is optional & specifies which version of eyeBeam
is being used, which requires [verData] parameter"
WScript.Echo tab & "[verData] is required only if [-ver] is used."
WScript.Echo tab & "valid values are ""1.1"" (default), ""1.5"", and ""xlite"""
WScript.Echo ""
WScript.Echo "Action options:"
WScript.Echo "---------------"

WScript.Echo ""
WScript.Echo "?" & tab & "display help or usage information"
WScript.Echo "bancall" & tab & "ban current incoming call, see eyeBeam
v1.1 manual for details"
WScript.Echo "call [dial string]" & tab & "call the number specified by the
dial string, or currently dialed digits if dial string not supplied."
WScript.Echo "close" & tab & "close eyeBeam application"
WScript.Echo "conf" & tab & "toggle conference on/off"
WScript.Echo "dial [digits]" & tab & "dial valid DTMF digits 0-9,*, and #"
WScript.Echo "detectmwi" & tab & "detects message waiting indicator.
Returns 1 if found, or 0 if not."
WScript.Echo "dnd" & tab & "toggle DND"
WScript.Echo "exit" & tab & "close eyeBeam application"
WScript.Echo "flash" & tab & "press Flash. See ibeambot doc for details."
WScript.Echo "h" & tab & "display help or usage information"
WScript.Echo "help" & tab & "display help or usage information"
WScript.Echo "hold" & tab & "toggle call hold"
WScript.Echo "ignorecall" & tab & "use eyeBeam softkey to ignore incoming
call"
WScript.Echo "line [1-6]" & tab & "select a line from 1 to 6. X-Lite only has
lines 1-2."
WScript.Echo "mute" & tab & "toggle mute"
WScript.Echo "offhook" & tab & "go offhook (though not literally for SIP
client) to get dial tone & begin dialing"
WScript.Echo "onhook" & tab & "go onhook (end call or cancel current
action)"
WScript.Echo "open [path to executable]" & tab & "open eyeBeam/X-Lite
application, if not already open"
WScript.Echo "playwav [path to wave file]" & tab & "plays a wave file as
audio coming out of eyeBeam/X-Lite. See ibeambot doc for details."

WScript.Echo "quit" & tab & "close eyeBeam application"


WScript.Echo "record" & tab & "toggle eyeBeam audio record feature. See
ibeambot doc for details."
WScript.Echo "redial" & tab & "redial last dialed number"
WScript.Echo "xferblind [dial string]" & tab & "blind transfer current call to
specified number. Not supported on X-Lite."
WScript.Echo "xfersup [line]" & tab & "supervise transfer current call to
another line (1-6), see eyeBeam v1.1 manual for details. Not supported on XLite."
WScript.Echo "xfervm" & tab & "send incoming call directly to voicemail of
this eyeBeam SIP extension"
WScript.Echo ""
End Sub

Das könnte Ihnen auch gefallen