As part of some detailed HSphone function-testing I'm doing, I'm developing some scripts that test various functions of the HS3 version of HSphone with the W2C. I thought I'd post them here in case someone else would find them useful. A brief description of the test is in the first line of each piece. I just call the script from a manually-triggered event.
If you find these useful, check back here from time to time. I'll be editing this post to add new scripts as I create them.
If you find these useful, check back here from time to time. I'll be editing this post to add new scripts as I create them.
Code:
' Take phone off-hook, dial a number, speak a message, dial some digits, hang-up. ' Replace the ?????????? in the script with the number you want to call. Sub Main(ByVal Parms As Object) dim r hs.WriteLogEx("Phone dial-digits test", "Start script", "#008000") hsp.LINEScriptHasControl(1, TRUE) 'take script control of line 1 ' Phone off-hook for answer/call hs.WriteLogEx("Phone dial-digits test", "Go off-hook", "#008000") HSP.HIPcmd(1,&H005A,&H0) hsp.WaitMS(2000) 'wait 2 seconds hs.WriteLogEx("Phone dial-digits test", "Dial number", "#008000") r = hsp.LineDial(1, "??????????", FALSE, FALSE) hsp.WaitMS(3000) 'wait 3 seconds hs.WriteLogEx("Phone dial-digits test", "Speak message", "#008000") hsp.speak(1,"hello on the phone, how are you today?",true) hs.WriteLogEx("Phone dial-digits test", "Send tones 123", "#008000") hsp.LineSendtones(1, "123", 1) 'send DTMF tones to line 1 hsp.WaitMS(2000) 'wait 2 seconds hs.WriteLogEx("Phone dial-digits test", "Send tones 456", "#008000") hsp.LineSendtones(1, "456", 1) 'send DTMF tones to line 1 hsp.WaitMS(2000) 'wait 2 seconds hs.WriteLogEx("Phone dial-digits test", "Send tones 789", "#008000") hsp.LineSendtones(1, "789", 1) 'send DTMF tones to line 1 hsp.WaitMS(2000) 'wait 2 seconds hs.WriteLogEx("Phone dial-digits test", "Send tones 123456789", "#008000") hsp.LineSendtones(1, "123456789", 1) 'send DTMF tones to line 1 hs.WriteLogEx("Phone dial-digits test", "Hang up", "#008000") hsp.LINEhangup(1) 'disconnect call hsp.WaitMS(1000) 'wait 1 second hs.WriteLogEx("Phone dial-digits test", "Reset line", "#008000") hsp.LINEReset(1) 'reset line hs.WriteLogEx("Phone dial-digits test", "End script", "#008000") End Sub
Code:
' Ring-control test. Take phone off-hook, change ringing settings, ' ring local phones 'for 6 seconds, hang-up Sub Main(ByVal Parms As Object) hs.WriteLogEx("Phone ring-control test", "Start script", "#008000") hsp.LINEScriptHasControl(1, TRUE) 'take script control of line 1 hsp.WaitMS(1000) 'wait 1 second hsp.HIPCmd(1,&H74,&H0) ' Ring Frequency to 17Hz hsp.HIPCmd(1,&H87,4) ' Ringer Off Period hsp.HIPCmd(1,&H97,2) ' Ringer On Period hsp.HIPCmd(1,&H14,&H0) ' Start Ringing hsp.WaitMs(6000) ' Wait for 6 seconds hsp.HIPCmd(1,&H4,&H0) ' Stop Ringing hsp.HIPCmd(1,&H54,&H0) ' Set Ring Frequency back to 20Hz (US Standard) hs.WriteLogEx("Phone Ring-control test", "Hang up", "#008000") hsp.LINEhangup(1) 'disconnect call hsp.WaitMS(1000) 'wait 1 second hs.WriteLogEx("Phone Ring-control test", "Reset line", "#008000") hsp.LINEReset(1) 'reset line hs.WriteLogEx("Phone Ring-control test", "End script", "#008000") End Sub