Announcement

Collapse
No announcement yet.

Hstouch and Hsphone

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Hstouch and Hsphone

    I have tried to get help by issuing a thread in the hsphone section. I haven't been able to get what I want from that. Does anyone display hsphone variables(last_callerid, number_messages, etc) in hstouch and if yes can you please give me a sample on how to do it. I have been directed to the hstouch sticky's and I understand that I have to use the $SCRIPT= option. Just need a little help to get me to the next step.

    Thanks
    Marcel

    #2
    I don't use HSPhone but the principle should be the same as any other script command try something like;

    [$SCRIPT=&hsp.LastCallerInfo(1)]
    [$SCRIPT=&hsp.MBGet(1).unread_messages()]

    Only thing I can remember is that some of the variables only hold a value for a short time (whilst the phone is ringing?)

    Comment


      #3
      I capture the data in devices to be displayed in HSTouch. Here is my script that allows me to control a virtual answering machine. As you can see I have some bugs to still work out but it is for the most part functional.

      Code:
      '=======================================================================================================================================================================================
      '///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      ' HST_PhoneData.vb - based on script written by MWAITE. Last updated 9/17/10.
      '///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      '
      ' NOTE: THE HST_PHONEDATA.VB SCRIPT RUNS THE MESSAGE POINTERS USED IN HSTOUCH. IT ALSO CALLS THE SCRIPT PHONE_UPDATEMESSAGETOTALS.VB TO UPDATE READ, 
      ' UNREAD AND TOTAL MESSAGES IN THE MAILBOX. THIS IS A TEMPORARY CALL UNTIL HST FIXES THE ISSUE WITH HS PHONE CALLING THE SCRIPT AUTOMATICALLY. THE LAST
      ' CALLER DEVICE IS UPDATED VIA THE YAC SEND TEXT SCRIPT SINCE THIS IS ALREADY PASSING THIS INFO TO YAC/SAGETV.
      '=======================================================================================================================================================================================
      ' Open Fixes:
      ' 1. Need to have CID phone number get bumped back against the HSP addressbook to pull name.
      ' 2. DeleteAll is not working.  Goes out of range (zero or below).
      ' 3. PlayAll seems to start the next file before completing the prior file.
      ' 4. Combine all 3 scripts into 1 and call PHONE_UPDATEPHONEDEVICES.VB.
      '
      '=======================================================================================================================================================================================
      ' NEXTMESSAGE - ADVANCES THE ACTIVEMESSAGE DEVICE VALUE BY 1 AND UPDATES ALL THE MESSAGEDEVICES WITH THE NEW CID DATA
      '=======================================================================================================================================================================================
      Public Sub NextMessage(ByVal parm As Object)
      
          Dim mb                                                                          ' mailbox
          Dim ActiveMessage                                                               ' stores activemessage
          Dim TotalMsgs                                                                   ' stores total messages
          Dim ActiveMessageDev = "P6"                                                     ' device and house code for activee message device
      
          hsp.MBSort()                                                                    ' sort mailbox
          mb = hsp.MBGetDefault                                                           ' get the default mailbox
          TotalMsgs = mb.total_messages                                                   ' get total messages for default mailbox
      
          ActiveMessage = hs.DeviceValue(ActiveMessageDev)                                ' get the currently active message
      
          If TotalMsgs = 0 Then
              ActiveMessage = 0                                                           ' if there are no messages, active message should be 0
          ElseIf ActiveMessage < TotalMsgs Then
              ActiveMessage = ActiveMessage + 1                                           ' otherwise, if not on last message, increment the active message number by 1
          Else
              ActiveMessage = 1                                                           ' start over at message 1 if end was reached
          End If
      
          UpdateMessagePointers(ActiveMessage)                                             ' call UpdateMessagePointers to update CID devices with new data
      
      End Sub
      
      '=======================================================================================================================================================================================
      ' PREVIOUSMESSAGE - DECREMENTS THE ACTIVEMESSAGE DEVICE VALUE BY 1 AND UPDATES ALL THE MESSAGEDEVICES WITH THE NEW CID DATA
      '=======================================================================================================================================================================================
      Public Sub PreviousMessage(ByVal parm As Object)
      
          Dim mb                                                                          ' mailbox
          Dim ActiveMessage                                                               ' stores activemessage
          Dim TotalMsgs                                                                   ' stores total messages
          Dim ActiveMessageDev = "P6"                                                     ' device and house code for activee message device
      
          hsp.MBSort()                                                                    ' sort mailbox
          mb = hsp.MBGetDefault                                                           ' get the default mailbox
          TotalMsgs = mb.total_messages                                                   ' get total messages for default mailbox
      
          ActiveMessage = hs.DeviceValue(ActiveMessageDev)                                ' get the currently active message
      
          If TotalMsgs = 0 Then
              ActiveMessage = 0                                                           ' if there are no messages, active message should be 0
          ElseIf ActiveMessage > 1 Then
              ActiveMessage = ActiveMessage - 1                                           ' if there are more than 1 messages, decrement by 1
          Else
              ActiveMessage = TotalMsgs                                                   ' go to last message if beginning was reached
          End If
      
          UpdateMessagePointers(ActiveMessage)                                             ' call UpdateMessagePointers to update CID devices with new data
      
      End Sub
      
      '=======================================================================================================================================================================================
      ' UpdateMessagePointers -  UPDATES ALL THE MESSAGEDEVICES WITH THE CURRENT DATA
      '=======================================================================================================================================================================================
      Public Sub UpdateMessagePointers(ByVal UpdateMessage As Integer)
      
          '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< XML CODE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
          'Dim sXMLDoc As String = hs.GetAppPath & "\Config\messages.xml"
          'Dim m_xmld As XmlDocument
          'Dim m_nodelist As XmlNodeList
          'Dim m_node As XmlNode
          '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< XML CODE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
      
          Dim mb                                                                          ' mailbox
          Dim messages                                                                    ' holds messages
          Dim TotalMsgs                                                                   ' holds total number of messages
          Dim MsgFilename                                                                 ' holds the message filename
      
          Dim CallerDev                                                                   ' hold values for CID devices
          Dim PhoneNumberDev
          Dim CallDateDev
          Dim CallTimeDev
          Dim CallLengthDev
          Dim ActiveMessageDev
          Dim MsgFilenameDev
          Dim ReadStatusDev
      
          CallerDev = "P1"                                                                ' caller name
          PhoneNumberDev = "P2"                                                           ' caller number
          CallDateDev = "P3"                                                              ' message date
          CallTimeDev = "P4"                                                              ' message time
          CallLengthDev = "P5"                                                            ' message length
          ActiveMessageDev = "P6"                                                         ' used to track the active message number - THIS NEEDS TO BE CONTROLLED BY HSTOUCH TO TELL HS WHAT MESSAGE TO DISPLAY
          MsgFilenameDev = "P7"                                                          ' message filename
          ReadStatusDev = "P8"                                                           ' message read/unread status
      
          hsp.MBSort()                                                                    ' sort mailbox
          mb = hsp.MBGetDefault                                                           ' get the default mailbox
          messages = mb.messages                                                          ' get messages in default mailbox
      
          TotalMsgs = mb.total_messages                                                   ' get total number of messages
      
          If TotalMsgs = 0 Then                                                           ' if no messages in the mailbox, clear all pointer devices
              hs.SetDeviceString(CallerDev, "No messages", True)
              hs.SetDeviceString(PhoneNumberDev, "-", True)
              hs.SetDeviceString(CallDateDev, "-", True)
              hs.SetDeviceString(CallTimeDev, "-", True)
              hs.SetDeviceString(CallLengthDev, "-", True)
              hs.SetDeviceString(ActiveMessageDev, "0", True)
              hs.SetDeviceValue(ActiveMessageDev, 0)
              hs.SetDeviceString(MsgFilenameDev, "-", True)
              hs.SetDeviceString(ReadStatusDev, "-", True)
          Else                                                                            ' otherwise, update pointer devices with new message data
              If UpdateMessage = 0 Then                                                   ' if for some reason updatemessage is zero, change to one
                  hs.WriteLog("HST Phone", "Error: UpdateMessage cannot be 0, resetting to 1.")
                  UpdateMessage = 1
              End If
              MsgFilename = messages(UpdateMessage).filename                              ' set MsgFilename to current message
              hs.SetDeviceString(CallerDev, hsp.MBMessageName(MsgFilename), True)         ' save caller name to device
              hs.SetDeviceString(PhoneNumberDev, FormatPhoneNumber(hsp.MBMessageFrom(MsgFilename)), True) ' formate phone number and save to device
              hs.SetDeviceString(CallDateDev, hsp.MBMessageDate(MsgFilename), True)       ' save date to device
              hs.SetDeviceString(CallTimeDev, hsp.MBMessageTime(MsgFilename), True)       ' save time to device
              hs.SetDeviceString(CallLengthDev, FormatCallLength(hsp.MBMessageLength(MsgFilename)), True)
              hs.SetDeviceString(ActiveMessageDev, UpdateMessage, True)                   ' set device string of ActiveMessageDev to new number
              hs.SetDeviceValue(ActiveMessageDev, UpdateMessage)                          ' set device value of ActiveMessageDev to new number
              hs.SetDeviceString(MsgFilenameDev, MsgFilename, True)                       ' save message filename to device
              hs.SetDeviceString(ReadStatusDev, ReadStatus(MsgFilename), True)            ' save read status to device
          End If
      
      End Sub
      
      '=======================================================================================================================================================================================
      ' PLAYMESSAGE - PLAYS CURRENT MESSAGE
      '=======================================================================================================================================================================================
      Public Sub PlayMessage(ByVal parm As Object)
      
          Dim PlayFile
          Dim path
          Dim ActiveMessage
          Dim ActiveMessageDev = "P6"
          Dim MsgFilenameDev = "P7"
          Dim ReadStatusDev = "P8"
      
          ActiveMessage = hs.DeviceString(ActiveMessageDev)
          PlayFile = hs.DeviceString(MsgFilenameDev)                                             ' get the filename of the active message
          path = hs.GetAppPath & "\messages\"                                            ' get path to messages
      
          If PlayFile = "-" Then
              'Do nothing
          Else
              hs.WriteLog("HST Phone", "Playing voicemail file " & PlayFile & ".")
              hsp.MBMarkRead(PlayFile)                                                    ' mark file as read
              hs.MEDIAPlay(path & PlayFile)
          End If
      
          UpdateMessagePointers(ActiveMessage)                                             ' call UpdateMessagePointers to update CID devices with new data
      
      End Sub
      
      '=======================================================================================================================================================================================
      ' PLAYALL - ITERATES THROUGH MESSAGES AND PLAYS EACH MESSAGE
      '=======================================================================================================================================================================================
      Public Sub PlayAll(ByVal parm As Object)
      
          Dim mb
          Dim NumUnreadMsgs
          Dim NumReadMsgs
          Dim TotalMsgs
          Dim i
          Dim PlayFile
          Dim path
          Dim messages
          Dim UnreadMsgsDev
          Dim ActiveMessage
          Dim ActiveMessageDev
          Dim ReadStatusDev
      
          ActiveMessageDev = "P6"
          UnreadMsgsDev = "P11"                                                           ' number of new/unread messages
          ReadStatusDev = "P8"
          path = hs.GetAppPath & "\messages\"                                            ' get path to messages
      
          ActiveMessage = hs.DeviceString(ActiveMessageDev)
      
          hsp.MBSort()                                                                    ' sort mailbox
          mb = hsp.MBGetDefault()                                                         ' get the default mailbox
          messages = mb.messages
      
          TotalMsgs = mb.total_messages                                                   ' get total number of messages
          NumUnreadMsgs = mb.unread_messages                                             ' get number of unread messages
          NumReadMsgs = TotalMsgs - NumUnreadMsgs
      
          Select Case NumUnreadMsgs
              Case 0
                  hs.Speak("You have no new messages.", True)
                  Exit Sub
              Case 1
                  hs.Speak("You have one new message.", True)
              Case Else
                  hs.Speak("You have " & NumUnreadMsgs & "new messages.", True)
      
          End Select
          For i = 1 To TotalMsgs
              PlayFile = messages(i).filename
              If ReadStatus(PlayFile) = "Unread" Then
                  hs.Speak("Playing message " & i & " Sent " & hsp.MBMessageDate(PlayFile) & " at " & hsp.MBMessageTime(PlayFile) & ", From " & hsp.MBMessageName(PlayFile), True)
                  hsp.MBMarkRead(PlayFile)
                  If i = ActiveMessage Then
                      hs.SetDeviceString(ReadStatusDev, "Read", True)
                  End If
                  hs.MEDIAPlay(path & PlayFile)
              End If
          Next
          hs.Speak("End of new messages", True)
      
      End Sub
      
      '=======================================================================================================================================================================================
      ' DELETE - DELETES CURRENT MESSAGE
      '=======================================================================================================================================================================================
      Public Sub DeleteMessage(ByVal parm As Object)
      
          Dim DeleteFile
          Dim ActiveMessage
          Dim ActiveMessageDev
      
          ActiveMessageDev = "P6"
          Dim MsgFilenameDev = "P7"
      
          DeleteFile = hs.DeviceString(MsgFilenameDev)                                             ' get the filename of the active message
          ActiveMessage = hs.DeviceString(ActiveMessageDev)
      
          If DeleteFile = "-" Then
              'Do nothing
          Else
              hs.WriteLog("HST Phone", "Deleting voicemail file " & DeleteFile & ".")
              hsp.MBDeleteMessage(DeleteFile)                                                     ' delete file
          End If
          PreviousMessage("")
      
          hs.RunEx("Phone_UpdateMessageTotals.vb","Main","")
      
      End Sub
      
      '=======================================================================================================================================================================================
      ' DELETEALL - DELETES ALL READ MESSAGES
      '=======================================================================================================================================================================================
      Public Sub DeleteAll(ByVal parm As Object)
      
          Dim mb
          Dim NumUnreadMsgs
          Dim NumReadMsgs
          Dim TotalMsgs
          Dim i
          Dim DeleteFile
          Dim messages
          Dim TotalDeleted
          Dim ActiveMessage
      
          Dim CallerDev                                                                   ' hold values for CID devices
          Dim PhoneNumberDev
          Dim CallDateDev
          Dim CallTimeDev
          Dim CallLengthDev
          Dim ActiveMessageDev
          Dim MsgFilenameDev
          Dim ReadStatusDev
      
          CallerDev = "P1"                                                                ' caller name
          PhoneNumberDev = "P2"                                                           ' caller number
          CallDateDev = "P3"                                                              ' message date
          CallTimeDev = "P4"                                                              ' message time
          CallLengthDev = "P5"                                                            ' message length
          ActiveMessageDev = "P6"                                                         ' used to track the active message number - THIS NEEDS TO BE CONTROLLED BY HSTOUCH TO TELL HS WHAT MESSAGE TO DISPLAY
          MsgFilenameDev = "P7"                                                           ' message filename
          ReadStatusDev = "P8"                                                            ' message read/unread status
      
          hsp.MBSort()                                                                    ' sort mailbox
          mb = hsp.MBGetDefault()                                                         ' get the default mailbox
          messages = mb.messages                                                          ' get messages for default mailbox
      
          TotalMsgs = mb.total_messages                                                   ' get total number of messages
          NumUnreadMsgs = mb.unread_messages                                              ' get number of unread messages
          NumReadMsgs = TotalMsgs - NumUnreadMsgs                                         ' calculate number of read messages
      
          ActiveMessage = hs.DeviceValue(ActiveMessageDev)                                ' get the currently active message 
          TotalDeleted = 0
      
          hs.SetDeviceString(CallerDev, "Deleting all read messages...", True)            ' update display to say deleting messages
          hs.SetDeviceString(PhoneNumberDev, "-", True)
          hs.SetDeviceString(CallDateDev, "-", True)
          hs.SetDeviceString(CallTimeDev, "-", True)
          hs.SetDeviceString(CallLengthDev, "-", True)
          hs.SetDeviceString(MsgFilenameDev, "-", True)
          hs.SetDeviceString(ReadStatusDev, "-", True)
      
          hs.WaitSecs(3)								    ' wait
      
          If TotalMsgs = 0 Then								' if no messages do nothing
              'Do nothing
          Else
              For i = 1 To TotalMsgs                                                          ' for 1 to total number of messages
                  DeleteFile = messages(i).filename                                           ' set filename to current message filename
                  If ReadStatus(DeleteFile) = "Read" Then                                     ' if the status of the current message is read
                      hsp.MBDeleteMessage(DeleteFile)                                         ' deletefile if read
                      TotalDeleted = TotalDeleted + 1						' track total deleted files
                      hs.RunEx("Phone_UpdateMessageTotals.vb","Main","")
                  End If
              Next
          End If
      
          Select Case TotalDeleted
              Case 0										' update screen based on number of files delted
                  hs.SetDeviceString(CallerDev, "No read messages to delete.", True)
                  hs.waitsecs(3)
                  UpdateMessagePointers(ActiveMessage)					' set pointers to current active message	
              Case 1
                  hs.SetDeviceString(CallerDev, "Deleted one read message.", True)
                  hs.waitsecs(3)
                  UpdateMessagePointers(1)							' reset to message 1
              Case Else
                  hs.SetDeviceString(CallerDev, "Deleted " & TotalDeleted & " read messages.", True)
                  hs.waitsecs(3)
                  UpdateMessagePointers(1)							' reseet to message 1
          End Select
      
      End Sub
      
      '=======================================================================================================================================================================================
      ' MARKUNREAD - MARKS THE CURRENT MESSAGE STATUS AS UNREAD
      '=======================================================================================================================================================================================
      Public Sub MarkUnread(ByVal parm As Object)
      
          Dim unreadfile
          Dim MsgFilenameDev
          Dim ReadStatusDev
      
          MsgFilenameDev = "P7"
          ReadStatusDev = "P8"
      
          unreadfile = hs.DeviceString(MsgFilenameDev)                                             ' get the filename of the active message
      
          If unreadfile = "-" Then
              'Do nothing
          Else
              hs.WriteLog("HST Phone", "Marking voicemail file " & unreadfile & " as unread.")
              hsp.MBMarkUnRead(unreadfile)                                                    ' mark unreadfile as unread
              hs.SetDeviceString(ReadStatusDev, "Unread", True)
          End If
      
          hs.RunEx("Phone_UpdateMessageTotals.vb","Main","")
      
      End Sub
      
      '=======================================================================================================================================================================================
      ' STOPMESSAGE - STOPS THE CURRENT MESSAGE THAT IS PLAYING
      '=======================================================================================================================================================================================
      Public Sub StopMessage(ByVal parm As Object)
      
          hs.MEDIAStop()
      
      End Sub
      
      '=======================================================================================================================================================================================
      ' FORMATPHONENUMBER - FORMAT THE PHONE NUMBER TO COMPLY WITH (XXX) XXX-XXXX
      '=======================================================================================================================================================================================
      
      Public Function FormatPhoneNumber(ByVal sNumToBeFormatted As String) As String
      
          Dim iNumberLength As Integer 'Used for the Phone Number length
      
          'Trim any leading and trailing spaces
      
          sNumToBeFormatted = Trim$(sNumToBeFormatted)
      
          'Length of the phone number.
      
          iNumberLength = Len(sNumToBeFormatted)
      
          Select Case iNumberLength
      
              Case 7  'Format : #######
      
                  FormatPhoneNumber = Left$(sNumToBeFormatted, 3) & "-" & Right$(sNumToBeFormatted, 4)
                  Exit Function
      
              Case 8  'Format : ###-#### or ### ####
      
                  If Mid$(sNumToBeFormatted, 4, 1) = "-" Then
                      FormatPhoneNumber = sNumToBeFormatted
                      Exit Function
                  Else
                      FormatPhoneNumber = Left$(sNumToBeFormatted, 3) & "-" & Right$(sNumToBeFormatted, 4)
                      Exit Function
                  End If
      
              Case 10 'Format : ##########
      
                  FormatPhoneNumber = "(" & Left$(sNumToBeFormatted, 3) & ") " & Mid$(sNumToBeFormatted, 4, 3) & "-" & Right$(sNumToBeFormatted, 4)
                  Exit Function
      
              Case 11 'Format ######-####
      
                  FormatPhoneNumber = "(" & Left$(sNumToBeFormatted, 3) & ") " & Right$(sNumToBeFormatted, 8)
                  Exit Function
      
              Case 12 'Format : ### ###-####
      
                  FormatPhoneNumber = "(" & Left$(sNumToBeFormatted, 3) & ") " & Mid$(sNumToBeFormatted, 5, 3) & "-" & Right$(sNumToBeFormatted, 4)
                  Exit Function
      
              Case 13 'Format : (###)###-####
                  FormatPhoneNumber = Left(sNumToBeFormatted, 5) & " " & Right(sNumToBeFormatted, 8)
                  Exit Function
      
              Case Else
                  'Return Value Passed
                  FormatPhoneNumber = sNumToBeFormatted
      
          End Select
      
      End Function
      
      '=======================================================================================================================================================================================
      ' FORMATCALLLENGTH - FORMATS THE CALL LENGTH TO COMPLY WITH MM:SS
      '=======================================================================================================================================================================================
      
      Public Function FormatCallLength(ByVal sLenToBeFormatted As String) As String
      
          Dim callmin
          Dim callsec
      
          If sLenToBeFormatted > 59 Then                                  ' more than seconds long
              callmin = Int(sLenToBeFormatted / 60)
              callsec = sLenToBeFormatted - (Int(sLenToBeFormatted / 60) * 60)
              If callsec < 10 Then
                  callsec = "0" & callsec
              End If
              FormatCallLength = callmin & ":" & callsec
          Else
              If sLenToBeFormatted < 10 Then
                  FormatCallLength = "0:0" & sLenToBeFormatted
              Else
                  FormatCallLength = "0:" & sLenToBeFormatted
              End If
          End If
      
      End Function
      
      '=======================================================================================================================================================================================
      ' READSTATUS - DETERMINES RETURN STATUS AND RETURNS RESULT
      '=======================================================================================================================================================================================   
      Public Function ReadStatus(ByVal filename As String)
      
          Dim mb                                                                          ' mailbox                                                              ' stores activemessage
          Dim messages                                                                    ' holds messages
          Dim TotalMsgs                                                                   ' stores total messages
          Dim ReadMsgs
          Dim UnreadMsgs                                                                  ' device and house code for activee message device
          Dim i
      
          hsp.MBSort()                                                                    ' sort mailbox
          mb = hsp.MBGetDefault                                                           ' get the default mailbox
          messages = mb.messages
          TotalMsgs = mb.total_messages
          UnreadMsgs = mb.unread_messages
          ReadMsgs = TotalMsgs - UnreadMsgs                                                 ' get total messages for default mailbox
      
          ' Check if filename equals filename of read messages
          If filename = hsp.MBFirstReadMessage(1, mb) Then
              ReadStatus = "Read"
          End If
          For i = 2 To ReadMsgs
              If filename = hsp.MBNextReadMessage(1, mb) Then
                  ReadStatus = "Read"
              End If
          Next
      
          ' Check if filename equals filename of unread messages
          If filename = hsp.MBFirstUnreadMessage(1, mb) Then
              ReadStatus = "Unread"
          End If
          For i = 2 To UnreadMsgs
              If filename = hsp.MBNextUnreadMessage(1, mb) Then
                  ReadStatus = "Unread"
              End If
          Next
      
      End Function

      Comment


        #4
        BTW, HST, this to me is a must have HSPhone integration with HSTouch. Similar to the music functionality in HSTouch.

        Comment


          #5
          Hi Heatvent,

          Thank you very much for posting this script! I really want to replace the hsphone webpage in my screens.

          The note in your script says it calls phone_updatemessagetotals.vb
          Any chance you could post that as well?

          Regards,
          John

          Comment


            #6
            Here is the other script. The dealio on the issue I noted is in the HSPhone setup there are options to have HSPhone execute a script when a message is read, unread, left or deleted. This works fine when using the HS web interface voicemail box to do these actions. However, when using script commands to read a message, unread a message, HS does not execute the script identified in the HSPhone setup. I have a bug report & help desk tick on this that has gone nowhere in months.

            A workaround I have not implemented is before this method, I initially used the hs.geturl function to call the same http command that the HS web interface voicemail box uses. I figured it out via reverse engineering of the html code generated by the voicemail box page. I am thinking I may go back to his method instead of direct HSP API calls because I am pretty sure it would be a workaround for the issue noted above. I just haven't had time to do this yet.

            FYI, I use a separate script to update phone message totals because changes may occur for reasons other than using my HSTouch interface. So I wanted a separate script to deal with these global changes that come through normal activity, using the web interface, using HSTouch, etc.



            Code:
            '=======================================================================================================================================================================================
            ' THIS SCRIPT SHOULD BE RUN BY HSPHONE ANYTIME A MESSAGE IS READ, UNREAD, LEFT OR DELETED IN ORDER TO KEEP VIRTUAL DEVICES TRACKING MESSAGE DATA UP TO DATE.
            ' HOWEVER, THIS IS CURRENTLY NOT WORKING AND I HAVE A HELP DESK TICKET IN TO FIX (THAT IS NOT BEING ADDRESSED).  UNTIL FIXED, CALLED BY 2 EVENTS AND BY
            ' HST_PHONDATA.VB.
            '=======================================================================================================================================================================================
            
            
            '=======================================================================================================================================================================================
            ' UpdateMessageTotals -  UPDATES ALL THE DEVICES WITH NUMBER OF MESSAGE DATA
            '=======================================================================================================================================================================================
            Sub Main(ByVal parm As Object)
            
                hs.WriteLog("Phone Script", "Testing the phone script.")
            
                Dim mb                                                                          ' mailbox
                Dim NumUnreadMsgs                                                               ' holds number of unread messages
                Dim NumReadMsgs                                                                 ' holds number of read messages
                Dim TotalMsgs                                                                   ' holds total number of messages
            
                Dim TotalMsgsDev
                Dim UnreadMsgsDev
                Dim ReadMsgsDev
            
                TotalMsgsDev = "P9"                                                             ' total number of messages
                UnreadMsgsDev = "P10"                                                            ' number of new/unread messages
                ReadMsgsDev = "P11"                                                              ' number of old/read messages
            
                hsp.MBSort()                                                                    ' sort mailbox
                mb = hsp.MBGetDefault                                                           ' get the default mailbox
            
                TotalMsgs = mb.total_messages                                                   ' get total number of messages
                NumUnreadMsgs = mb.unread_messages                                              ' get number of unread messages
                NumReadMsgs = TotalMsgs - NumUnreadMsgs                                         ' calculate number of read messages
            
                If TotalMsgs = 0 Then                                                           ' if no messages in the mailbox, clear all pointer devices
                    hs.SetDeviceString(TotalMsgsDev, "0", True)
                    hs.SetDeviceString(UnreadMsgsDev, "0", True)
                    hs.SetDeviceString(ReadMsgsDev, "0", True)
                Else                                                                            ' otherwise, update message tracking devices with totals
                    hs.SetDeviceString(TotalMsgsDev, TotalMsgs, True)                           ' save total message number to device
                    hs.SetDeviceString(UnreadMsgsDev, NumUnreadMsgs, True)                      ' save unread message number to device
                    hs.SetDeviceString(ReadMsgsDev, NumReadMsgs, True)                          ' save read message number to device
                End If
            
            End Sub

            Comment


              #7
              Thanks!

              John

              Comment


                #8
                This is great exactly what I was looking for.

                Thanks a lot.

                Marcel

                Comment


                  #9
                  Can you guys post some screen shots of what you're able to do with this?
                  Plugins:
                  BLLogMonitor, BLGarbage, BLBackup, BLOutGoingCalls, BLUps, BLRfid, JvEss, DooMotion, Applied Digital Ocelot, AC RF Processor, UltraMon, PJC AVR 430, UPB, Rain8net, DSC Panel, JRiver Media center, Windows Media Player, SageMediaCenter, SnevlCID, MCSTemperature.

                  Comment


                    #10
                    I think you can find Heatvent's example here:
                    http://board.homeseer.com/showpost.p...2&postcount=93

                    Basically you can use any graphic you want, instead of the hsphone webpage "taped off" with text blocks (which for me does not scale properly on ipad and android clients).

                    John

                    Comment


                      #11
                      Wow, that's nice! Is there a way to change mailboxes?
                      Plugins:
                      BLLogMonitor, BLGarbage, BLBackup, BLOutGoingCalls, BLUps, BLRfid, JvEss, DooMotion, Applied Digital Ocelot, AC RF Processor, UltraMon, PJC AVR 430, UPB, Rain8net, DSC Panel, JRiver Media center, Windows Media Player, SageMediaCenter, SnevlCID, MCSTemperature.

                      Comment


                        #12
                        Hi Heatvent,

                        I wasn't able to work on this for a while because of travel.
                        So looking at it I have a first question. How are the calls in the script initiated?

                        Thanks
                        Marcel

                        Comment


                          #13
                          As an example, for Next Message, I use the attached ActionWhenPressed on a button....
                          Attached Files

                          Comment


                            #14
                            Ok got it.

                            Thanks
                            Marcel

                            Comment


                              #15
                              I know this is a very old post. I have this script in my scripts folder and I have it set up in HST to run the script. When the messages play (the wave files) they only play locally, I am unable to get them to play on hs touch on the Iphone. My clients are set up as blank for default for all clients. I am using HSPRO 2.5.0.23. Does anyone have any suggestions this has been very frustrating trying to play wave files over the Iphone client. Thanks Dave...

                              Comment

                              Working...
                              X