Announcement

Collapse
No announcement yet.

Voicemail via HSTouch?

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

    #16
    Great share

    Originally posted by mattz View Post
    Mike - glad to hear it worked for you. I use a script to pull the recent calls together into a virtual device. I'm pretty sure it originated from one done by Michael McSharry. I did a cut and paste on some of the code. I've attached the script here. I run it with a "On caller ID" event. Sorry that the modifications aren't more structured (I populated some other devices at the end of the code), but feel free to modify as needed.

    Regards -

    Matt

    Comment


      #17
      Hello Marty - I just tried adjusting the "EOList" (not "L") value to 4, then 6, and back to 5. Each time it worked fine. The "if L = TotalLimit" line can be deleted. It was a remnant from my cut and paste. (yes, it's crude coding!) Did you make other changes? If so, I'd suggest going back to the original and testing it as-is.

      Regards

      Matt

      Comment


        #18
        Hello Matt,
        I apologize for the confusion. Apparently it was the lack of my scripting knowledge. After more calls came in, the list filled up. I'm not sure why and how, as my log goes back to 2006. Perhaps with each call of the script, only one record gets added. So to get 10 records, I'd have to run the script 10 times.
        I have one more question.
        Even consider I can see the "<BR />" in the
        strDeviceString = strDeviceString & pTime & "] " & "<BR />"
        line, when I tried to put the device string into HSTouch, it will not format properly. It looks like the breaks are not there. Any ideas??
        Thanks
        Marty

        Comment


          #19
          Marty,

          I was looking at this script too (thanks Matt!) and realized that the number of calls you will receive back is EOList MINUS the number of those lines that are NOT incoming calls - the script will look at the last EOList number of lines but will ignore ~!~Info~! lines (outgoing). That's likely why you are not seeing the full number of calls you are requesting.
          Mike

          Comment


            #20
            Phone_Recent_Calls.txt

            I got some error when running the script. Is my callers.log bad?

            PHP Code:
            16/07/2009 15:54:58  Error Error in CIDNumberValue cannot be null.Parameter nameArgument 'Array' is Nothing.
            16/07/2009 15:54:58  Error Error in CIDNameValue cannot be null.Parameter nameArgument 'Array' is Nothing
            And here is my callers.log
            PHP Code:
            27/05/2009 12:52:04 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            27/05/2009 12:53:59 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            27/05/2009 12:59:48 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            27/05/2009 13:01:42 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            27/05/2009 13:10:57 PM ~!~Caller ID~!~Line1 Number0766277677 Name:
            27/05/2009 13:11:26 PM ~!~Caller ID~!~Line1 Number0766277677 Name:
            27/05/2009 14:30:24 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            27/05/2009 14:45:03 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            27/05/2009 14:49:53 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            27/05/2009 14:54:47 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            27/05/2009 14:56:50 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            27/05/2009 14:58:57 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            27/05/2009 15:02:43 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            27/05/2009 15:03:46 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            27/05/2009 17:15:33 PM ~!~Caller ID~!~Line1 Number0457628294 Name:
            27/05/2009 20:35:01 PM ~!~Caller ID~!~Line1 Number0457628294 Name:
            28/05/2009 10:24:47 AM ~!~Caller ID~!~Line1 Number0344544530 Name:
            28/05/2009 10:32:00 AM ~!~Caller ID~!~Line1 Number0344544530 Name:
            28/05/2009 10:36:48 AM ~!~Caller ID~!~Line1 Number099950210 Name:
            28/05/2009 10:37:46 AM ~!~Caller ID~!~Line1 Number099950210 Name:
            28/05/2009 10:41:26 AM ~!~Caller ID~!~Line1 Number0344544530 Name:
            28/05/2009 10:53:50 AM ~!~Caller ID~!~Line1 Number099950210 Name:
            28/05/2009 10:56:03 AM ~!~Caller ID~!~Line1 Number099950210 Name:
            28/05/2009 10:58:40 AM ~!~Caller ID~!~Line1 Number099950210 Name:
            28/05/2009 11:55:22 AM ~!~Caller ID~!~Line1 Number0344544530 Name:
            28/05/2009 12:00:10 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            28/05/2009 12:05:56 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            28/05/2009 17:28:14 PM ~!~Caller ID~!~Line1 Number0734725543 Name:
            28/05/2009 17:29:52 PM ~!~Caller ID~!~Line1 Number0734725543 Name:
            02/06/2009 16:11:59 PM ~!~Caller ID~!~Line1 Number040133565 Name:
            02/06/2009 18:39:24 PM ~!~Caller ID~!~Line1 Number0853527751 Name:
            03/06/2009 22:33:21 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            03/06/2009 22:39:36 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            03/06/2009 22:43:27 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            04/06/2009 15:50:31 PM ~!~Caller ID~!~Line1 Numberanonymous Name:
            04/06/2009 19:34:09 PM ~!~Caller ID~!~Line1 Number0547757273 Name:
            05/06/2009 12:23:22 PM ~!~Caller ID~!~Line1 Number0705328690 Name:
            07/06/2009 13:03:38 PM ~!~Caller ID~!~Line1 Number040133565 Name:
            07/06/2009 17:40:43 PM ~!~Caller ID~!~Line1 Number0547757260 Name:
            08/06/2009 06:51:00 AM ~!~Caller ID~!~Line1 Number0344544530 Name:
            08/06/2009 17:46:55 PM ~!~Caller ID~!~Line1 Number040133565 Name:
            09/06/2009 09:37:46 AM ~!~Caller ID~!~Line1 Numberanonymous Name:
            10/06/2009 14:33:30 PM ~!~Caller ID~!~Line1 Number040133565 Name:
            10/06/2009 18:02:22 PM ~!~Caller ID~!~Line1 Number0547757260 Name:
            10/06/2009 20:34:11 PM ~!~Caller ID~!~Line1 Number040133565 Name:
            11/06/2009 17:32:29 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            13/06/2009 12:24:46 PM ~!~Caller ID~!~Line1 Number040133565 Name:
            14/06/2009 18:34:14 PM ~!~Caller ID~!~Line1 Number0921342915 Name:
            15/06/2009 13:27:55 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            15/06/2009 13:28:20 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            15/06/2009 13:28:48 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            15/06/2009 13:31:49 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            16/06/2009 17:29:08 PM ~!~Caller ID~!~Line1 Number040133565 Name:
            16/06/2009 17:31:18 PM ~!~Caller ID~!~Line1 Number0547757273 Name:
            16/06/2009 17:58:54 PM ~!~Caller ID~!~Line1 Number0462705102 Name:
            16/06/2009 19:05:26 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            16/06/2009 19:07:42 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            16/06/2009 19:31:15 PM ~!~Caller ID~!~Line1 Number0708147590 Name:
            16/06/2009 19:31:23 PM ~!~Caller ID~!~Line1 Number0227779977 Name:
            16/06/2009 19:31:54 PM ~!~Caller ID~!~Line1 Number025020540 Name:
            16/06/2009 21:01:40 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            16/06/2009 21:02:45 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            16/06/2009 21:06:55 PM ~!~Caller ID~!~Line1 Number022713226 Name:
            16/06/2009 21:07:58 PM ~!~Caller ID~!~Line1 Number022713226 Name:
            16/06/2009 21:12:12 PM ~!~Caller ID~!~Line1 Number0704497345 Name:
            16/06/2009 21:12:45 PM ~!~Caller ID~!~Line1 Number0704497345 Name:
            16/06/2009 21:34:14 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            16/06/2009 21:35:00 PM ~!~Caller ID~!~Line1 Number0344544530 Name:
            17/06/2009 13:03:46 PM ~!~Caller ID~!~Line1 Number0462705102 Name:
            17/06/2009 13:16:52 PM ~!~Caller ID~!~Line1 Number0709956189 Name:
            17/06/2009 13:48:19 PM ~!~Caller ID~!~Line1 Number0766277677 Name:
            17/06/2009 13:50:23 PM ~!~Caller ID~!~Line1 Number0766277677 Name:
            17/06/2009 13:56:44 PM ~!~Caller ID~!~Line1 Number0766277677 Name:
            17/06/2009 13:57:26 PM ~!~Caller ID~!~Line1 Number0766277677 Name:
            17/06/2009 14:37:11 PM ~!~Caller ID~!~Line1 Number025020540 Name:
            17/06/2009 14:37:42 PM ~!~Caller ID~!~Line1 Number0766277677 Name:
            17/06/2009 14:42:18 PM ~!~Caller ID~!~Line1 Number0920240000 Name:
            17/06/2009 14:43:18 PM ~!~Caller ID~!~Line1 Number0920240000 Name:
            17/06/2009 19:11:20 PM ~!~Caller ID~!~Line1 Number0921342915 Name:
            21/06/2009 14:40:47 PM ~!~Caller ID~!~Line1 Number040133565 Name:
            22/06/2009 12:58:14 PM ~!~Caller ID~!~Line1 Number0462705102 Name:
            22/06/2009 13:01:07 PM ~!~Caller ID~!~Line1 Number0462705116 Name:
            22/06/2009 17:30:01 PM ~!~Caller ID~!~Line1 Number0462705116 Name:
            22/06/2009 19:53:26 PM ~!~Caller ID~!~Line1 Number0921342915 Name:
            23/06/2009 18:34:41 PM ~!~Caller ID~!~Line1 Number0462705116 Name:
            24/06/2009 13:58:16 PM ~!~Caller ID~!~Line1 Number0768881146 Name:
            24/06/2009 13:58:48 PM ~!~Caller ID~!~Line1 Number021351031 Name:
            24/06/2009 19:04:48 PM ~!~Caller ID~!~Line1 Number0921342915 Name:
            25/06/2009 13:16:25 PM ~!~Caller ID~!~Line1 Number0462705116 Name:
            25/06/2009 15:45:58 PM ~!~Caller ID~!~Line1 Number0406227565 Name:
            25/06/2009 17:08:29 PM ~!~Caller ID~!~Line1 Number0462705102 Name:
            25/06/2009 19:14:37 PM ~!~Caller ID~!~Line1 Number0406227565 Name:
            28/06/2009 13:08:21 PM ~!~Caller ID~!~Line1 Number0921342915 Name:
            29/06/2009 08:38:15 AM ~!~Caller ID~!~Line1 Number0462705116 Name:
            29/06/2009 11:14:15 AM ~!~Caller ID~!~Line1 Number018389122 Name:
            29/06/2009 12:12:43 PM ~!~Caller ID~!~Line1 Number099950210 Name:
            30/06/2009 08:36:26 AM ~!~Caller ID~!~Line1 Number0462705116 Name:
            30/06/2009 15:57:15 PM ~!~Caller ID~!~Line1 Number0462705116 Name:
            30/06/2009 17:39:48 PM ~!~Caller ID~!~Line1 Number0406227565 Name:
            30/06/2009 20:11:56 PM ~!~Caller ID~!~Line1 Number0406313200 Name
            Please excuse any spelling and grammatical errors I may make.
            --
            Tasker Plugin / Speech Droid
            Tonlof | Sweden

            Comment


              #21
              Here is the script that I use. Not fancy but works. Just does the number of unread messages (really all that is important to me). It is triggered by two events. The first is whenever a call ends. The second is whenever a message is read.

              Code:
              '=======================================================================================================================================
              'This script updates the unread messages device (P1) string to include a custom phone icon, update the string for the number of unread
              'messages, and provide a link to phone pages if there are unread messages messages.
              '=======================================================================================================================================
              
              Sub Main(parm as object)
              
              dim mb
              
              mb = hsp.MBGet("1")
              
              if mb.unread_messages = 0 Then
              
                 hs.SetDeviceString("P1", "<img src=images/Custom/phone.gif> No Messages", TRUE)
              
              Else
              
                 hs.SetDeviceString("P1", "<a href=hspw><img src=images/Custom/phone.gif border=0 alt=Messages/></a>" & " " & mb.unread_messages, TRUE)
              
              End If
              
              End Sub

              Comment


                #22
                Give this a try. This should play all of your unread messages over the speaker clients. It uses the same http command as the HSP web page. It could be altered by changing the hs.speak command to only speak to certain speaker clients. HSTouch could pass this variable to the script as well. I don't currently have any messages so I'm not sure the for loop will work correctly. I will try tomorrow and edit if needed.

                Code:
                Sub Main(parm as object)
                
                   dim line     'line number
                   dim mb       'mailbox
                   dim vmFile   'voicmail file to play
                   dim messages 'number of unread messages
                   dim i        'index for message loop
                   dim hsip     'IP address of HS server
                   dim hsport   'port of HS server
                
                   line = 1                       'set line number to line 1
                   mb = hsp.MBGet("1")            'set mb equal to mail box 1
                   messages = mb.unread_messages  'set messages equal to number of unread messages
                   i = 0                          'set message playback loop index
                   hsip = "192.168.0.101"         'set HS IP address
                   hsport = 80                    'set HS port
                
                   'if there are no unread messages, then announce no messages
                   If messages = 0 Then
                      hs.Speak("No unread messages.", FALSE)
                   'if there are unread messages, get the first message and play it (need to add rest of messages playback)
                   Else
                      'play first unread message
                      vmFile = hsp.MBFirstUnreadMessage(line,mb)
                      hs.GetURL(hsip,"/hspw?no_page_gen=1&doaction=playspkr&playfile=" & vmFile,TRUE,hsport)
                      messages = messages - 2
                      'play rest of the messages
                      For i = 0 to messages
                         vmFile = hsp.MBNextUnreadMessage(line,mb)
                         hs.GetURL(hsip,"/hspw?no_page_gen=1&doaction=playspkr&playfile=" & vmFile,TRUE,hsport)
                      Next i
                   End If
                
                End Sub

                Comment


                  #23
                  heatvent,

                  How is it working out for you using HS/HSTouch for your voice mail?

                  I have been interested in trying this for a long time but it would have to be both reliable and easy to operate for my wife to be happy with it.

                  Brian

                  Comment


                    #24
                    Haven't had much time to play with it, but it did work with 1 unread message in my inbox. Im not really sure how the nextunreadmessage function works so I was planning to play with it with multiple voicemails. The url that I am using is basically how the HSPhone voicemail page works at playing a message (passes an HTTP post to HS). There is probably a way to do this with the HSP functions by getting the filenname of the next voicemail, playing that wav file on a client and then marking the message as read. This is basically a quick and dirty way to get it to work. Unfortunately, going on vacation in a couple of days so not sure I will get this working well before I leave but will definitely get this to be something functional. Also, not sure if the HST people are working integrating HSP into HS Touch. Seems like a no brainer to add this functionality.

                    Comment


                      #25
                      OK, spent a tad more time on this. The following is functional. I will probably replace the http post with a function that gets the name of the next wav file, plays it over the speaker client(s) and then marks the message as read. However, I think this accomplishes the same thing.

                      Setup is as follows:
                      1. Copy past the code below into a script called playunreadmessages.vb and save in your script subdirectory.
                      2. In HS Touch, create a button and add an action when released with the following parameters.

                        Action Type: HomeSeer: Run a HomeSeer script with values from elements(s)
                        Script: playunreadmessages.vb
                        Script Procedure: Main

                        Leave the parameters blank. In the future, this can probably be setup to pass the name of the client that is calling the script so that the name can be used in the script if you like to just play the messages on that cliennt.


                      That's it.

                      Code:
                      Sub Main(parm as object)
                      
                         dim line     'line number
                         dim mb       'mailbox
                         dim vmFile   'voicmail file to play
                         dim messages 'number of unread messages
                         dim i        'index for message loop
                         dim hsip     'IP address of HS server
                         dim hsport   'port of HS server
                         dim speaker  'name of speaker client
                         dim msgnum   'message number to call out
                      
                         line = 1                       'set line number to line 1
                         mb = hsp.MBGet("1")            'set mb equal to mail box 1
                         messages = mb.unread_messages  'set messages equal to number of unread messages
                         i = 0                          'set message playback loop index
                         hsip = "192.168.0.100"         'set HS IP address
                         hsport = 80                    'set HS port
                         speaker = ""            	  'set spaker client (leave blank "" for all)
                         msgnum = 2
                      
                         'if there are no unread messages, then announce this
                         If messages = 0 Then
                            hs.Speak("You have " & messages & "unread messages.", FALSE, speaker)
                         'if there are unread messages, get the first message and play it (need to add rest of messages playback)
                         Else
                            'play first unread message
                            hs.Speak("You have " & messages & "unread messages.", TRUE, speaker)
                            hs.Speak("Playing first message.", TRUE, speaker)
                            vmFile = hsp.MBFirstUnreadMessage(line,mb)
                            hs.GetURL(hsip,"/hspw?no_page_gen=1&doaction=playspkr&playfile=" & vmFile,TRUE,hsport)
                            messages = messages - 1
                            'play rest of the messages
                            For i = 1 to messages
                               hs.Speak("Playing message " & msgnum, TRUE, speaker)         
                               vmFile = hsp.MBNextUnreadMessage(line,mb)
                               hs.GetURL(hsip,"/hspw?no_page_gen=1&doaction=playspkr&playfile=" & vmFile,TRUE,hsport)
                               msgnum = msgnum + 1
                            Next i
                            hs.Speak("Finished playing unread messages.", FALSE, speaker)      
                         End If
                      
                      End Sub

                      Comment


                        #26
                        As another alterative to get more functionality, create a text item. Then in the Text field put the following:

                        http://HOMESEER IP ADDRESS/hspw

                        This will bring up the HS caller ID webpage inside the text item you just created. I'm sure there is a way to get the headers out of there or just bring up the caller ID / voicemail graphic but not sure how that would be done at the moment. It works, just not pretty yet.

                        Comment


                          #27
                          Originally posted by heatvent View Post
                          As another alterative to get more functionality, create a text item. Then in the Text field put the following:

                          http://HOMESEER IP ADDRESS/hspw

                          This will bring up the HS caller ID webpage inside the text item you just created. I'm sure there is a way to get the headers out of there or just bring up the caller ID / voicemail graphic but not sure how that would be done at the moment. It works, just not pretty yet.
                          heatvent,

                          Thanks for posting the code and for all your ideas on this subject.

                          I have been wondering about how reliable HSP would be for voicemail. I have used HSP quite a while for CID announcements, but I have never tried using it for voicemail.

                          It looks like my HS computer may have died today, so I guess I have a new project. I hope I can find a low wattage option to run HS.

                          Thanks!
                          Brian

                          Comment


                            #28
                            Thanks for the great code, I'm not much of a coder and was wondering if it were possible to adapt the script for multiple mailbox's (We have 3 in total)

                            Regards

                            David

                            Comment


                              #29
                              Try this. I went away from using the url posts. This script will iterate through all of the registered mailboxes, announce the name of the mailbox, and read the unread mail over the speaker clients. Is that what you are looking for? Alternatively, it could be setup that HSTouch passes the name of the mailbox it wishes to be read and just reads that one mailbox.

                              Code:
                              Sub Main (ByVal parms As Object)
                              
                                      '=======================================================================================================================================================================================
                                      ' DECLARE VARIABLES
                                      '=======================================================================================================================================================================================
                              
                              	Dim mb
                              	Dim messages
                              	Dim path
                              	Dim TotalMsgs
                              	Dim NumUnheardMsgs
                              	Dim NumHeardMsgs
                              	Dim playfile
                              	Dim i
                              	Dim NumMBs
                              	Dim x
                              
                                      '=======================================================================================================================================================================================
                                      ' MAIN SCRIPT - GET MAILBOX DATA
                                      '=======================================================================================================================================================================================
                              
                                      hsp.MBSort()
                              	NumMBs = hsp.MBCount()
                                      hs.WriteLog("HST Phone", "There are " & NumMbs & " total mailboxes.")
                                      path = hsp.GetAppPath & "\messages\"                                			' set path for messages
                              
                              	For x = 1 To NumMBs 
                              
                              	        mb = hsp.MBGet(x)                                         			' get the mailbox passed by parms
                              	        messages = mb.messages                                      			' get the collection of messages 
                              
                              		hs.Speak("Retreiving messages for " & mb.username, True)
                              	
                              	        TotalMsgs = mb.total_messages                                   		' Total number of messages
                              	        hs.WriteLog("HST Phone", "There are " & TotalMsgs & " total messages.")
                              
                              	        NumUnheardMsgs = mb.unread_messages                                 		' Total unread messages
                              	        hs.WriteLog("HST Phone", "There are " & NumUnheardMsgs & " unread messages.")
                              
                              	        NumheardMsgs = TotalMsgs - NumUnheardMsgs                           		' Total read messages
                              	        hs.WriteLog("HST Phone", "There are " & NumheardMsgs & " read messages.")
                              
                                      '=======================================================================================================================================================================================
                                      ' MAIN SCRIPT - PERFORM ACTIONS BASED ON HSTOUCH BUTTON PRESSED
                                      '=======================================================================================================================================================================================
                              
                              		If NumUnheardMsgs = 0 Then
                                                  hs.Speak("There are no new messages.", True)
                              		Else
                              		   Select Case NumUnheardMsgs
                                                     Case 1
                                                         hs.Speak("There is one new message.", True)
                                                     Case Else
                                                         hs.Speak("There are " & NumUnheardMsgs & "new messages.", True)
                              		   End Select
                                 		   For i = NumheardMsgs + 1 To TotalMsgs
                                                     playfile = messages(i).filename						' Get name of file to play
                                                     hs.Speak("Message " & i & " Sent " & hsp.MBMessageDate(playfile) & " at " & hsp.MBMessageTime(playfile) & ", From " & hsp.MBMessageName(playfile), True)
                                                     hs.Speak(Path & playfile, TRUE)
                                                     hsp.MBMarkRead(playfile)							' Mark playfile as read
                                                     NumUnheardMsgs = mb.unread_messages						' Reset the number of unheard messages
                                		   Next
                              		   hs.Speak("End of new messages for " & mb.username, True)
                              		End If
                              
                              	Next
                              
                              End Sub

                              Comment


                                #30
                                Firstly my apologies for the delay in my reply, I have been ill so had to put this on the back burner.

                                Thank you heatvent that script is great, as a result I now use a combination of the original script which I modified to look in only one of the mailboxes and have it run 3 times (once for each mailbox) and use your script untouched to cycle through when a button is pressed in HSTouch, having the script only play the mailbox selected would be the next step but is not of great urgency.

                                Again thank you for your help

                                Comment

                                Working...
                                X