Sign in to follow this  
Followers 0
scriptstopper

Conference Call Script

6 posts in this topic

#1 ·  Posted (edited)

I should have gone out today. The weather was terrible, but hey!

Now, my wife has turned against me. (just kidding guys...)

Even my pillow hates me, as the country song goes.

CLAIMER: I am NOT A PROGRAMMER!!

But please post any improvements.

Scene is: I am overseas from the location of this conference. The conference provides a Skype-port, no SIP port.

I found the converted Call.vbs script (that 'AirWolf123' converted) and HEAVILY modified it to the point where it really just has a few lines of text which are the same.

Anyway, I've LOADS of paperwork to do, and not much time to do it in.

Meanwhile, I couldn't have my server not making it into these calls.

;All Settings are set at the top of the script, between [[[ and ]]]
; [[[ Change the following as needed:
;
; BEFORE using this script, there are a few prerequisites which stop your hair from falling out:
;
; You MUST have the following three (3) applications installed:
; 1) MP3 Skype Recorder (v1.9.0.1)
; 2) Skype (v4.2.x or 5.x)
; 3) AutoIt (v3.x).. naturally :)
; Not strictly necessary, but helpful and recommended:
; 4) pv.exe (sets the application priority), free, available from http://www.teamcti.com/pview/prcview.htm. Put it in the computer's PATH.
; 5) pskill.exe (closes applications), free from microsoft. Run 'pskill.exe' once, you have to agree to the license terms. Put it in the computer's PATH.
;
; Configure MP3 Skype Recorder:
; 1A) Maybe you want to have the MP3 file saved into a specific folder, such as '\xyzconferencefolder'?
; 1B) Maybe you do not use MP3 Skype Recorder for recording ALL your daily Skype voice calls?
; 1C) If MP3 Skype Recorder RECORD=ON is normally set OFF, or if you forget to turn it ON, MSR will NOT record the call, UNLESS one follows the steps below.
;
;     If you do _nothing_ with MSR except install it, this script detects the missing MP3 Skype Recorder configuration, and the script runs anyway.
;
; To configure MP3 Skype Recorder:
; 1) Setup MP3 Skype Recorder at 32kbs, mono. Set a default recording file folder. Allow it to access Skype (look for alert in Skype)
; 2) Exit MP3 Skype Recorder. There is a preference file called 'user.config'. Copy this file to 'user.config.recordingonxyz' and
; 3) Modify the location in 'user.config.recordingonxyz' to be a custom recording folder for the conference recordings, so they are not intermingled with your
;    private phone calls.
;
$NameOfCall = "xyz conference" ; Give the call a name for your reference, like "xyz conference call".
;
; Set the following to be whatever recording preference file you created for MP3 Skype Recorder for this specific call/script
; e.g. $RecordingConfig = "user.config.recordingonxyz"
;
$RecordingConfig = "user.config.recordingonxyz" ; Set to -1 for no custom recording config, script will use your current config
;
; What file name should the MP3 Skype Recorder configuration be backed-up to while the call is in progress?
; Should _not_ need to change the following:
$BackupMSRConfig = "user.config.backup"
;
$ContactToDial = "skypeonferencing.com" ; Skype contact name or +12125551212 number in that format i.e. "+12125551212"
;
$IVRConferenceCommands = "12323#" ; Conference #. There is NO testing for NO conference number, you _must_ have a number in here, usually followed by #, e.g. 12323#
;
; Some conference systems have a additional 'press 1 to agree this call is being recorded'.
$IVRAdditionalCommands = -1 ; "1*" ; -1 ; Use -1 for no additional commands, otherwise enclose the dial-pad commands in quotes, e.g. "123#"
;
;
; Set %MaxmimumCallTime. We use the $MaximumCallTime for two reasons:
; A conference call to 6 hours is unusual, but when it does rarely happen, it's commonly because the host forgot to end the call or dropped-off.
; $MaximumCallTime is also used for testing this script, set to one or two minutes.
; Maximum call time in minutes. Call is forcibly disconnected after this time. Can be good if Host forgets to end the call.
;
$MaximumCallTime = 380 ; Typically 360 (minutes, 6 hours). 1 or 2 for script testing.
;
$MinimumCallTime = 100 ; Sometimes the Host has to restart the call early on or there are other troubles. The call should go on for at least $MinimumCallTime many minutes. Script redials if less than $MinimumCallTime.
;
; What status would you like Skype to be in after the call? Common choices are INVISIBLE, ONLINE, or DND.
$StatusAfterCall = "AWAY" ; status is always DND during the call.
;
; Do you want to have Skype restarted before dialling up? Re-starting can fix some call quality issues, break-ups half-way into a long call.
$RestartSkype = True
;
; If you use OpenVPN, do you want to turn off OpenVPN? (secure internet tunnel). If you are not sure, leave this as False (If you do not know, leave this as False)
$OpenVPN = False
;
; If you have a single-user system (like an ordinary single-user laptop) then the following TWO options are ordinarily False
$PSKillMethod = True ; _if you have a multi-user system with multiple people running Skype and MP3 Skype Recorder, AutoIt ProcessClose() function does not work_.
; Instead of ProcessClose(), we use the free third-party utility PSKill, which only 'sees' local user processes.
;
$AppsPath = EnvGet("PROGRAMFILES") ; you can use PROGRAMFILES as the basis for the folder of MP3 Skype Recorder, or set your
; own startup command for MP3 Skype Recorder, if you have a custom script
; $MP3RecorderPath = ($AppsPath & "\MP3 Skype Recorder\mp3 skype recorder.exe") ; or put in a custom path
$MP3RecorderPath = ("mp3high.cmd") ; custom mp3 launch path command.
$SkypePath = ("skypehigh.cmd") ; custom skype launch path command, only used if $SkypeCustomMount = True
;
$UserPath = EnvGet("USERPROFILE")
$RelayStatus = True ; 'Primitive' but functional inter-user communication method: if you have a multi-user system or use your own computer during the call and want to avoid drop-outs,
; .. the above as "True" can be used to create a file when the call is ended, which a separate AutoIt script (see below) runs under either the local AND/OR another user's account on the same computer, reducing priority of Firefox and other apps that may interfere. Also setting THEIR Skype to DND, thereby minimizing recording interference.
; $RelayStatus has significant use on older, single-core systems. Requires:
; 1) Decide on a common READ/WRITE location ($RelayStatusPath). All accounts must have access R/W.
; 1) Prior to running the main conference (this) script, in the common folder (below), make a blank text file and call it 'callstatus.txt'.
;
$RelayStatusPath = ("D:\yourcommonpath\callstatus\") ; MUST end in a slash. Should be a common user R/W location. MUST contain a 'callstatus.txt' file.
;
; Do _not_ change the next line from False unless you know what you are doing with it..
$SkypeCustomMount = False ; this is used when Skype runs from a specialized CMD script
;
; Do _not_ change the following setting unless you have a good reason,
;   i.e. the author of MP3 Skype Recorder updates the location of the configurations, Or
;   i.e. you have some language-localized version of Windows
;     This value doesn't typically vary from one computer to the next..
;
;     Unless alex (the guy who wrote MP3 Skype Recorder) updates his software and changes the ridiculously long path below, the default below works.
;
$PathToConfig = "\Local Settings\Application Data\Alexander_Nikiforov\MP3_Skype_Recorder.exe_Url_rttyapoey00k3qd0mc3ntgkhl5tno54t\1.9.0.1\"
;
;  end of the user-settings.]]]


; _DO NOT CHANGE_ any script from here to the end.
;// Create a Skype4COM object:
$oSkype = ObjCreate("Skype4COM.Skype")
$oSkypeEvent = ObjEvent($oSkype,"Skype_")
$oError = ObjEvent("AutoIt.Error","MyErrFunc")

;// Declare the following Skype constants:
$cUserStatus_Offline = $oSkype.Convert.TextToUserStatus("OFFLINE")
$cUserStatus_Online = $oSkype.Convert.TextToUserStatus("ONLINE")
$cUserStatus_Invisible = $oSkype.Convert.TextToUserStatus("INVISIBLE")
$cUserStatus_DND = $oSkype.Convert.TextToUserStatus("DND")
$cUserStatus_Away = $oSkype.Convert.TextToUserStatus("AWAY")
;
$cCallStatus_Unknown = $oSkype.Convert.TextToCallStatus("UNKNOWN") ; -1
$cCallStatus_Unplaced = $oSkype.Convert.TextToCallStatus("UNPLACED") ; 0
$cCallStatus_Routing = $oSkype.Convert.TextToCallStatus("ROUTING") ; 1
$cCallStatus_EarlyMedia = $oSkype.Convert.TextToCallStatus("EARLYMEDIA") ; 2
$cCallStatus_Failed = $oSkype.Convert.TextToCallStatus("FAILED") ; 3
$cCallStatus_Ringing = $oSkype.Convert.TextToCallStatus("RINGING") ; 4
$cCallStatus_Inprogress = $oSkype.Convert.TextToCallStatus("INPROGRESS") ; 5
$cCallStatus_OnHold = $oSkype.Convert.TextToCallStatus("ONHOLD") ; 6
$cCallStatus_Finished = $oSkype.Convert.TextToCallStatus("FINISHED") ; 7
$cCallStatus_Missed = $oSkype.Convert.TextToCallStatus("MISSED") ; 8
$cCallStatus_Refused = $oSkype.Convert.TextToCallStatus("REFUSED") ; 9
$cCallStatus_Busy = $oSkype.Convert.TextToCallStatus("BUSY") ; 10
$cCallStatus_Cancelled = $oSkype.Convert.TextToCallStatus("CANCELLED") ; 11
$cCallStatus_LocalHold = $oSkype.Convert.TextToCallStatus("LOCALHOLD") ; 12
$cCallStatus_RemoteHold = $oSkype.Convert.TextToCallStatus("REMOTEHOLD") ; 13
;
$cAttachmentStatus_Available = $oSkype.Convert.TextToAttachmentStatus("AVAILABLE")

Opt("TrayMenuMode",1)   ; Default tray menu items (Script Paused/Exit) will not be shown.
$trayendcall      = TrayCreateItem("End Call")
;TrayCreateItem("")
;$trayexititem       = TrayCreateItem("Exit")
TraySetState(1)

; define some variables:
Dim $MinutesSpentOnCall
Dim $MinutesRemainingOnCall
$MinutesSpentOnCall = 0 ; initialize to 0 minutes
; Initialize $MinutesRemainingOnCall to $MaximumCallTime
$MinutesRemainingOnCall = $MaximumCallTime
; The number of seconds required to make up one increment on the call meter:
$SecondsInOneIncrement = ($MaximumCallTime * 6) / 10 ; MaxCallTime(minutes) * 60 seconds * / 100 increments = Seconds in an increment

ProgressOn("Pre-flight checks", "Pre-flight checks", "Setting up for the call",-1,-1,16)
Sleep(3000) ; display initial box for 3 seconds
If $RestartSkype = True Then ; Close Skype (to restart Skype)
    ProgressSet(5, "Restarting skype to avoid audio problems.","$RestartSkype = " & $RestartSkype)
    If $PSKillMethod = False Then
        ProcessClose("Skype.exe")
    Else
        Run("pskill.exe skype.exe", "", @SW_HIDE)
    EndIf
    Sleep(10000) ; wait 10 seconds for skype to close, leaving progress-box onscreen
EndIf

If $OpenVPN = True Then ; stop the OpenVPN connection.
    ProgressSet(10,"Stopping OpenVPN service. Closing tunnel","$OpenVPN = " & $OpenVPN)
    Run("sc.exe stop OpenVPNService", "", @SW_HIDE)
    Sleep(10000) ; wait 10 seconds for OpenVPN tunnel to close, leave progressbar on screen
ElseIf $OpenVPN = False Then ; OpenVPN is not used, or don't stop the tunnel (not recommended)
    Sleep(1000) ; 1 second pause
Else ; if $OpenVPN is set to some other value than True or False, crash
    ProgressSet(90,"OpenVPN: $OpenVPN set to " & $OpenVPN & ".","Bad script setting")
    ProgressSet(100,"OpenVPN: It must be True or False. Exiting ..")
    Sleep(10000) ; wait 10 seconds to display message, before exiting script
    ProgressOff()
    Exit
EndIf

If $RelayStatus = True Then FileDelete($RelayStatusPath & "callended.txt") ; clean-up the callended.txt from previous calls

;// Check if Skype is running and start or re-start the Skype client:
If Not $oSkype.Client.IsRunning Then
    ProgressSet(20, "Skype: Opening..","Skype")
    Sleep(2000)
    If $SkypeCustomMount = True Then
        ProgressSet(20, "Skype: Custom launch..")
        Sleep(1500)
        Run($SkypePath)
    ElseIf $SkypeCustomMount = False Then
        ProgressSet(20, "Skype: Normal launch..")
        Sleep(1500)
        $oSkype.Client.Start()
    Else
        ProgressSet(90,"Skype: $SkypeCustomMount is set to " & $SkypeCustomMount,"Bad script setting")
        Sleep(3000) ; wait 3
        ProgressSet(100,"Skype: It must be True or False. Exiting..")
        Sleep(4000) ; wait 4 seconds with message, then close script
        ProgressOff()
        Exit
    EndIf
    ;40 second delay while Skype is re-starting, 1.6 seconds per increment
    Local $timeremaining
    $timeremaining = 40
    ; Initialize %timeremaining to 40 seconds
    For $i = 20 to 44 step 1
        If $RestartSkype = True Then ProgressSet( $i, "Please wait while Skype re-starts and logs in..", "Skype: Re-starting, " & Round($timeremaining,2) & " seconds")
        If $RestartSkype = False Then ProgressSet( $i, "Please wait while Skype starts and logs in..", "Skype: Starting, " & Round($timeremaining,2) & " seconds")
        $timeremaining = $timeremaining - 1.6
        ; sleep for 1.6 seconds
        Sleep(1600)
    Next
    If $RestartSkype = True Then ProgressSet( $i, "Please wait while Skype re-starts and logs in..", "Skype: Re-starting..")
    If $RestartSkype = False Then ProgressSet( $i, "Please wait while Skype starts and logs in..", "Skype: Starting..")
    Sleep(1600)
    If $RestartSkype = True Then ProgressSet(45,"Skype should be logged back in by now..","Skype: Re-started")
    If $RestartSkype = False Then ProgressSet(45,"Skype should be logged in by now..","Skype: Started")
    sleep(2000) ; pause for 2 seconds
EndIf

ProgressSet(45,"","MP3 Skype Recorder config Clean-up")

; Clean-up routine. If the script was previously cancelled during a call, leaving MP3 Skype Recorder using a custom non-default configuration, then
If FileExists($UserPath & $PathToConfig & $BackupMSRConfig) Then ; If we find a user.config.backup THEN
    $BackupConfigExists = True
    ProgressSet(45,"Found earlier " & $BackupMSRConfig & " backup of config")
    Sleep(3000)
    ProgressSet(46,"Closing MP3 Skype Recorder.")
    If $PSKillMethod = False Then
        ProcessClose("MP3 Skype Recorder.exe")
    Else
        Run('pskill.exe "MP3 Skype Recorder.exe"', "", @SW_HIDE)
    EndIf
    Sleep(2000)
    ProgressSet(47,"Restoring MP3 Skype Recorder configuration. Please wait.")
    Sleep(2000)
    ProgressSet(48,"Copying previous configuration " & $BackupMSRConfig & " over running 'user.config'")
    FileCopy($UserPath & $PathToConfig & $BackupMSRConfig,$UserPath & $PathToConfig & "user.config",1)
    Sleep(2000)
    ProgressSet(49,"Deleting old backup. Please wait.")
    Sleep(2000)
    FileDelete($UserPath & $PathToConfig & $BackupMSRConfig)
    ProgressSet(50,"Re-starting MP3 Skype Recorder.")
    Run($MP3RecorderPath)
    Sleep(4000)
    ProgressSet(51,"MP3 Skype Recorder restarted.")
    Sleep(2000)
ElseIf Not FileExists($UserPath & $PathToConfig & $BackupMSRConfig) Then ; If we don't find a user.config.backup THEN
    ProgressSet(51,"No old MP3 Skype Recorder backup found as " & $BackupMSRConfig & ", continuing..")
    Sleep(5000)
    $BackupConfigExists = False
EndIf

ProgressSet(55,"","MP3 Skype Recorder Set-up") ; setting up MP3 Skype Recorder for the call

; If there is a call-specific configuration for MP3 Skype Recorder, now the script is going to switch to it.
;
; To pre-configure for the test:
;   Setup MP3 Skype Recorder so it is working, and recording.
;   Copy the working user.config -> $RecordingConfig i.e. user.config.recordingonxyz, (see below)
If $RecordingConfig = -1 Then
    ProgressSet(55,"No custom $RecordingConfig set, continuing..")
    Sleep(3000)
ElseIf $RecordingConfig <> -1 Then
    If FileExists($UserPath & $PathToConfig & $RecordingConfig) Then ; IF there is a customized recording config available, THEN
        $ConfigFileExists = True
        ProgressSet(55,"Found " & $RecordingConfig & " for Call Recorder") ; Update the Progress meter box
        Sleep(3000) ; pause for 3.5 seconds to display progress message.
        ProgressSet(58,"Closing mp3 Skype Recorder to change configurations")
        If $PSKillMethod = False Then
            ProcessClose("MP3 Skype Recorder.exe")
        Else
            Run('pskill.exe "MP3 Skype Recorder.exe"', "", @SW_HIDE)
        EndIf
        Sleep(2000)
        ProgressSet(62,"Copying " & $RecordingConfig & " over existing config..")
        FileCopy ($UserPath & $PathToConfig & "user.config",$UserPath & $PathToConfig & $BackupMSRConfig,1) ; backing up current config
        FileCopy ($UserPath & $PathToConfig & $RecordingConfig,$UserPath & $PathToConfig & "user.config",1) ; over-write current config with $RecordingConfig
        Sleep(3000)
        ProgressSet(65,"Starting MP3 Skype Recorder..")
        Run($MP3RecorderPath) ; re-start mp3 skype recorder
        Sleep(2000)
    ElseIf Not FileExists($UserPath & $PathToConfig & $RecordingConfig) Then
        $ConfigFileExists = False
        ProgressSet(55,"$RecordingConfig is set to " & $RecordingConfig & " but does not exist.")
        Sleep(2500) ; pause for 3.5 seconds to display progressset message.
        ProgressSet(57,"Please fix if you like. This script will continue now anyway..")
        Sleep(2500) ; pause to display message
        ProgressSet(68,"No separate recording config, continuing..")
        Sleep(2500)
    EndIf
EndIf

ProgressSet(70, "Preparing to call " & $NameOfCall & ".")
Sleep(2000)

ProgressSet(75,"Setting task priority of Skype and MP3 Call Recorder higher.","Pre-flight checks")
;// Skype HIGH priority, MP3 Skype Recorder Above Normal (could also be HIGH if you like, change accordingly)
Run('pv.exe -pa "MP3 Skype Recorder.exe"', "", @SW_HIDE)
Run('pv.exe -ph skype.exe', "", @SW_HIDE)
;// If normal desktop session and Firefox, for example, uncomment the following line, and (add lines for) any other CPU intensive apps on low-speed computers.
Run('pv.exe -pi firefox.exe', "", @SW_HIDE)
;   Run(@ComSpec & " /c " & 'pv.exe -pi thunderbird.exe', "", @SW_HIDE) ; don't forget " " before "/c"
Sleep(2000)
ProgressSet(100,"Call preparation completed.","Done!")
Sleep(3000)
ProgressOff()

;// The PlaceCall command will fail if the user is offline. To avoid failure, check user status and change to do not disturb:
If $cUserStatus_DND <> $oSkype.CurrentUserStatus Then
    While $cUserStatus_DND <> $oSkype.CurrentUserStatus
        $oSkype.ChangeUserStatus($cUserStatus_DND)
        MsgBox(0,"Setting user status","Changing user status to Do Not Disturb",2)
        Sleep(300)
    WEnd
EndIf

;// Create a user object: i.e. select the contact
$oUser = $oSkype.User($ContactToDial)
MsgBox(0,"","User " & $oUser.Handle & " online status is " & $oSkype.Convert.OnlineStatusToText($oUser.OnlineStatus),2)

;// Initially place the conference call outbound
$oCall = $oSkype.PlaceCall($oUser.Handle)
Sleep(2000)

; 'See' what happens as a result of the first call
;  Wait until the first attempt at the call is in progress and return the relevant error if any other status occurs:

While 1 = 1 ; loop to check outcome of initial placing of call
    If $oCall.Status = $cCallStatus_Unknown Then ; -1
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000) ; the call status is not known. Wait one second, and check again.
    ElseIf $oCall.Status = $cCallStatus_Unplaced Then ; 0
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000) ; This happens sometimes... Redial!
        CallConference() ; The call failed. Place the call again. REDIAL
    ElseIf $oCall.Status = $cCallStatus_Routing Then ; 1
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000) ; the call is being routed. Wait one second, and check again.
    ElseIf $oCall.Status = $cCallStatus_EarlyMedia Then ; 2
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000) ; wait one second, the call is ringing.. more common on POTS lines than skype-to-skype
    ElseIf $oCall.Status = $cCallStatus_Failed Then ; 3
        MsgBox(0,"Call failure.","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        MsgBox(0,"Call failed.","Technical reason:" & $oSkype.Convert.CallFailureReasonToText($oCall.FailureReason),5)
        CallConference() ; The call failed. Place the call again. REDIAL
    ElseIf $oCall.Status = $cCallStatus_Ringing Then ; 4
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000) ; wait one second, the call is ringing.. more common on POTS lines than skype-to-skype
    ElseIf $oCall.Status = $cCallStatus_InProgress Then ; 5 ;// Call is 'LIVE'
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        ; call is in progress, do CallInProgress function
        CallInProgress()
        Sleep(1000) ; wait one second, the call is in progress..
    ElseIf $oCall.Status = $cCallStatus_OnHold Then ; 6
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000) ; wait one second then Exit script, the call is on hold, you should never be on hold from a conference board
        MsgBox(0,"Should not see 'on hold' with a conference call, exiting... ","Call status: " & $oSkype.Convert.CallStatusToText($oCall.Status),100)
        Exit
    ElseIf $oCall.Status = $cCallStatus_Finished Then ; 7 ;// Call is normally completed by Host.
        ;
        ; At this event time when $oCall.Status = finished, CallInProgress() has already been called..
        ; .. This loop can only detect the call has a 'Finished' status AFTER
        ; the error checking done within the CallInProgress() function,
        ; we do not normally arrive at this point unless the call has gone on for $MinimumCallTime, and
        ; other states have been checked via routines in CallInProgress(), one of which has set
        ; $oCall.Finish(), which is setting the call directly to 'Finished'
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000) ; The call is finished
        CallFinished() ; do the clean-up routine
        Exit
    ElseIf $oCall.Status = $cCallStatus_Missed Then ; 8
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000) ; Have no idea what 'missed' is, but we try again anyway.
        CallConference() ; The call 'missed'. Place the call again. REDIAL
    ElseIf $oCall.Status = $cCallStatus_Refused Then ; 9
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000)
        CallConference() ; Call was refused (other party or conference system sent BUSY). Place the call again. REDIAL
        ; and we want to do some unique things here with regards to the call refused/busy
    ElseIf $oCall.Status = $cCallStatus_Busy Then ; 10
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000) ; the conference system said 'BUSY' so we wait 1 second then dial again
        CallConference() ; Place the call again. REDIAL
        ; and we want to do some unique things here with regards to the POTS conference line being BUSY
    ElseIf $oCall.Status = $cCallStatus_Cancelled Then ; 11
        ; It looks like you cancelled the call locally, so we should exit the script here..
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        Sleep(1000)
        $oCall.Finish()
        ; and we want to do some unique things here with regards to the call being cancelled
    ElseIf $oCall.Status = $cCallStatus_LocalHold Then ; 12
        MsgBox(0,"","Loop call status report: " & $oSkype.Convert.CallStatusToText($oCall.Status),2)
        $oCall.Resume()
    EndIf
WEnd

;// Count down, allow the Host to finish the conference. If not, then finish the call forcibly after xx time (usually 6 hours):
Func CallInProgress()
    While $oCall.Status <> $cCallStatus_InProgress
        MsgBox(0,"Call status report:","Starting call: " & $oSkype.Convert.CallStatusToText($oCall.Status) & "-CIPBegin",2)
        Sleep(300)
    WEnd
    ProgressOn("Call in progress: " & $NameOfCall,"Waiting","Waiting",-1,-1,16)
    IVRSend() ; send the IVR codes
    ; ProgressOn()
    ProgressSet(0,"",Round($MinutesRemainingOnCall,2) & "/" & Round($MinutesSpentOnCall,2) & " min remaining/elapsed")
    For $OnePercentIncrement = 0 to 100 step 1
        ; Decide if the progress meter moves one more second towards one increment to 100%, depending on $oCall.Status and $MinimumCallTime:
        $SubLoop = 0
        For $SubLoop = 0 to $SecondsInOneIncrement ; For every second until $SecondsInOneIncrement is reached, do
                ; test for CallEnded, If True and over the $MinimumCallTime then exit the script because the call is 'over'
            If TrayItemGetState($trayendcall) = 65 Then ; IF the AutoIt script tray icon option 'End Call' is checked,
                    ; THEN begin wrapping up the call
                    ProgressSet(100,"Call finished: You chose 'end call'")
                    Sleep(3000)
                    ProgressOff()
                    $oCall.Finish() ; Send the command to Skype to end the call
                    Sleep(2000)
                    Return ; exit this function
            ElseIf $oCall.Status = $cCallStatus_Finished Then ; IF the callstatus is Finished
                    ; AND
                If $MinutesSpentOnCall > $MinimumCallTime Then ; IF the call has gone on longer than the minimum number of minutes .. process ending the call normally
                    ; THEN begin wrapping up the call
                    ProgressSet(100,"Call finished, reason code: " & $oSkype.Convert.CallFailureReasonToText($oCall.FailureReason))
                    Sleep(3000)
                    ProgressSet(100,"Call status " & $oSkype.Convert.CallStatusToText($oCall.Status) & ", likely host ended call normally.")
                    Sleep(3000) ; wait 3 seconds to display above progress meter message
                    ProgressOff()
                    $oCall.Finish() ; Send the command to Skype to end the call
                    Sleep(2000)
                    Return ; exit this function
                ElseIf $MinutesSpentOnCall <= $MinimumCallTime Then ; ELSE IF the call has not gone on long enough, redial
                    ProgressSet($OnePercentIncrement,"Call finished prematurely","< MinCallTime " & $oSkype.Convert.CallStatusToText($oCall.Status) & ", Re-dialing..")
                    Sleep(2000)
                    ProgressSet($OnePercentIncrement,"Call error while < $MinCallTime","Error " & $oSkype.Convert.CallFailureReasonToText($oCall.FailureReason) & ", Re-dialing..")
                    CallConference() ; Wait until Skype is DND, Select Skype Contact, and Redial
                    IVRSend() ; send the IVR codes
                Else
                EndIf ; next check for other call-status codes, inprogress, onhold locally (switch user causes this)
            ElseIf $oCall.Status = $cCallStatus_InProgress Then ; increment the InProgress progress box when the call status is in progress
                Sleep(1000) ; Wait 1 second then loop to check again on callstatus
                ProgressSet($OnePercentIncrement,  "Increment timer: " & $SubLoop & " of " & $SecondsInOneIncrement & " seconds.", Round($MinutesRemainingOnCall,2) & "/" & Round($MinutesSpentOnCall,2) & " min remaining/elapsed")
            ElseIf $oCall.Status = $cCallStatus_LocalHold Then ; doing a windows 'switch user' tends to cause skype to place the call locally on hold. We don't want this!
                $oCall.Resume()
            Else ; ELSE something else happened.. some OTHER error, let's redial!
                ProgressSet($OnePercentIncrement, "Call error: " & $oSkype.Convert.CallFailureReasonToText($oCall.FailureReason) & ", Re-dialing..", "Call error @ " & Round($MinutesSpentOnCall,2) & "m, Time " & @HOUR & @MIN & @SEC)
                Sleep(2500)
                ProgressSet($OnePercentIncrement, "Call status " & $oSkype.Convert.CallStatusToText($oCall.Status) & ", Re-dialing..")
                Sleep(2500); wait to display progress message, and for internal callstatus to update to something else other than 'Finished' to get another reading
                ProgressSet($OnePercentIncrement, "Call error while duration < $MaximumCallTime","Re-dialing Conference..")
                CallConference() ; Wait until Skype is DND, Select Skype Contact, and Redial
                IVRSend() ; send the IVR codes
            EndIf
        Next
    $MinutesSpentOnCall = $MinutesSpentOnCall + $MaximumCallTime/100
    $MinutesRemainingOnCall = $MinutesRemainingOnCall - $MaximumCallTime/100
    Next    ; and loop back to For
    ;
    ; IF the call lasted till the $MaximumCallTime allowed, THEN alter the Progress box to indicate.
    ;
    If $cCallStatus_InProgress = $oCall.Status Then ProgressSet(100 , $MaximumCallTime & " minutes, forcibly disconnecting..", "Call reached maximum time")
    Sleep(3000)
    ProgressOff()
    ; Force the call to finish
    $oCall.Finish()
    Sleep(2000)
EndFunc

Func CallConference()
    ;// The PlaceCall command will fail if the user is offline. To avoid failure, check user status and change to do not disturb:
    If $cUserStatus_DND <> $oSkype.CurrentUserStatus Then
        While $cUserStatus_DND <> $oSkype.CurrentUserStatus
            $oSkype.ChangeUserStatus($cUserStatus_DND)
            MsgBox(0,"Setting user status","Changing user status to Do Not Disturb",2)
            Sleep(300)
        WEnd
    EndIf

    ;// Create a user object: i.e. select the contact
    $oUser = $oSkype.User($ContactToDial)
    MsgBox(0,"","User " & $oUser.Handle & " online status is " & $oSkype.Convert.OnlineStatusToText($oUser.OnlineStatus),2)

    ;// Initially place the conference call outbound
    $oCall = $oSkype.PlaceCall($oUser.Handle)
    Sleep(2000)
EndFunc

Func CallFinished()
; Clean-up tasks after call
;// Finished call normally. Now do post-call tasks
    MsgBox(0,"Call shut down, finished.","Call finished.",3)
    MsgBox(0,"","Call status: " & $oSkype.Convert.CallStatusToText($oCall.Status),3)
    ; and set the selected user status after the call
    If $RelayStatus = True Then FileCopy($RelayStatusPath & "callstatus.txt",$RelayStatusPath & "callended.txt") ; notify the external script(s) that
        ; .. the call has ended.
    $oSkype.ChangeUserStatus($oSkype.Convert.TextToUserStatus($StatusAfterCall))
    ProgressOn("Post-Call Clean-up","Post-Call Clean-up.", "Post-Call Clean-up",-1,-1,16)
    Sleep(2000)
    If $OpenVPN = True Then ;// restart openvpn connection
        ;// start openvpn connection after normal call ending
        Run('sc.exe start OpenVPNService', "", @SW_HIDE)
        Local $OpenVPNRestartTime
        $OpenVPNRestartTime = 30 ; (Must be in seconds)
        ProgressSet(10, $OpenVPNRestartTime & " seconds remaining", "OpenVPN re-starts.")
        Dim $MinutesRemainingOnCall
        $MinutesRemainingOnCall = $OpenVPNRestartTime
        For $OpenVPNRestart = 2 to 32 step 1
            ProgressSet( $OpenVPNRestart, Round($MinutesRemainingOnCall,0) & " seconds remaining")
            $MinutesRemainingOnCall = $MinutesRemainingOnCall - $OpenVPNRestartTime/100
            sleep($OpenVPNRestartTime * 10)
        Next
        ProgressSet(35 , "OpenVPN tunnel established", "OpenVPN restarted.")
        sleep(3000)
    EndIf
    ;// Continue Clean-up: MP3 Skype Recorder back to original config
    If FileExists($UserPath & $PathToConfig & $BackupMSRConfig) Then ; If we earlier found a user.config.recordingxxxx and created a user.config.backup
        $BackupConfigExists = True
        ProgressSet(40,"Found " & $BackupMSRConfig & " backup of config for MP3 Skype Call Recorder")
        Sleep(3000)
        ProgressSet(45,"Closing MP3 Skype Recorder.")
        If $PSKillMethod = False Then
            ProcessClose("MP3 Skype Recorder.exe")
        Else
            Run('pskill.exe "MP3 Skype Recorder.exe"', "", @SW_HIDE)
        EndIf
        Sleep(2000)
        ProgressSet(50,"Restoring MP3 Skype Recorder configuration. Please wait.")
        Sleep(2000)
        ProgressSet(55,"Copying previous configuration " & $BackupMSRConfig & " over existing config " & $RecordingConfig)
        FileCopy ($UserPath & $PathToConfig & $BackupMSRConfig,$UserPath & $PathToConfig & "user.config",1)
        Sleep(2000)
        ProgressSet(60,"Deleting backup " & $BackupMSRConfig & ". Please wait.")
        Sleep(2000)
        FileDelete($UserPath & $PathToConfig & $BackupMSRConfig)
        ProgressSet(65,"Re-starting MP3 Skype Recorder.")
        Run($MP3RecorderPath) ; run mp3 skype recorder.exe
        Sleep(4000)
        ProgressSet(75,"MP3 Skype Recorder restarted.")
        Sleep(2000)
    ElseIf Not FileExists($UserPath & $PathToConfig & $BackupMSRConfig) Then
        ProgressSet(40,"No " & $BackupMSRConfig & " found, see next message..")
        Sleep(2000)
        ProgressSet(50,"If you want to make ensure call recording is ON, ")
        Sleep(2500)
        ProgressSet(60,"Turn recording ON for MP3 Skype Recorder, ")
        Sleep(2500)
        ProgressSet(75,"Then copy the existing user.config to " & $RecordingConfig)
        Sleep(3000)
        $BackupConfigExists = False
    EndIf
    ProgressSet(85,"Setting MP3 Skype Recorder to above-normal priority")
    Run('pv.exe -pa "mp3 Skype Recorder.exe"', "", @SW_HIDE)
    Sleep(2000)
    ProgressSet(90,"Setting Firefox back to normal priority")
    Run('pv.exe -pn firefox.exe', "", @SW_HIDE)
    Sleep(2000)
    ProgressSet(100,"Call completed. Script completed.","Done!")
    Sleep(10000)
    ProgressOff()
EndFunc

MsgBox(0,"You should NOT see this. Maybe a bug.","Exceptional exit call status: " & $oSkype.Convert.CallStatusToText($oCall.Status),200)

;// The AttachmentStatus event handler monitors attachment status and automatically attempts to reattach to the API following loss of connection:
;Func Skype_AttachmentStatus($aStatus)
;   MsgBox(0,"","Attachment status " & $oSkype.Convert.AttachmentStatusToText($aStatus),2)
;   If $aStatus = $cAttachmentStatus_Available Then
;       $oSkype.Attach()
;   EndIf
;EndFunc

;// If the call status is "failed", the CallStatus event handler returns the relevant failure reason as text:
;Func Skype_CallStatus($aCall, $aStatus)
;   MsgBox(0,"","Call " & $aCall.Id & " status " & $aStatus & " " & $oSkype.Convert.CallStatusToText($aStatus),2)
;   If $cCallStatus_Failed = $aStatus Then
;       MsgBox(0,"","Failure reason:" & $oSkype.Convert.CallFailureReasonToText($aCall.FailureReason),2)
;   EndIf
;EndFunc

; The IVR codes have not been softcoded, you need to change the numbers below for the time being
Func IVRSend()
;// Wait then send DTMF tones for use with interactive voice response (IVR) applications:
    While $oCall.Status <> $cCallStatus_InProgress
        ProgressSet(0,"Waiting for Call InProgress, " & $oSkype.Convert.CallStatusToText($oCall.Status),"IVR Commands: Waiting")
        Sleep(300)
    WEnd
    ProgressSet(0,"Waiting for IVR system","IVR Commands: Waiting")
    ;
    ;// If it's a Skype contact, then the pause should be shorter (about 5500) as these connect almost immediately
    ;// If it's a POTS (normal telephone number), then it should be _about_ 9000 (longer)
    ;
    Sleep(5500)
    If $cCallStatus_InProgress = $oCall.Status Then ; test to make sure the call continues to be active
        ProgressSet(5,"Muting microphone","IVR Commands: Preparing")
        $oSkype.Mute = "True" ; mute the microphone on the laptop or headset so room noise is not picked up on the recording
    EndIf
    ; we ASSUME there are IVR codes to send, there is _no_ testing of $IVRConferenceCommands
    ProgressSet(10,"Sending the commands: " & $IVRConferenceCommands,"IVR Commands: Sending")
    Sleep(1000)
    $aICC = StringSplit($IVRConferenceCommands,"")
    For $IVRSendLoop = 1 to $aICC[0]
        If $cCallStatus_InProgress = $oCall.Status Then
            $ProgressBarStatus = (10 + (65 / $aICC[0]) * $IVRSendLoop)
            ProgressSet($ProgressBarStatus,"Sending number " & $aICC[$IVRSendLoop])
            $oCall.DTMF = $aICC[$IVRSendLoop]
            Sleep(700)
        EndIf
    Next
    ; On some conferencing systems, it says "this call is being recorded, if you agree press '1'":
    ; $IVRAdditionalCommands
    If $IVRAdditionalCommands = -1 Then
        ProgressSet(80,"No additional IVR commands programmed in..")
        Sleep(1800)
        ProgressSet(85,"Continuing.")
    ElseIf $IVRAdditionalCommands <> -1 Then
        ProgressSet(80,"Waiting 1.8 seconds..","IVR Commands: Waiting")
        Sleep(1800)
        ProgressSet(85,"Sending additional IVR commands " & $IVRAdditionalCommands,"IVR Commands: Additional")
        ; i.e. "Press 1 to agree with the call recording"
        $aIAC = StringSplit($IVRAdditionalCommands,"")
        For $IVRSendLoopAC = 1 to $aIAC[0]
            If $cCallStatus_InProgress = $oCall.Status Then
                $ProgressBarStatus = (85 + (14 / $aIAC[0]) * $IVRSendLoopAC)
                ProgressSet($ProgressBarStatus,"Sending number " & $aIAC[$IVRSendLoopAC])
                $oCall.DTMF = $aIAC[$IVRSendLoopAC]
                Sleep(700)
            EndIf
        Next
    EndIf
    ProgressSet(100,"Conference code entered.","IVR Commands: Done!")
    Sleep(2000)
    ;ProgressOff()
EndFunc

Func MyErrFunc()
    ;Do Nothing
EndFunc
Edited by scriptstopper

don't think i'm a freeloader. your help has been effective! here's the script contributed - thank you creator and thank you members and thank you authors of autoit!Call Conference Dial-in Script updated from time to time.

Share this post


Link to post
Share on other sites



AD2010 10 02 some changes:

added pskill.exe method ; ProcessClose() does not work when there are multiple users logged into the computer, even regular users, and one of them runs this script and there are multiple instances of Skype.exe running, one in each account. For some reason, AutoIt can 'see' the other foreign processes and so refuses to close the one in the current session.

added the ability to put the conference call id # at the top of the script. It's not 'hardcoded' anymore into the function.

You MUST set a number here, usually it looks like "12345#" as the value.

added the ability to use an additional post-access-code number. See the notes.

Improved some cosmetic issues.


don't think i'm a freeloader. your help has been effective! here's the script contributed - thank you creator and thank you members and thank you authors of autoit!Call Conference Dial-in Script updated from time to time.

Share this post


Link to post
Share on other sites

AD2010 10 02 Call progress cosmetic fix


don't think i'm a freeloader. your help has been effective! here's the script contributed - thank you creator and thank you members and thank you authors of autoit!Call Conference Dial-in Script updated from time to time.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi!

AD2010 10 12 bunch more fixes

It's hardcore now. Won't drop the call for the first x minutes (defaults to 50).

If the Host even normally closes the call before $MinimumCallTime (x minutes) is up, it is presumed to be some kind of unwanted error/mistake, like the Host restarting the conference, and the script calls in again.

If the call ends anything other than 'finished' (normally) before $MaximumCallTime is up, it redials.

Regards!

Edited by scriptstopper

don't think i'm a freeloader. your help has been effective! here's the script contributed - thank you creator and thank you members and thank you authors of autoit!Call Conference Dial-in Script updated from time to time.

Share this post


Link to post
Share on other sites

AD 2010 11 03

Script modified:

Since the previous change during october, the script keeps dialing, no matter what, if the call ends before $MinimumCallTime is reached. One reason for the october-change is when the call ended due to certain error conditions, the script was not detecting the error from Skype: Skype would make a sound as though the call had failed, yet the script continued as though the call was finished normally. This may be a failure of the Skype4COM API interface, I don't know; I'm not making any claims, only conjecture.

As such, there is an additional need to have the script respond to a forced hang-up, for instance: when testing, or very unusually-short conference calls under the $MinimumCallTime, and to do post-call clean-up.

Also, the 'click to pause' feature of the script is not desired for the tray icon.

The AutoItv3 tray icon with the november update, has options modified to 'End call'. 'End call' can be checked right-away, as soon as the script is started. However the script will not test for the checked status, until the call has been fully set-up and at least dialed-in. THEN if 'End call' is checked, the call-disconnect and clean-up routine begins immediately.


don't think i'm a freeloader. your help has been effective! here's the script contributed - thank you creator and thank you members and thank you authors of autoit!Call Conference Dial-in Script updated from time to time.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

The next script is a separate, second script to run, on _other_ accounts active at the same time on the same computer as the _recording_ account (Terminal Server or hacked XP box).

Start time is one minute _before_ the recording script.

; 'CALL ON OTHER ACCOUNT' adjusts local Skype status to DND, and lowers app priorities.
;
; Script continuously monitors for the existence of a 'callended.txt' file, and then terminates.
; Otherwise, every x seconds it sets the priority lower for local applications (like firefox) which otherwise would tend to 'spike' the system
; and cause recording problems.
;
; Add all the applications below you _do not want to interfere_, common ones are mozilla-based apps like Firefox.exe, thunderbird.exe
; Requirements:
; 1) The mutual location for the 'callended.txt' file, is assumed to be read/write by the recording user AND any users running this script.
; 1a) You have to create an empty text file called 'callstatus.txt' in the shared location. (see below for location)
; 2) pv.exe (sets the application priority), free, available from http://www.teamcti.com/pview/prcview.htm
; 3) This script must start from Scheduled Tasks one minute _before_ the conference out-call script, and have a runtime one minute _longer_ than the conference script.
$NameonprogressBar = "Lowered app priority" ; title for progress bar, you can set this to whatever works for you. It's cosmetic. "Call in progress" might also work.
$MaximumCallTime = 382  ; 382, should be two minutes LONGER than the max-time in the conference call script, and begin 1 minute before.
                        ; example: this script starts at 9:54PM, conference script at 9:55PM and is 360minutes, this script should be 362 minutes
;
; $UserPath = EnvGet("USERPROFILE") ; not used
$RelayStatusPath = ("D:\yourcommonpath\callstatus\") ; $RelayStatusPath = ($UserPath & "\apps\scripts\"). MUST end in \
; Location of 'callstatus.txt', should be a common location where both accounts can read and write from.
;

; DO NOT CHANGE any of the following EXCEPT the list of apps (firefox, thunderbird, etc)
;// Create a Skype4COM object:
$oSkype = ObjCreate("Skype4COM.Skype")
$oSkypeEvent = ObjEvent($oSkype,"Skype_")
$oError = ObjEvent("AutoIt.Error","MyErrFunc")

;// Declare the following Skype constants:
$cUserStatus_Offline = $oSkype.Convert.TextToUserStatus("OFFLINE")
$cUserStatus_Online = $oSkype.Convert.TextToUserStatus("ONLINE")
$cUserStatus_Invisible = $oSkype.Convert.TextToUserStatus("INVISIBLE")
$cUserStatus_DND = $oSkype.Convert.TextToUserStatus("DND")
;
$cCallStatus_Unknown = $oSkype.Convert.TextToCallStatus("UNKNOWN") ; -1
$cCallStatus_Unplaced = $oSkype.Convert.TextToCallStatus("UNPLACED") ; 0
$cCallStatus_Routing = $oSkype.Convert.TextToCallStatus("ROUTING") ; 1
$cCallStatus_EarlyMedia = $oSkype.Convert.TextToCallStatus("EARLYMEDIA") ; 2
$cCallStatus_Failed = $oSkype.Convert.TextToCallStatus("FAILED") ; 3
$cCallStatus_Ringing = $oSkype.Convert.TextToCallStatus("RINGING") ; 4
$cCallStatus_Inprogress = $oSkype.Convert.TextToCallStatus("INPROGRESS") ; 5
$cCallStatus_OnHold = $oSkype.Convert.TextToCallStatus("ONHOLD") ; 6
$cCallStatus_Finished = $oSkype.Convert.TextToCallStatus("FINISHED") ; 7
$cCallStatus_Missed = $oSkype.Convert.TextToCallStatus("MISSED") ; 8
$cCallStatus_Refused = $oSkype.Convert.TextToCallStatus("REFUSED") ; 9
$cCallStatus_Busy = $oSkype.Convert.TextToCallStatus("BUSY") ; 10
$cCallStatus_Cancelled = $oSkype.Convert.TextToCallStatus("CANCELLED") ; 11
;
$cAttachmentStatus_Available = $oSkype.Convert.TextToAttachmentStatus("AVAILABLE")

; clean-up from previous runs
FileDelete($RelayStatusPath & "callended.txt")

Func Apps_Priority($Priority)
    If $Priority = "Low" Then
        Run('pv.exe -pi firefox.exe', "", @SW_HIDE) ; firefox Idle
        Run('pv.exe -pb skype.exe', "", @SW_HIDE) ; Skype below normal
        Run('pv.exe -pb skypePM.exe', "", @SW_HIDE) ; SkypePM below normal
        Run('pv.exe -pi thunderbird.exe', "", @SW_HIDE) ; thunderbird idle
    ElseIf $Priority = "Normal" Then
        Run('pv.exe -pn firefox.exe', "", @SW_HIDE) ; firefox normal
        Run('pv.exe -ph skype.exe', "", @SW_HIDE) ; Skype high
        Run('pv.exe -pn skypePM.exe', "", @SW_HIDE) ; SkypePM normal
        Run('pv.exe -pn thunderbird.exe', "", @SW_HIDE) ; thunderbird normal
    EndIf
EndFunc

Func CallEnded($CE)
    If FileExists($RelayStatusPath & "callended.txt") Then
        $CE = True
    Else
        $CE = False
    EndIf
    Return $CE
EndFunc

Dim $MinutesSpentOnCall ; in minutes
Dim $MinutesRemainingonCall ; in minutes
$MinutesSpentOnCall = 0 ; initialize timespent to 0 minutes
; Initialize $MinutesRemainingonCall to $MaximumCallTime
$MinutesRemainingonCall = $MaximumCallTime ; in minutes
;
; The number of seconds required to make up one increment on the call meter:
$SecondsInOneIncrement = ($MaximumCallTime * 6) / 10 ; MaxCallTime(minutes) * 60 seconds * / 100 increments = Seconds in an increment
MsgBox(64,"Call beginning in one minute.","This script runs for " & $MaximumCallTime & " minutes; the purpose is to temporarly lower priority of common processes which interfere with recording.",15)
Apps_Priority("Low")
; change local skype status to DND so incoming messages/calls don't interrupt the system
Dim $SkypeStatusBeforeScriptRun
$SkypeStatusBeforeScriptRun = $oSkype.CurrentUserStatus
$oSkype.ChangeUserStatus($cUserStatus_DND)
MsgBox(0,"Setting user status","Changing user status to Do Not Disturb",2)
Sleep(300)
ProgressOn("Call in progress: " & $NameonprogressBar,"0 min elapsed, " & $MaximumCallTime & " min remaining","",0,0,16)
For $OnePercentIncrement = 0 to 100 step 1 ; for 1/100 (to 100%) ticks of the progress meter do..
    $MinutesSpentOnCall = $MinutesSpentOnCall + $MaximumCallTime/100
    $MinutesRemainingonCall = $MinutesRemainingonCall - $MaximumCallTime/100
    $SubLoop = 0
    For $SubLoop = 0 to $SecondsInOneIncrement ; For every second until $SecondsInOneIncrement is reached, do
        Dim $CallEnded
        ; test for condition, then If $FileExist(filename) then $Condition = True ; exit the script because the file was written to quit the script
        If CallEnded($CallEnded) = True Then ; if the call is over then make apps normal priority and end the script
            ProgressSet( $OnePercentIncrement,"$CallEnded = " & CallEnded($CallEnded) & ", $SubLoop = " & $SubLoop)
            Sleep(3000) ; we want to end the call
            ; If the call is normally Finished by the Host, then do a standard exit routine.
            Apps_Priority("Normal")
            ProgressSet(100,"Call completed " & "Reason code (not available)","Ending script..")
            Sleep(3000) ; wait 3 seconds to display above progress meter message
            ProgressOff()
            ExitLoop 2
        ElseIf CallEnded($CallEnded) = False Then ; False = no one has hung up the call. Set apps 'low' priority every 5 seconds
            Sleep(1000)
            ProgressSet( $OnePercentIncrement,"$CallEnded = " & CallEnded($CallEnded) & ", $SubLoop = " & $SubLoop)
            If Not $SubLoop = 0 Then ; IF this isn't the very beginning of the sleep increment when it is 0 then
                If IsInt($SubLoop/5) = 1 Then Apps_Priority("Low") ; every 5 seconds of the subloop set app priority low, otherwise keep going..
                If IsInt($SubLoop/5) = 1 Then ProgressSet( $OnePercentIncrement,"$CallEnded = " & CallEnded($CallEnded) & ", $SubLoop = " & $SubLoop & ", Apps set 'low'")
            EndIf ; end loop
        Else
        EndIf
    Next
    ; made it through callstatus testing for a whole increment.
    If CallEnded($CallEnded) = True Then ; the call has ended. End the routine.
        ProgressSet( $OnePercentIncrement,"$CallEnded = " & CallEnded($CallEnded) & ", $SubLoop = " & $SubLoop)
        Sleep(3000) ;
        Apps_Priority("Normal")
        ; If the callended signal is sent via the conference call script, then do a standard exit routine.
        ProgressSet(100,"Call completed " & "Reason code (not available)","Ending script..")
        Sleep(3000) ; wait 3 seconds to display above progress meter message
        ProgressOff()
        ExitLoop 1
    Else ; the call has not ended
        Apps_Priority("Low")
        ; increment the progress box main text
        ProgressSet( $OnePercentIncrement,"",Round($MinutesRemainingonCall,2) & " min remaining, " & Round($MinutesSpentOnCall,2) & " min elapsed")
    EndIf
Next
;
; IF the call lasted till the $MaximumCallTime allowed, THEN alter the Progress box to indicate.
; Here, we increment the Progress box to 100% when the conference is ended by the Host
ProgressSet(100 , $MaximumCallTime & " minutes, forcibly closing script..", "Call reached maximum time")
Apps_Priority("Normal")
MsgBox(0,"Setting user status","Changing user status back to " & $SkypeStatusBeforeScriptRun,2)
$oSkype.ChangeUserStatus($SkypeStatusBeforeScriptRun)
Sleep(3000)
ProgressOff()

This is a separate, second script to run on the _same_ account as the one recording/calling the conference. Schedule it to start one minute before the recording/conference dialling script.

; 'CALL ON THIS ACCOUNT' adjusts only application priority during call (firefox, thunderbird, etc)
;
; Script continuously monitors for the existence of a file, and then terminates.
; otherwise, every x seconds it sets the priority lower for local applications (like firefox) which otherwise would tend to 'spike' the system
; and cause recording problems.
;
; Add all the applications below you _do not want to interfere_, common ones are mozilla-based apps like Firefox.exe, thunderbird.exe
; Requirements:
; 1) The mutual location for the 'callended.txt' file, is assumed to be read/write by the recording user AND any users running this script.
; 1a) You have to create an empty text file called 'callstatus.txt' in the shared location. (see below for location)
; 2) pv.exe (sets the application priority), free, available from http://www.teamcti.com/pview/prcview.htm
; 3) This script must start from Scheduled Tasks one minute _before_ the conference out-call script, and have a runtime one minute _longer_ than the conference script.
$NameonprogressBar = "lower-app priority" ; title for progress bar, you can set this to whatever works for you. It's cosmetic.
$MaximumCallTime = 382  ; 382, should be two minutes LONGER than the max-time in the conference call script, and begin 1 minute before.
                        ; exempli gratia: this script starts at 9:54PM, conference script at 9:55PM and is 360minutes, this script should be 362 minutes
;
; $UserPath = EnvGet("USERPROFILE") ; not used
$RelayStatusPath = ("D:\yourcommonpath\callstatus\") ; $RelayStatusPath = ($UserPath & "\apps\scripts\")
; Location of 'callstatus.txt', should be a common location where both accounts can read and write from.
;

; DO NOT CHANGE any of the following EXCEPT the list of apps (firefox, thunderbird, etc)

; clean-up from previous runs
FileDelete($RelayStatusPath & "callended.txt")

Func Apps_Priority($Priority)
    If $Priority = "Low" Then
        Run('pv.exe -pi firefox.exe', "", @SW_HIDE) ; firefox Idle
        Run('pv.exe -pi thunderbird.exe', "", @SW_HIDE) ; thunderbird idle
    ElseIf $Priority = "Normal" Then
        Run('pv.exe -pn firefox.exe', "", @SW_HIDE) ; firefox normal
        Run('pv.exe -pn thunderbird.exe', "", @SW_HIDE) ; thunderbird normal
    EndIf
EndFunc

Func CallEnded($CE)
    If FileExists($RelayStatusPath & "callended.txt") Then
        $CE = True
    Else
        $CE = False
    EndIf
    Return $CE
EndFunc

Dim $MinutesSpentOnCall ; in minutes
Dim $MinutesRemainingonCall ; in minutes
$MinutesSpentOnCall = 0 ; initialize timespent to 0 minutes
; Initialize $MinutesRemainingonCall to $MaximumCallTime
$MinutesRemainingonCall = $MaximumCallTime ; in minutes
;
; The number of seconds required to make up one increment on the call meter:
$SecondsInOneIncrement = ($MaximumCallTime * 6) / 10 ; MaxCallTime(minutes) * 60 seconds * / 100 increments = Seconds in an increment
MsgBox(64,"Call starting in one minute","This script runs for " & $MaximumCallTime & " minutes; the purpose is to temporarly lower priority of common processes which interfere with recording.",15)
Apps_Priority("Low")
; change local skype status to DND so incoming messages/calls don't interrupt the system
Sleep(300)
ProgressOn("Call in progress: " & $NameonprogressBar,"0 min elapsed, " & $MaximumCallTime & " min remaining","",0,0,16)
For $OnePercentIncrement = 0 to 100 step 1 ; for 1/100 (to 100%) ticks of the progress meter do..
    $MinutesSpentOnCall = $MinutesSpentOnCall + $MaximumCallTime/100
    $MinutesRemainingonCall = $MinutesRemainingonCall - $MaximumCallTime/100
    $SubLoop = 0
    For $SubLoop = 0 to $SecondsInOneIncrement ; For every second until $SecondsInOneIncrement is reached, do
        Dim $CallEnded
        ; test for condition, then If $FileExist(filename) then $Condition = True ; exit the script because the file was written to quit the script
        If CallEnded($CallEnded) = True Then ; if the call is over then make apps normal priority and end the script
            ProgressSet( $OnePercentIncrement,"$CallEnded = " & CallEnded($CallEnded) & ", $SubLoop = " & $SubLoop)
            Sleep(3000) ; we want to end the call
            ; If the call is normally Finished by the Host, then do a standard exit routine.
            Apps_Priority("Normal")
            ProgressSet(100,"Call completed " & "Reason code (not available)","Ending script..")
            Sleep(3000) ; wait 3 seconds to display above progress meter message
            ProgressOff()
            ExitLoop 2
        ElseIf CallEnded($CallEnded) = False Then ; False = no one has hung up the call. Set apps 'low' priority every 5 seconds
            Sleep(1000)
            ProgressSet( $OnePercentIncrement,"$CallEnded = " & CallEnded($CallEnded) & ", $SubLoop = " & $SubLoop)
            If Not $SubLoop = 0 Then ; IF this isn't the very beginning of the sleep increment when it is 0 then
                If IsInt($SubLoop/5) = 1 Then Apps_Priority("Low") ; every 5 seconds of the subloop set app priority low, otherwise keep going..
                If IsInt($SubLoop/5) = 1 Then ProgressSet( $OnePercentIncrement,"$CallEnded = " & CallEnded($CallEnded) & ", $SubLoop = " & $SubLoop & ", Apps set 'low'")
            EndIf ; end loop
        Else
        EndIf
    Next
    ; made it through callstatus testing for a whole increment.
    If CallEnded($CallEnded) = True Then ; the call has ended. End the routine.
        ProgressSet( $OnePercentIncrement,"$CallEnded = " & CallEnded($CallEnded) & ", $SubLoop = " & $SubLoop)
        Sleep(3000) ;
        Apps_Priority("Normal")
        ; If the callended signal is sent via the conference call script, then do a standard exit routine.
        ProgressSet(100,"Call completed " & "Reason code (not available)","Ending script..")
        Sleep(3000) ; wait 3 seconds to display above progress meter message
        ProgressOff()
        ExitLoop 1
    Else ; the call has not ended
        Apps_Priority("Low")
        ; increment the progress box main text
        ProgressSet( $OnePercentIncrement,"",Round($MinutesRemainingonCall,2) & " min remaining, " & Round($MinutesSpentOnCall,2) & " min elapsed")
    EndIf
Next
;
; IF the call lasted till the $MaximumCallTime allowed, THEN alter the Progress box to indicate.
; Here, we increment the Progress box to 100% when the conference is ended by the Host
ProgressSet(100 , $MaximumCallTime & " minutes, forcibly closing script..", "Call reached maximum time")
Apps_Priority("Normal")
Sleep(3000)
ProgressOff()
Edited by scriptstopper

don't think i'm a freeloader. your help has been effective! here's the script contributed - thank you creator and thank you members and thank you authors of autoit!Call Conference Dial-in Script updated from time to time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0