Announcement

Collapse
No announcement yet.

Toll-saver (very simple script)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Toll-saver (very simple script)

    This very simple script changes the number of "rings before answer" from 5 if there are no messages in the default box to 3 if there is one or more messages.
    Calling-in from a long distance call, you know at the third ring that you have no messages, and can hang-on with no toll.
    Others won't notice ...
    Suggestion for use : to be run when ring1 arrives, only fires if you are away (and have the home/away device set to on).

    [This message was edited by Pierre on Thursday, 23 January 2003 at 04:35 AM.]

    [This message was edited by Pierre on Thursday, 23 January 2003 at 04:37 AM.]
    Attached Files
    Visit zee e-maison : http://www.e-maison.com

  • #2
    Updated Toll-Saver for HS2

    I was playing with this script today and discovered that it didn't work under HS2. After a bit of investigating I discovered that the hsp.LineSetRingsCurrent command isn't working as described in the docs.

    In HS 1.x the hsp.LineSetRingsCurrent command sets the number of rings to answer the current call at. It doesn't do this in HS2. What it does instead is reset the ring counter for the current call.

    So... if there are messages, and the command is used with a count of 3, and your base setting in HSP is to pick up on 5 rings, it will pick up on the second ring.

    If there are NO messages, and the command is used with a count of 5, and your base setting in HSP is to pick up on 5 rings, it will pick up immediately.


    Two methods to fix this: set the base at 5 and use the command to set the count to 0 when no messages are present, or use the hsp.LineSetRings command instead. I chose the latter.

    Here's the script updated to work in HSP 2.0:
    Code:
    sub main()
       ' Changes the number of "rings before answer" to
       '    5 if there are no messages in the default box
       '    3 if there are one or more messages.
    
       '=======================================================
       intRingsNone = 5 	'number of rings if no messages in default mailbox
       intRingsMsgs = 3 	'number of rings if one or more messages in default mb
       strOccupiedDevice ="z2" 	'the device code used for home(on) / away(off) state.
       intLine = 1	 	'line in use
       '=======================================================
    
       set objMb = hsp.MBGetDefault	' get the default mailbox
       set objMessages = objMb.messages	' get the collection of messages
    
       hs.Writelog "Toll-Saver", "Messages = ." & objMessages.Count & "."
       hs.Writelog "Toll-Saver", "Occupied = ." & hs.IsOn(strOccupiedDevice) & "."
    
       if (objMessages.Count = 0) or (hs.IsOn(strOccupiedDevice) = true) then
          hsp.LineSetRings intLine, intRingsNone
          hs.Writelog "Toll-Saver", "Rings set to 5"
       else
          hsp.LineSetRings intLine, intRingsMsgs
          hs.Writelog "Toll-Saver", "Rings set to 3"
       end if
    end sub
    And yes, I'm submitting a Help Desk ticket on this issue...

    -Scott

    Comment

    Working...
    X