Creating Caller ID log for SW remote display

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
loo_hoo_ser
Member
Posts: 83
Joined: Sat Oct 30, 2004 4:16 pm

Creating Caller ID log for SW remote display

Post by loo_hoo_ser »

Hi -



I'm a newb to Housebot but I learn fast! :wink:



My goal is to use the caller ID feature to track the last few phone calls and display them on a software remote. I did not want to use the HB logging feature as that actually writes the logged data to a file - this is not what I want - it is not displayable on a SW remote.



To that end, I am reusing the UserAlpha(1-9) properties by executing a script that would set each of them with a name, phone number, and date/time. So, when a call is received, a script device is invoked and executes a VB script that basically copies the 3 pieces of information (name, tele, date/time) into the UserAlpha(7,8,9) from UserAlpha(4,5,6). Then it copies UserAlpha(1,2,3) into UserAlpha(4,5,6). Finally it copies the current call information from the CallerID device into UserAlpha (1,2,3). Basically it's a list that is shifted every time an incoming call occurs (contents pushed downward for each call).



Couple of questions though:



1) Is this the best way to accomplish this? The way I saw it was I could use the predefined property so I could display the values of UserAlpha(1-9) in a SWremote. Each time the task is executed, the information is refreshed and the SW remote has the up-to-date caller ID information.



2) The script device is executed whenever CallerID_info_received = 'Yes'. The problem with that is the task keeps rexecuting as LONG as the caller_id_received = 'Yes' remains true. So, when an incoming call occurs, the condition to execute the task is true for a period of time and this causes multiple executions of the task. The end result is that desired list of calls is constantly being pushed down with the current call information (in other words, it executes repeatedly and destroys the concept of a log. However, if I execute the task MANUALLY (set task state to 'running') using the Housebot master interface, it works by pushing the caller ID information only once.



So, my big question for this post is how can I keep the task from executing repeatedly while caller_id_received = 'Yes' and destroying information? I thought about testing the value of caller_id_received = 'No' within the script and having it wait until that exit condition was satisified. Thus, the script basically waits until the caller information is complete and keeps it from running again.



However, I am not sure how to accomplish this in the VB script. Also, is this something that would lead to a deadlock (e.g. waiting forever for 'caller_id_received = 'No' never occurs)?



3) Can I create new arbitrary global property values? It seems to me that the existing global property values are hardcoded and are limited resources - e.g. use one up and it is not available for reuse?



Ok, I'd like an answer on #2 because that is what is killing my goal of having a caller ID log. Of course, I'm open to suggestions on a BETTER way of doing this... heh.
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

Personally, instead of using three Alpha properties for one call, I'd just use one per call and combine the fields into a single string. You can also create your own properties using the Property Manager (Settings/Property Manager.. from the main menu), if you don't want to use the stock ones.



To stop your script from executing, make sure you uncheck the Allow Same Value Changes check box for the Caller ID Info Received Property.
Scott
loo_hoo_ser
Member
Posts: 83
Joined: Sat Oct 30, 2004 4:16 pm

Post by loo_hoo_ser »

Scott -



The Caller_ID_info_receive field is a locked property. If it is the one associated with the caller ID device, then it has what appears a lock so I can't change whether it allows same value change or not like the other property devices?



That was my first thought in trying to fix this problem so I went to the caller ID device to change it but can't due to the lock.



Suggestions? Am I doing something incorrectly?



I see what you mean about combining the strings but the SW remote is a PPC so it would be one really long string and I can't get it to fit neatly on the screen without using a really small font. Can strings in HB contain carriage return characters to break it up on multiple lines?
loo_hoo_ser
Member
Posts: 83
Joined: Sat Oct 30, 2004 4:16 pm

Post by loo_hoo_ser »

Scott,



Assuming I can't change "allow same value change" aspect for the Caller_ID_Info_Received property for the modem device - I came up with a workaround that solves my problem. I added a delay by using the Timer function in VB in the script to wait 10 seconds. That appears to allow enough time to lapse for the phone line to complete its 2nd ring and end the caller ID decoding and have its value change to "no" so the script doesn't execute again immediately.



However, I've uncovered what appears to be a new problem? As I've described before, I have basically 3 different properties that track each call (e.g. call #1 name, Call #2 name, and call #3 name). In the theme, I have set up a property label control for each of the properties mentioned previously to display the values on the SW remote.



I can see that #1, #2, and #3 have different values by inspecting the caller ID list device (my script device with the properties containing the call information) on the HB server.



However, on the SW remote, they ALL have the same value! I double checked to make sure that the property labels were displaying the correct property identifiers (eg. I didn't make them display the same property identifier) and the SW remote is still not updating all of them correctly. I've tried restarting the HB server to no avail - they all show the same value on the SW remote?



EDIT: When I tried adding a new propety label control to try display the value by using the add control feature (as a test of my sanity), the SW remote started working normally again! The values are now correct. Something in the SW remote was acting screwy until I added the dummy property label control.
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

Well, the Caller ID Info field on my Device isn't read-only... but I guess that's because I created that Device a long time ago (before there were read-only props). :oops:



Off the top of my head, I don't remember why I disabled the "allow same value change" check box for read-only properties. Maybe I got carried away, or maybe there's a good reason. I'll have to look into it more.



If you have MS Access, I can walk you through the changes to make the property read-write if you would like.
Scott
loo_hoo_ser
Member
Posts: 83
Joined: Sat Oct 30, 2004 4:16 pm

Post by loo_hoo_ser »

Scott - no problem.



I don't have MS Access installed and it seems like a lot of trouble to set it up to change the DB. As I said in my last post, my workaround was to add a delay at the end of the script of 10 seconds to prevent the script from executing again within 10 seconds. In that time, the value of "Caller ID Info Received" should be "no" and the script will not execute more than once for the same call.



I may have discovered a new problem though. As I said, I use different property values to store the information for each incoming call and display them as property label controls for the SW remote theme. I use the same theme for the X86 and the PPC remotes.



However they do not behave the same way! The X86 remote works correctly - all caller information logged have the correct information.



The same theme on my PPC 2003 (second edition), all show up as the same information (e.g. call #1 name = call #2 name = call #3 name and call #1 tele = call #2 tele = call #3 tele).



What's interesting also is that the date/time display is truncated. In the X86 version of the SW remote, it shows up as date plus time (mm/dd/yyyy HH:MM:SS am|pm) format. The PPC remote only shows it as mm/dd/yyyy and the time is not displayed at all.
switzch
Member
Posts: 60
Joined: Thu Jan 15, 2004 11:17 am
Location: Toronto, On

Post by switzch »

loo hoo ser,

would you mind posting your vb script? i looked into doing this a while ago and had no luck.
loo_hoo_ser
Member
Posts: 83
Joined: Sat Oct 30, 2004 4:16 pm

Post by loo_hoo_ser »

Sure, here is the script that I am using. It is a bit rough on the edges as I am stil new to HB. I just learned from ScottBot that I could create new property values by using the property manager tool because I was using the built in properties that were created by default in HB (User Defined Alpha).



The way that this caller ID logging works is that this script (shown below) is executed as a script device (named "Caller ID List") when the condition Caller ID Info Received = "Yes" is evaluated as true. Of course, this presumes your modem device is working and that your caller ID information is being gathered for incoming calls.



My script refers to the modem device as "House Telephone Line". Yours may be named differently so just substiute where appropriate. I only created the list to hold 3 entries because I didn't think I would need to log more than 3 calls but if you need to log more, you can use this script to get the idea.



Naturally, arrays would be better but I created this script so that the SW remote can display the values of properties in a SW remote and for me that means instancing each incoming call into separate property values. ScottBot suggested that using a single property value and capturing the last calll record from the modem device (the call record includes a name, phone number, and date/time.). For me, however, I couldn't use the complete call record as it was unwieldy to display all the information at once on a small remote screen (I use a PPC SW remote).



Hope this script helps you and others out there trying to do the same thing (or something similar - like event capture for display on a SW remote.



My apologies if this is a non-optimal way to do this, If someone can suggest a better way to improve it, by all means, share your suggestions!


Code: Select all

callerName     = GetPropertyValue("Caller ID List.Caller 2 Name")
callerTele     = GetPropertyValue("Caller ID List.Caller 2 Tele")
callerDateTime = GetPropertyValue("Caller ID List.Caller 2 DateTime")

SetPropertyValue "Caller ID List.Caller 3 Name", callerName
SetPropertyValue "Caller ID List.Caller 3 Tele", callerTele
SetPropertyValue "Caller ID List.Caller 3 DateTime", callerDateTime

callerName     = GetPropertyValue("Caller ID List.Caller 1 Name")
callerTele     = GetPropertyValue("Caller ID List.Caller 1 Tele")
callerDateTime = GetPropertyValue("Caller ID List.Caller 1 DateTime")

SetPropertyValue "Caller ID List.Caller 2 Name", callerName
SetPropertyValue "Caller ID List.Caller 2 Tele", callerTele
SetPropertyValue "Caller ID List.Caller 2 DateTime", callerDateTime

callerName     = GetPropertyValue("House Telephone Line.Last Caller")
callerTele     = GetPropertyValue("House Telephone Line.Last Phone Number")
callerDateTime = GetPropertyValue("House Telephone Line.Time of last Call")

SetPropertyValue "Caller ID List.Caller 1 Name", callerName
SetPropertyValue "Caller ID List.Caller 1 Tele", callerTele
SetPropertyValue "Caller ID List.Caller 1 DateTime", callerDateTime

Dim PauseTime, Start, Finish, TotalTime
PauseTime = 10    ' Set duration.
Start = Timer    ' Set start time.
Do While Timer < Start + PauseTime
Loop
Finish = Timer    ' Set end time.
TotalTime = Finish - Start    ' Calculate total time.
ScottBot
Site Admin
Posts: 2790
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Post by ScottBot »

loo_hoo_ser wrote:...As I said in my last post, my workaround was to add a delay at the end of the script of 10 seconds to prevent the script from executing again within 10 seconds.
For the next version, I've changed the 'Allow Same Value' check box to remain selectable even for read-only controls.
What's interesting also is that the date/time display is truncated. In the X86 version of the SW remote, it shows up as date plus time (mm/dd/yyyy HH:MM:SS am|pm) format. The PPC remote only shows it as mm/dd/yyyy and the time is not displayed at all.
The values displayed in Property Labels will be truncated if the text exceeds the size of the Property Label control. My guess is that the font chosen by the OS on the PPC device isn't a 100% match of the font used on the PC. It's probably found a bit wider/larger font and is clipping the output. Try either expanding the width of the Property Label, using a different font, or downloading the exact same font from the PC to the PPC.
Scott
loo_hoo_ser
Member
Posts: 83
Joined: Sat Oct 30, 2004 4:16 pm

Post by loo_hoo_ser »

Scott -



I did as you suggested - expanding the size of the property label boundaries. That did the trick! All my problems are solved! It appears that even though the font names are the same, the sizing is different from the X86 and PPC remotes - what you see on the X86 remote is not quite the same on the PPC remote.



If the property label display boundary is too constraining then yes, quite a bit of the information is cut off. This also solves my other apparent problem that my data was not displaying correctly (e.g. all calls were containing identical information) and now they're all working fine!



Thanks for your suggestion!
Post Reply