OBiTALK Community

General Support => On-Topic: Obihai and OBi Products => Topic started by: DeanJunk on September 16, 2012, 06:14:44 AM

Title: Update user defined digitmap from a script
Post by: DeanJunk on September 16, 2012, 06:14:44 AM
Is there anyway to update the user defined digitmaps with a script?  I created a PERL script to download the callhistory.xml from the device and then process the calls from it.  Any outbound number goes into a whitelist file and all inbound numbers not found in the whitelist file are inserted into a blacklist file (which I check daily).  I also build a digitmap string of the blacklist numbers and place it in a separate file which I manually paste into the user defined digit map.  Now I would like to do that from the script.  Any ideas?  By using a web inspector, there might be a DIGITMAPS.xml on the device?  Any help would be appreciated.
Title: Re: Update user defined digitmap from a script
Post by: QBZappy on September 16, 2012, 09:04:11 AM
DeanJunk

You wanna make $50?

Re: REPORTING! REPORTING! REPORTING! Easy and MUST have feature
http://www.obitalk.com/forum/index.php?topic=3048.msg26384#msg26384
Title: Re: Update user defined digitmap from a script
Post by: infin8loop on September 16, 2012, 09:53:17 PM
Quote from: DeanJunk on September 16, 2012, 06:14:44 AM
Is there anyway to update the user defined digitmaps with a script?  I created a PERL script to download the callhistory.xml from the device and then process the calls from it.  Any outbound number goes into a whitelist file and all inbound numbers not found in the whitelist file are inserted into a blacklist file (which I check daily).  I also build a digitmap string of the blacklist numbers and place it in a separate file which I manually paste into the user defined digit map.  Now I would like to do that from the script.  Any ideas?  By using a web inspector, there might be a DIGITMAPS.xml on the device?  Any help would be appreciated.

There is a DIGITMAPS_.xml (notice the underscore).  This xml is rendered and processed by default.xsl as seen at the top of a view source on the xml file. The process makes my head hurt. I'm not really up on xsl/xslt so I cannot offer more of a scripting solution at the moment. If you managed to do all that in PERL, perhaps this info will help you run with it.  Good luck. 
Title: Re: Update user defined digitmap from a script
Post by: DeanJunk on December 01, 2012, 11:49:20 AM
I figured out a way to update the field on the form and click the submit button, but now I can't figure out how to click the ok button on the confirmation popup.  Anyone deal with popups that ask OK/Cancel?  I'm using curl to do the first part.  I have the same issue with the remove all on the call history form.  Since the webserver on the OBI has issues when transferring the call history xml file when there are more than 50 entries, I decided to download the current entries (from the last date/time), store them in a file for true history and then remove everything on the OBI.  Any help would be appreciated!

Thanks!
Title: Re: Update user defined digitmap from a script
Post by: QBZappy on December 01, 2012, 12:57:39 PM
DeanJunk,

Use M$oft excel to view the xml file.
Title: Re: Update user defined digitmap from a script
Post by: infin8loop on December 01, 2012, 01:38:53 PM
On an OBi110/100 you can clear the call history by using the following URL

http://your-obi-ip-address/callhistory.htm?item=0

This can be done by typing the URL into a browser or emulating a call to it in a script.

Caution: There is no confirmation prompt and a single page showing "Number of calls in history: 0" will be returned (which could be ignored by a script).

Here is a link to an updated version of a script I posted earlier elsewhere on this forum. This version has an option to clear the call history.

obi-historydumpinatorV2.vbs:  https://www.box.com/s/9vdwpvswrvja3wbkuptd

The script must be configured by editing it:

''**** You must change the following 4 values to your specific configuration

strIP = "192.168.0.40"
''change 192.168.0.40 above to the local IP address of your Obi

strPassword = "obipassword"
''change obipassword above to the password of your local Obi page login

strDirectoryPath = "C:\Call_History"
''change C:\Call_History above to the full path of the directory to save the history files into. The Directory must already exist.

flgClearHistory = "N"
''change N above to Y to clear history after saving (if desired)
''Please test and ensure the script is saving history correctly to the appropriate directory before changing to Y!

''**** You must change the above 4 values to your specific configuration

The script will save the history file as: callhistory_ip_yyyymmdd_hhmmss.xml

Where "ip" will be the last part of the IP address for the Obi (after the last "." in the ip address) followed by date (yyyymmdd) and time (hhmmss) saved.  I have two OBi110's, so I have two configured versions of the script, one for each OBi.

As QBZappy said, the resulting XML imports into MS Excel nicely.

"Inator" is inspired by watching too much Phineas and Ferb with my 23 year old daughter. Doofenshmirtz Evil Incorporated.
Title: Re: Update user defined digitmap from a script
Post by: DeanJunk on December 01, 2012, 02:20:50 PM
Thanks for the most relevant information:)  I just need to clear the history since I will download a version of it each day and keep my own history.  Using curl to get the XML file works fine until there are more than 50 entries.  Usually it's not just the proper format of the XML file that is the issue.  It's portions of the history missing from the end of the file.  Seems like it just plains stop transferring after x bytes.

I can use my method to retrieve the file and process it (with PERL) and then your URL to wipe the history on the device.  I wish I could find a way to dismiss/acknowledge the confirmation popup through curl.  Then my whitelist/blacklist process would be fully automated by updating the digitmaps in the same process:)

I'm running Linux, so anything VB isn't an option for me.

Thanks again!