OBiTALK Community

General Support => Day-to-Day Use => Topic started by: MYOBi on January 21, 2012, 12:26:33 PM

Title: Script to record call in progress
Post by: MYOBi on January 21, 2012, 12:26:33 PM
I understand it is possible to login to OBI management interface and record the call in progress.
Is it possible to create a script, when executed from windows, it will start recording the call in progress from the PC OBI is connected to?

See this for scripting ideas: http://www.obitalk.com/forum/index.php?topic=1152.0

Or, preferably, is it possible to record the call in progress by pressing certain keys on the telephone keypad, recorded file to be saved in the connected PC?

Thanks,

Title: Re: Script to record call in progress
Post by: infin8loop on January 22, 2012, 02:17:04 AM
Per your request I created the attached obi-recordcallinator.vbs script.   I have done very limited testing.  It successfully recorded a couple of test calls, the longest being 1min 42secs.  I don't know for sure how it will behave on longer calls as the files get larger.

The 3 variables in the script that must be changed to your specific configuration are:

strURL = "http://192.168.0.40/record.au"
''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_Recordings"
''change C:\Call_Recordings above to the full path of the directory to save the call recordings into. The Directory must already exist.

The script does exactly what clicking the "Record" button does and the resulting recording is saved in the directory specified by strDirectoryPath with a file name in the format of obi_recording_yyyymmdd_hhmmss.au.

Good luck and let me know how it works out.

infin8loop

Updated the attached script. Added some basic error checking based on feedback. Will now display "No OBi call in progress" if there is no call in progress.

 
Title: Re: Script to record call in progress
Post by: MYOBi on January 22, 2012, 08:01:28 AM
infin8loop,

I tried your script a couple of times. The first attempt was not successful, at the end of the first call, my local OBI rebooted by itself, and nothing was recorded. At the second try, the recorded massage appeared in the specified folder. I like the additions of date and time strings. Very nice!

Thanks.

Edit: I ran the script again when there was no call in progress, just to perform a stress test. It gives an error message.
"Arguments are of wrong type" at Line 27, char 1, code... source...
Title: Re: Script to record call in progress
Post by: mrnaughty on January 22, 2012, 01:14:18 PM
Works good when call in progress.!
Thank you!
Title: Re: Script to record call in progress
Post by: infin8loop on January 22, 2012, 02:30:58 PM
Quote from: MYOBi on January 22, 2012, 08:01:28 AM
infin8loop,

I tried your script a couple of times. The first attempt was not successful, at the end of the first call, my local OBI rebooted by itself, and nothing was recorded. At the second try, the recorded massage appeared in the specified folder. I like the additions of date and time strings. Very nice!

Thanks.

Edit: I ran the script again when there was no call in progress, just to perform a stress test. It gives an error message.
"Arguments are of wrong type" at Line 27, char 1, code... source...


I'm not sure why your OBi would have rebooted.  I just checked my OBi and it's been up for 2 days (after a config change), well before I even thought of this script. If your OBi reboots immediately during or after the call recording, please check the Status -> System Status -> Product Information -> Uptime for the Reboot Reason code that's in parenthesis. This may or may not tell us something.         

I updated the script (see the updated attachment to the original post) by adding some basic error checking to handle the "Line 27, char 1" error when no call is in progress by displaying a more friendly "No OBi call in progress" message.

If anyone wants to share the longest duration of call they've successfully recorded with the script, I'd appreciate the info.

Thanks for the feedback.
Title: Re: Script to record call in progress
Post by: Judgeless on January 22, 2012, 02:55:18 PM
Works perfect.  Thanks
Title: Re: Script to record call in progress
Post by: MYOBi on January 22, 2012, 05:33:27 PM
infin8loop,

Quoteplease check the Status -> System Status -> Product Information -> Uptime for the Reboot Reason code that's in parenthesis. This may or may not tell us something.   

(6) may be the reason code for reboot:
UpTime           0 Days 8:14:57 (6)

The code works perfectly. Thanks again, in case we need such a recording one day for "Quality control purposes!!"
Title: Re: Script to record call in progress
Post by: RonR on January 22, 2012, 05:39:25 PM
Reboot Reason Codes:

6: New Profile Invoked AND Profile URL Changed
Title: Re: Script to record call in progress
Post by: MYOBi on January 23, 2012, 11:42:02 AM
Can you please explain what this code does? Does it change the configuration file inside the OBI so it enables the device for recording (<- I am guessing here)  and maybe that was the reason the profile was changed after first reboot?

The reason I am asking is when I was in a call today, during the converstion, both parties heard a female voice saying "This call is being recorded". We did not run this script at all during this call, and in fact the PC was OFF. We made the call from Google Voice (SP1). I am wondering if recorded announcement came from Google Voice, if not OBI itself.

When I run the script, we never heard "This call is being recorded" message before, although it is desired to hear that.

If profile is changed, what was changed in the profile to enable recording? Where can I look at in the expert mode or from the protal to find out profile enables recording if such a thing exist?

I searched and found this
https://groups.google.com/a/googleproductforums.com/forum/#!category-topic/voice/making-and-receiving-calls/Ct6NL05OgcA (https://groups.google.com/a/googleproductforums.com/forum/#!category-topic/voice/making-and-receiving-calls/Ct6NL05OgcA)


Thanks,
Title: Re: Script to record call in progress
Post by: infin8loop on January 23, 2012, 02:59:08 PM

I suspect the "This call is being recorded" voice you heard was from Google Voice.  Normally you would have to press "4" during the call to trigger Google Voice recording.  I have the press  "4" to record calls option disabled in my Google Voice settings but nevertheless I sometimes get the "This call is being recorded" voice during a call even though "4" has not been pressed by me or the other party. When this happens, the call is indeed recorded by Google Voice. The Google forum you cited seems to confirm this behavior is probably a bug in Google Voice. The OBi, as far as I know, does not have the capability (at this time) to voice a "This call is being recorded" when it's recording a call.  If legally required to notify the other party, then you'd have to do so, verbally, yourself (nonlegalbeagledisclaimer).

As far as your reboot is concerned, as coincidental as it might seem, I don't have any reason to believe it was a result of running this script to record a call. In testing, I have never experienced a reboot (my UpTime confirmed this).  I doubt the OBi recording a call involves making any changes to a profile.       

The script simply emulates what pressing the "Record" button within the OBi interface does. When you press the "Record" button in the local OBi interface at http://your-obi-ip-address you are essentially launching page
http://your-obi-ip-address/record.au.  You can confirm this by navigating directly to http://your-obi-ip-address/record.au during a call.  Going there with no call in progress results in an empty page.  The script accomplishes this by the lines objHTTP.open "POST", strURL, False, "admin", strPassword  and objHTTP.send where strURL = "http://your-obi-ip-address/record.au".
The response, or recording is in objHTTP.responseBody and is obtained by line BinaryStream.Write objHTTP.responseBody into a BinaryStream object that is then written to the target file by line BinaryStream.SaveToFile strFileName, 2.  Remember, all this script code is running on your PC, not the OBi.  The only script interaction with the OBi is through the http://your-obi-ip-address/record.au URL that your browser would use when clicking the "Record" button.

All this can be verified by looking at the html source of the appropriate "frame" of the browser window that the local OBi interface uses.

   

           
Title: Re: Script to record call in progress
Post by: MYOBi on January 23, 2012, 03:20:51 PM
Thanks for the detailed explanation.
Title: Re: Script to record call in progress
Post by: mrjoe on February 21, 2012, 01:21:13 AM
How would I use this script on a Mac?
Thanks
Title: Re: Script to record call in progress
Post by: Stewart on February 21, 2012, 03:23:21 AM
Quote from: mrjoe on February 21, 2012, 01:21:13 AM
How would I use this script on a Mac?
The VBS code runs only under Windows.

If you have Windows for your Mac (Parallels, Fusion, etc.), the script should run fine.  See http://www.macwindows.com/emulator.html .

If there is a Windows PC on your LAN, you could run it there, using remote access software.

Or, you could rewrite the script in another language (perl, python, PHP, etc.) that runs on Mac.
Title: Re: Script to record call in progress
Post by: whoit on September 14, 2012, 02:02:43 AM
I tried this script with my new Obi202 and it fails, plus it makes the Obi a bit squirrelly and I have to reboot.
I noticed the Web Admin page 'record.au' doesn't exist - I assume that the web page has been re-written for the current Obi202.
It looks like it's all JavaScript based, so no more individual pages.

Does any one else have an automated way to record calls?

Thanks...
Title: Re: Script to record call in progress
Post by: mrjoe on October 17, 2012, 02:56:07 AM
I found a way to automatically record calls on a Mac!!!


Using Phone Amego http://www.sustworks.com/sb_site/index.html (http://www.sustworks.com/sb_site/index.html)
(an Amazing Application)

See the this (https://dl.dropbox.com/u/54704536/Phone%20Amego.png) for how I set it up.

very simple
Title: Re: Script to record call in progress
Post by: Bay11 on November 02, 2012, 07:07:00 PM
Infin8loop, can you help me please.  I'm having troubles with the call record script and the OBI rebooting.
I tried the "obi-recordcallinator.vbs" script on an OBI-202 with poor results (my OBI reboots upon running the script).

When I run the script I received a "Windows Script Host" error "Status code = 12152 : Unknown".

I am running this script on an OBI 202 with the following specifications:
HardwareVersion:   1.3
SoftwareVersion:   3.0.0 (Build: 3460)

When I log into the Obi talk administration webpage and check status, I see the following:
I looked for a reboot reason code under; system status, product information, uptime, I do not see a reboot reason code, nor do I see the amount of free memory reported.

I'm using Microsoft Windows Vista, I've checked my firewall settings and directories security settings cannot find a reason why this is occurring (so the script and file, save is not being blocked).

I believe status code 12152 may mean, "error_winhttp_invalid_server_response  – the server response cannot be parsed".

I have attached a copy of OBI 202 callstatus.htm and DOM_Selection_Source.txt of the record button.  
I hope that this helps, I am not sure if this record script has been run on OBI 202 before?

I appreciate the help you all give and with any luck someone can find a solution.  Thank you!

https://www.box.com/s/kzzau8jkwcr8urd4zg0s
Title: Re: Script to record call in progress
Post by: skipro on November 05, 2012, 02:38:19 PM
Obi 202, Win 7
Trying record script I get an error msg: Status code = 401 : Unauthorized
IP address and passworf are correct. Run "as adminstrator" gets same results.
When I open Obi page, I see no "record" option/button.
Does this work with the 202? Can you record with the 202?
Title: Re: Script to record call in progress
Post by: QBZappy on November 05, 2012, 04:56:21 PM
skipro,

Try looking at the 'Call Status Page' when a call is active. There should be a Record button. It only shows up in the context of an active call.
Title: Re: Script to record call in progress
Post by: QBZappy on November 06, 2012, 10:31:17 AM
skipro,

I stand corrected. I just had an opportunity to test this on my OBi202 during an active call. It seems the record button has quietly disappeared!!!  ???
Title: Re: Script to record call in progress
Post by: skipro on November 06, 2012, 10:38:14 AM
QBZappy,
It exists & works on my 202. I tried it from OBitalk, record button shows but does not work. When accessed from IP on computer, it shows and works.
I tried uploading a screenshot but get error, "The upload folder is full. Please try a smaller file or contact administrator."
File is only 45KB
What I do not understand is why the script does not work with my 202. Is this because the 202 has the record button in a different place?
Title: Re: Script to record call in progress
Post by: mrjoe on November 06, 2012, 10:40:01 AM
Please could someone look at the Source Code and find out.
My Obi202 hasn't arrived yet.
Title: Re: Script to record call in progress
Post by: QBZappy on November 06, 2012, 02:20:55 PM
skipro,

I tried calls both directions. Outbound Call using the OBi phone, I do indeed see the record button in the 'Call Status'. However in an Inbound call I don't get the Record button.  ??? Can you try receiving a call and confirm if the 'Record' button shows. TKS.
Title: Re: Script to record call in progress
Post by: QBZappy on November 06, 2012, 02:38:18 PM
skipro,

Related to your problem re the script, it occurred to me that the urls in the OBi202 are different from the OBi100/110. If the previous script references this, you may need to use a tool like 'Firebug' Firefox addon to identify the proper syntax for the OBi202.
https://getfirebug.com/
Title: Re: Script to record call in progress
Post by: skipro on November 07, 2012, 09:44:15 AM
QBZappy,
Confirmed. No record button on receiving calls. Any idea why not?

In reference to your suggestion on the script, I do not use Firefox so the add on is not a solution.
Since the record button is not on the front screen but 2 screens down, Main screen >Status > Call status, does the script need to refer to this location [2 screens from front screen] and this is why it does not work?
Title: Re: Script to record call in progress
Post by: QBZappy on November 07, 2012, 10:02:13 AM
skipro,

Then the record button is partially broken. I hope the OBi people have noticed this.

Re: script, I don't use it, so I don't really know how it works. Our friend infin8loop may have something to say about this.

If you use a Mac I believe that there is a very useful product that would serve your needs (not-free).
Phone Amego
http://www.sustworks.com/pa_guide/index.html#.UJqgMGcpYjk.

If you wanted to record your calls it may be simpler to use a hardware approach using a cheap $3 adapter.
RJ11 Telephone Line Pass-Thru to 3.5mm Mini-Jack Conversation Recording/Line-out Adapter
http://dx.com/p/rj11-telephone-line-pass-thru-to-3-5mm-mini-jack-conversation-recording-line-out-adapter-18869
Title: Re: Script to record call in progress
Post by: MikeHObi on November 07, 2012, 06:14:07 PM
I have the Obi202
HardwareVersion   1.3   
SoftwareVersion   3.0.0 (Build: 3460)

Calling into the obi, on the local admin webpage I get record call as an option on the call status page using Chrome web browser.  Clicking it during the call starts a download of a file called record.au which continues to download until the call ends.  Inside this .au file is the audio of the call.

Calling from the obi, on the local admin webpage I get record call as an option on the call status page using the Chrome web browser.  Clicking it during the call starts a download of a file now called record(1).au which continues to download until the call ends.  Inside this .au file is the audio of the call.

Of course if I have an incoming call on my google voice line I can press 4 and it will record the call and store it in google voice.

I didn't try the script.
Title: Re: Script to record call in progress
Post by: QBZappy on November 07, 2012, 06:58:33 PM
The Record button not showing up in my Firefox v16.0.2 could very well be a browser compatibility issue.
Title: Re: Script to record call in progress
Post by: skipro on November 08, 2012, 03:03:56 PM
If I call into the Obi through and phone associated with Obi, a record button will show. If I call into Obi from a phone not associated with Obi I get no record button. Mike, did you call into Obi from a phone /line not associated with Obi?
Title: Re: Script to record call in progress
Post by: MikeHObi on November 08, 2012, 06:02:16 PM
did another test.  Firefox 16.0.2 button allowed recording... asked me to verify the save, but worked, both with me calling via my cell, or calling my cell via the obi.

IE 9 button allowed recording, asking me to save etc same thing, calling my cell or my cell calling in.

So all my browsers work. 

As far as how it's done.  Home phone is on phone port 1 of the obi and it is set to call out using Google Voice.  I have it call my personal google voice number that rings my cell (not my cell's direct number). 
When I call my home on my cell, I have it call using google voice, to the google voice number for my home.  That routes it to an anveo DID with fee incoming calling.

I don't know what associated with the obi means.  the anveo line is setup as sp3, callcentric is still setup as sp2, and google voice is sp1.
Title: Re: Script to record call in progress
Post by: infin8loop on November 09, 2012, 12:26:40 PM
Quote from: Bay11 on November 02, 2012, 07:07:00 PM
Infin8loop, can you help me please.
...
https://www.box.com/s/kzzau8jkwcr8urd4zg0s

I don't have an OBi202, so I cannot test. 

Looking at the source for callstatus.htm (from an Obi202) in the above "box" file (posted by bay11) I see:

function click_record(p){
var a;
a="record.au?port="+p;
document.forms[0].action=a;
document.forms[0].submit();
}

The above function click_record(p) appears to invoke url
"http://your-obi-ip-address/record.au?port=0"

The port is zero because in the code I'm looking at the function click_record is invoked when clicking
the "record" button by code:

<input class=buttoninput type=button value='Record' onClick="click_record(0)">.

Notice the zero being passed as a parameter to the function.
I don't know if the parameter will always be zero or will vary depending on what call(s) are in progress. 

I suggest someone with both my original script and an Obi202 do the following:

Make sure you modify the following 3 lines in the script as shown:

strURL = "http://192.168.0.40/record.au?port=0"
''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_Recordings"
''change C:\Call_Recordings above to the full path of the directory to save the call recordings into. The Directory must already exist.

Notice the addition of "?port=0" to the strURL string which is not in the original script because the OBi110 doesn't (or didn't) need it. The poster of the htm file (bay11) appears to have had only 1 call in progress at the time of the callstatus.htm source capture.  If memory serves me correctly, an OBi110 only has one "record" button even if more than one call is in progress.  Pressing "record" will record whatever call in on the phone as you "flash" dial between the calls (if that makes sense). I don't know what the OBi202 shows. Does an OBi202 show more than one record button for multiple calls necessitating the port number?   
Title: Re: Script to record call in progress
Post by: mrjoe on November 10, 2012, 09:04:49 AM
Infin8loop, thanks so much for your help.

I can confirm the following:
The following URL will record calls only on Phone port 1
"http://your-obi-ip-address/record.au?port=0"

Putting a 1 in place of the 0 will record calls only on Phone port 2
"http://your-obi-ip-address/record.au?port=1"
Title: Re: Script to record call in progress
Post by: MikeHObi on November 10, 2012, 01:04:21 PM
Obi puts up two grids with a record button on the header of each for multiple call presentations on the obi202.
See below.
(https://lh4.googleusercontent.com/-KYlQOv4jEkk/UJ6_JOOtOtI/AAAAAAAADa4/qY2NO15qp1E/s800/TwoCallsOnObi202.jpg)

Now I did test this and and flashing between the callers was wonkey.i.e. the first caller could be flashed to hold, but when I went back they couldn't hear me, but I could hear them.  Recording caught both sides though.  Pressing the second button after pressing the 1st didn't really do anything.  It appears that what it is recording is what is sent or received from the handset, and not the individual sp ports.

Thus if I press record call on the top call, it switched to showing stop recording for both.
Title: Re: Script to record call in progress
Post by: infin8loop on November 10, 2012, 01:23:19 PM
Quote from: mrjoe on November 10, 2012, 09:04:49 AM
Infin8loop, thanks so much for your help.

I can confirm the following:
The following URL will record calls only on Phone port 1
"http://your-obi-ip-address/record.au?port=0"

Putting a 1 in place of the 0 will record calls only on Phone port 2
"http://your-obi-ip-address/record.au?port=1"

Thanks for the heads-up. I forgot the OBi202 has two phone ports. Makes sense why the port parameter is needed.

Below link points to an updated version of the original script. The phone port (0 or 1) may be passed to the script via the command line. This can be done by creating a shortcut for the script and then editing the properties of the shortcut. Add a 0 or 1 to the end of the shortcut "Target" after the last double quote if there are double quotes surrounding the value. There should be a space between the last double quote and the 0 or 1. Create two different shortcuts, one with a 0 for phone port 1 and another shortcut with a 1 for phone port two. No port needs to be passed for the OBi 100/110.  

Three lines in the script still need to be modified to your own values.
 
script: https://www.box.com/s/hthaoxvqbuidwd6uogqp


Again, I don't have an OBi202, so I cannot test the nuances of script execution.

The upload directory here on the forum shows to be full.

Update: If you have an OBi202 and can't remember to pass the 0 or 1 in the command line then you can add the three lines shown in red below:

if WScript.Arguments.Count = 1 then
    strPort = WScript.Arguments(0)
    if strPort = "0" or strPort = "1" then
        strURL = strURL & "?port=" & strPort   
    else
        wscript.echo "If a port number is passed, it must be 0 or 1"
        wscript.quit(2)
    end if
else
    wscript.echo "You must include the phone port number in the shortcut for an OBi202"
    wscript.quit(2)
end if

I was attempting to make the script generic enough to handle both an OBi100/110 or OBi202. The port is not need for an OBi100/110.
Title: Re: Script to record call in progress
Post by: skipro on November 10, 2012, 04:13:12 PM
Infi8loop,
Thanks for the scripts.
What script line would send a error msg if no port # was included. You have one if it is not "0" or "1", but what if there is no port # added or included.
Msg Ex:  "You must include the phone port number in the shortcut"

Now all you get is a Windows Script Host error: "Status code = 12152 : unknown"
Title: Re: Script to record call in progress
Post by: infin8loop on November 10, 2012, 05:20:32 PM
Quote from: skipro on November 10, 2012, 04:13:12 PM
Infi8loop,
Thanks for the scripts.
What script line would send a error msg if no port # was included. You have one if it is not "0" or "1", but what if there is no port # added or included.
Msg Ex:  "You must include the phone port number in the shortcut"

Now all you get is a Windows Script Host error: "Status code = 12152 : unknown"

Please see the update in my earlier post. 

Does the updated script work on an OBi202 if the phone port is passed in the command line? 
Title: Re: Script to record call in progress
Post by: skipro on November 11, 2012, 04:06:54 AM
Infi8loop,
Again, thanks. Works fine.
Another option I used before you updated your script to include the port was to add the port info to your original script, then have 1 script one for port1 and another for port2.  Obviously your updated script is more elegant.

Another idea, have the script request the port number in an input box, then after user input, proceed. How would this be done?
Title: Re: Script to record call in progress
Post by: cyberic68 on February 05, 2013, 08:26:06 PM
Hi infini8loop,

I have an Obi110, I have run your script without a real success

I did update your script with the following

strURL = "http://192.168.11.27/record.au"
strPassword = "xxxxx"
strDirectoryPath = "C:\Users\Eric\Call_Recordings"

I run the script with "Microsoft Windows Based Script Host" under Windows 8 Pro.

Automatically it has created a file under C:\Users\Eric\Call_Recordings

obi_recording_20130205_230448.au with 0kb size

Then I have made a phone call, but nothing has been recorded, the file size was still 0 kb after I hang up.

Would you have an idea ?

thanks

Eric
Title: Re: Script to record call in progress
Post by: infin8loop on February 06, 2013, 02:36:00 PM
cyberic68,

Upon trying to run my OBi related scripts I've discovered they all fail now. I use Windows XP (a work requirement). I don't routinely use the scripts that I have posted. I developed them as a hobbyist and they worked (for me) when posted. I'm not sure exactly what has changed to render the scripts inoperable.
The script to record calls was designed to be launched while a call is in progress on the OBi.  It emulates pressing the "Record" button while on the OBi Call Status page. Or navigating directly to http://your_obi_ip_address/record.au (the same URL the "Record" button on an OBi100/110 Call Status page envokes) in a browser window while a call is in progress used to work. Now that fails for me as well. If I figure it out, I'll post back.
   
Title: Re: Script to record call in progress
Post by: cyberic68 on March 19, 2013, 08:29:49 PM
Hi infin8loop

I really hope that you will find a work around

Thanks

Cyberic68
Title: Re: Script to record call in progress
Post by: opuletn on November 21, 2013, 07:34:06 AM
I switched from a Obi110 to a Obi200 and the original script that used to work for the Obi110 stoped working.
Adding the ?port=0 to the strURL as infini8loop suggested fixed it. Even though the Obi200 only has 1 physical phone port.
Title: Script to stop call in progress
Post by: infin8loop on October 03, 2014, 02:01:04 AM

At the request of DougObiFan, another script to stop a call recording in progress:

https://app.box.com/s/clcyu6z2y41oth299jtb

You could create a shortcut named "Stop OBi Recording" pointing to the vbs script.  You will need to change 2 parameters in the script for your OBi IP address and your password. I tested with an OBi110 and it seems to work.
Be aware the stop script will indicate "OBi Recording has been stopped" whether or not there was an actual recording in progress to be stopped.

As others have confirmed, on Obi2?? models (and perhaps others) a port=n parameter might to to be added.  The script will handle a 0 or 1 if passed as part of the executing command line.

I came to the conclusion that my "work" laptop has had so much security put on it that running vbscripts is no longer an option. I'm on a non-work Vista laptop now and the scripts seem to run fine. I only have access to 2 OBi110 models, so scripts may or may not work for all the new fangled boxes out there.
Title: Re: Script to record call in progress
Post by: kommon on December 05, 2014, 11:52:52 AM
Is there anyway to automate this process to record all calls by setting some entry in ddwrt router and forwarding request to destination computer?
Title: Re: Script to record call in progress
Post by: curt00 on July 14, 2015, 10:11:55 AM
Quote from: mrjoe on October 17, 2012, 02:56:07 AM
I found a way to automatically record calls on a Mac!!!


Using Phone Amego http://www.sustworks.com/sb_site/index.html (http://www.sustworks.com/sb_site/index.html)
(an Amazing Application)

See the this (https://dl.dropbox.com/u/54704536/Phone%20Amego.png) for how I set it up.

very simple

Can you elaborate?  Where does http://10.100.101.105/record.au point to?  Is that your internal IP address for your Mac?

What about your input for "Notification URL".  Do I enter the same URL as you have?  If not, what should I enter?

Title: Re: Script to record call in progress
Post by: curt00 on July 14, 2015, 10:58:29 AM
Quote from: MYOBi on January 21, 2012, 12:26:33 PM
I understand it is possible to login to OBI management interface and record the call in progress.

How do you do this?  I've tried this by going to http://192.168.2.XX > Status > Call Status > clicked on Record.  But I cannot find the recording or recorded file.  On Call History, there is no recording to playback.
Title: Re: Script to record call in progress
Post by: drgeoff on July 17, 2015, 08:48:01 AM
Quote from: curt00 on July 14, 2015, 10:58:29 AM
Quote from: MYOBi on January 21, 2012, 12:26:33 PM
I understand it is possible to login to OBI management interface and record the call in progress.

How do you do this?  I've tried this by going to http://192.168.2.XX > Status > Call Status > clicked on Record.  But I cannot find the recording or recorded file.  On Call History, there is no recording to playback.
The file is saved on the computer,  not the OBi.
Title: Re: Script to record call in progress
Post by: b3ll on March 19, 2016, 12:10:46 PM
Quote from: infin8loop on January 22, 2012, 02:17:04 AM
Per your request I created the attached obi-recordcallinator.vbs script.

Good luck and let me know how it works out.

infin8loop

It works perfect for me on my OBi100. Thanks so much!!!
Title: Re: Script to record call in progress
Post by: siafu2000 on March 27, 2016, 01:42:05 PM
Is there a script or instructions on how to record all calls automatically in windows?
Title: Re: Script to record call in progress
Post by: restamp on March 27, 2016, 06:18:44 PM
I don't do Windows, but here is a script I use to record conversations on my Linux box.  Perhaps it might help give you some ideas.
#
# This script records a phone call in progress from the specified OBi device
#
USER=user
PW=/change/this/to/the/password/of/the/user/account/on/your/OBi/device
DIR=/path/to/the/directory/to/save/recorded/conversations/in
IP=192.168.0.5/user     # change this to whatever IP address is assigned to your OBi

[ X != "X$1" ] && FILE="$1" || FILE="${0##*/}-$(date +%F@%H:%M)"

cd "$DIR"

case "./$0" in
*/ph1 ) PORT=0 ;;
*/ph2 ) PORT=1 ;;
esac

exec wget --user="$USER" --password="$PW" --output-document="$FILE" \
                "http://$IP/record.au?port=$PORT"


Install this shell script in a directory searchable by your PATH variable, and link it as both "ph1" and "ph2".  When I'm on a call and decide I'd like to record it, I type "ph1" or "ph2" on a command line screen, depending on which line I am on.  The recording continues until I cancel it or hang up.  Optionally, I can specify the name of the file as an argument to the command itself; otherwise the script creates one based on the current date and time.

A few caveats:  This was tested under the Korn shell, but it uses standard shell constructs and should run correctly under any modern shell.  It's only been tested with my OBi202 which is running build 5135.  It does support recording two conversations simultaneously.  I chose to use the user account to initiate the recordings.  I did this because it is more restrictive, but you can also use the admin account if you prefer; just change the USER variable to "USER=admin", specify the admin password, and remove the "/user" from the IP address.  Since the account password is recorded in the script, you should probably restrict read access to protect your OBi's access credentials from prying eyes.  (BTW, you do know how to set the User account password, right?  It can be done under the 'System Management' -> 'Device Admin' page on the OBi.)

My Easter present to all you Linux folks reading the forum.  Enjoy!
Title: Re: Script to record call in progress
Post by: Ruslan on September 30, 2016, 09:50:44 AM
Here's a Python script that can run on any OS (Windows, Mac, Linux etc).



ip_address = '192.168.0.55'              # IP address of the OBInet
username, password = 'user', 'user'   # username and password
local_dir = 'C:/temp/recordings'         # directory to save .au audio files

# you unlikely will need to make any changes below

import requests
from requests.auth import HTTPDigestAuth

from time import sleep, strftime

while 1 == 1:
    try:
        response = requests.get('http://%s/user/record.au' % ip_address, auth=HTTPDigestAuth(username, password))

        if response.status_code == 200 and len(response.content) > 0:

            filename = strftime(local_dir + '/rec%Y-%m-%d_%H-%M-%S.au')

            with open(filename, 'wb') as f:
                f.write(response.content)
                f.close()

            print('New file %s created' % filename)

    except Exception as e:
        print('%s: exception: %s' % (strftime("%c"), e.message))

    sleep(10)



It's also stable for any temporary network or Obinet problems - will not bail out and keep monitoring for calls.
Title: Re: Script to record call in progress
Post by: ubergoober on October 16, 2016, 09:40:21 PM
I took a different approach.  I have Freeswitch running on a Raspberry Pi and my OBI202 SP3 registers to Freeswitch.  I added a Speed dial entry **31732.  When dialed, extension 1732 simply records any audio that is received.  While on either an incoming or outgoing call, line 1 or line 2, I am able to key the flash button on my DECT phone, followed by the speed dial entry and then flash a 2nd time and the call is recorded.  WinSCP let's me get at the recordings easily.
Title: Re: Script to record call in progress
Post by: ubergoober on November 21, 2016, 10:23:13 PM
2nd Alternative approach?  Node-Red running on the Pi.  I directed Obi202 syslog output to udp port 1514.  Node-Red running as a service captures the syslog events, and when an off-hook message comes through, executes a wget based shell script to "press" the record button for the appropriate port.  Upon completion, the CDR callhistory.htm page is called and the caller ID is used to rename the recording with a timestamp, and if the call was received or placed, in the filename.  Completely hands free operation, while accommodating both ports.

You can find this node-red flow at the node-red library: http://flows.nodered.org

or on github:

https://gist.github.com/tomlynn/1acb62db43de9b7f8bc0750f02307d54
Title: Re: Script to record call in progress
Post by: Noodles on February 19, 2017, 10:00:21 AM
Infin8loop, great script! Thank you!

Anyone know how can I append the complete phone number associated with the call to the file name in the vb script? Would like to add it at the end of the current file name scheme so I can quickly search when needed.

Thanks again!
nn

Title: Re: Script to record call in progress
Post by: ubergoober on April 11, 2017, 11:23:48 PM
@Noodles,
You'll want to have your script wait a second or two after the recording completes and then look at the contents of http://obi-ip-address/callhistory.htm  It contains the list of call detail records.  Good luck.
Title: Automated Call Recorder, with Filter
Post by: AutoCallRecorder on June 13, 2017, 09:42:12 PM
Hello,

Like many of you, I got frustrated with the Obihai's seeming inability to record calls automatically. I've adapted the OP's script so that, as long as its running, it will monitor the call status page for active calls from/to numbers white-listed in the script and record those calls, producing an output file with the callers'/recipients' name. Make sure that the script starts up with Windows.


I might adapt the script so that it's easier to expand the number of filtered names and numbers (by adding an array for it to check rather than just blocks of if statements) if there's any popular demand. Additionally, if anyone requests, and time permits, I could modify the script so that it records all phone numbers and names the resulting files with the phone number included.

Enjoy!
Title: Re: Script to record call in progress
Post by: GoogleFan on November 13, 2017, 10:16:51 AM
Can anyone help me?

I don't have the record button at all on my Obi1032 device. I only have it on my Obi200.
Is something wrong with my device?

Thanks
Title: Re: Automated Call Recorder, with Filter
Post by: GV_OSCE on August 28, 2018, 11:14:48 AM
Quote from: AutoCallRecorder on June 13, 2017, 09:42:12 PM
Hello,

Like many of you, I got frustrated with the Obihai's seeming inability to record calls automatically. I've adapted the OP's script so that, as long as its running, it will monitor the call status page for active calls from/to numbers white-listed in the script and record those calls, producing an output file with the callers'/recipients' name. Make sure that the script starts up with Windows.


I might adapt the script so that it's easier to expand the number of filtered names and numbers (by adding an array for it to check rather than just blocks of if statements) if there's any popular demand. Additionally, if anyone requests, and time permits, I could modify the script so that it records all phone numbers and names the resulting files with the phone number included.

Enjoy!

Are you able to adapt the script so it records ALL the phone conversations?  We only use these ObiTalk/GV phones for training purpose.
Title: Re: Script to record call in progress
Post by: ubergoober on November 18, 2018, 12:10:34 PM
I've updated the Node-Red flow that records all calls with an OBI202.

https://flows.nodered.org/flow/1acb62db43de9b7f8bc0750f02307d54 (https://flows.nodered.org/flow/1acb62db43de9b7f8bc0750f02307d54)

Best Regards,
Tom
Title: Re: Automated Call Recorder, with Filter
Post by: JamesJ on January 06, 2020, 09:54:03 PM
Quote from: AutoCallRecorder on June 13, 2017, 09:42:12 PM
Hello,

Like many of you, I got frustrated with the Obihai's seeming inability to record calls automatically. I've adapted the OP's script so that, as long as its running, it will monitor the call status page for active calls from/to numbers white-listed in the script and record those calls, producing an output file with the callers'/recipients' name. Make sure that the script starts up with Windows.


I might adapt the script so that it's easier to expand the number of filtered names and numbers (by adding an array for it to check rather than just blocks of if statements) if there's any popular demand. Additionally, if anyone requests, and time permits, I could modify the script so that it records all phone numbers and names the resulting files with the phone number included.

Enjoy!
Title: Re: Automated Call Recorder, with Filter
Post by: JamesJ on January 06, 2020, 09:56:09 PM
Hello Automated Call Recorder,

I have a obi 1032 phone. I have run your script from a Windows 10 computer on the network.
As soon as someone calls, I receive an error message: Windows Script Host Status Code = 404: Not found.

Could able to help me?

THanks
Title: Re: Script to record call in progress
Post by: ubergoober on January 09, 2020, 10:47:37 PM
I've updated my Node-Red based call recording flow at: https://flows.nodered.org/flow/1acb62db43de9b7f8bc0750f02307d54

It allows you to trigger recording manually with a URL or you can use syslog to trigger recording on all calls.  It no longer uses shell scripts to do the work and is a lot more accurate in it's identification of the remote caller ID.  It will rename the recording to include the date and remote caller ID and if you install FFMPEG on your LINUX system it will convert the recording to mp3 to save space.

Enjoy!
Title: Re: Script to record call in progress
Post by: ubergoober on January 17, 2020, 02:30:42 PM
I've made another update to the Node-Red flow.  I've added the ability to reboot your Obi periodically.  It checks to see if there's a call in progress before restarting the device.

The other addition is automatic filing of your recordings into sub directories based on date.

This works very well on an inexpensive, headless Raspberry Pi computer.  Neither of the new features are directly connected to the call recorder, but they are in the same flow for ease of installation.  

Next addition will be a web service call method to stop recording.  
After that, I'm working on assembling the individual syslog digits dialed messages on outbound calls in order to know the remote party number before the session is established.  This will unlock the ability to program a list of numbers that you want to automatically record.  So you don't have to record everything, and nor will you have to manually start recording.

Please let me know if you have any other ideas for the OBI.
Title: Re: Script to record call in progress
Post by: threehappypenguins on June 30, 2023, 06:07:14 PM
Quote from: ubergoober on January 09, 2020, 10:47:37 PMI've updated my Node-Red based call recording flow at: https://flows.nodered.org/flow/1acb62db43de9b7f8bc0750f02307d54

It allows you to trigger recording manually with a URL or you can use syslog to trigger recording on all calls.  It no longer uses shell scripts to do the work and is a lot more accurate in it's identification of the remote caller ID.  It will rename the recording to include the date and remote caller ID and if you install FFMPEG on your LINUX system it will convert the recording to mp3 to save space.

Enjoy!

Thank you for doing this! I am a total noob with Node-RED (or node in general). I have an Obi 202. I also have an Odroid HC4 running OMV on Debian and installed Node-RED via a Portainer stack, so it's running on Docker. I cannot get this to run (I want to record all calls automatically). I'm confused about the "wires."

You said,
QuoteIf you decide you want to record all calls, then disconnect the wire from the 1st and second function nodes.

From my understanding, the first Function node is "Simulate Syslog Off Hook Message when user sends proper urlencoded method" and the second Function node is "Set Defaults and Determine Off Hook Port Number". Is that correct? If so, they are not connected by a wire by default when I import your script. So leave it as is?

Secondly, you said
QuoteConnect the wire from the Obi Syslog UDP in node to the 2nd function node.

So this means I connect a wire from "Obi Syslog on UDP 1514" to "Set Defaults and Determine Off Hook Port Number"?

I can't get it to work. And I don't know how to get the debug to work. I tried connecting the debug to "Obi Syslog on UDP 1514" but it won't work. I made sure I changed the IP addresses for 192.168.1.47 to 192.168.1.6 (which is my Obi 202). And in my Obi 202, I changed the port from 514 to 1514 in the device admin (but I need to leave "Server" just above it blank/default"? Or do I add 192.168.1.38 which is my Odroid HC4?). I also added basic authentication wherever the flow indicated as well, having the user as "admin" and putting in my password (what I use to log into the local Obi page). I am definitely on port 0 for the phone calls (not port 1).

I did click "Deploy" whenever I would make changes.

I'm just trying to make sense of all this.
Title: Re: Script to record call in progress
Post by: threehappypenguins on June 30, 2023, 07:30:46 PM
I have it all figured out. Two problems. One, for "server" in the Device admin in the Obi, I indeed must put 192.168.1.38 which is my machine running Node-RED. The other problem was my Docker Node-RED container settings. I needed to tell the host to forward port UDP 1514 to 1514 within the container. NOW it works. If anyone is wondering, this is my docker compose for my Portainer stack:

---
version: "2"
services:
  node-red:
    image: nodered/node-red
    container_name: node-red
    environment:
      - PUID=1000
      - PGID=100
      - TZ=Canada/Atlantic
    volumes:
      - /srv/dev-disk-by-uuid-088953ed-6887-487c-bd44-d5f86dc93383/AppData/Nodered:/data
    ports:
      - 1880:1880
      - 1514:1514/UDP
    restart: unless-stopped

And then of course, I needed to create a folder called "recordings" within the data folder, and in the script for "func":"msg.filePath = \"/opt/recordings/\"; I changed it to "func":"msg.filePath = \"/data/recordings/\";.
Title: Re: Script to record call in progress
Post by: threehappypenguins on July 01, 2023, 11:00:52 AM
I had to make a few changes. For one thing, because I have Node-RED running in a docker container, I couldn't figure out how to tell the script to use either ffmpeg from my host system, or from another container with ffmpeg. So I finally gave that up and just entered the Node-RED container shell and installed ffmpeg:

sudo docker ps (and I took note of the container ID)
sudo docker exec -it --user=root f4d6abb9d6d9 bash (sub f4d6abb9d6d9 with whatever your container ID is)
apk add ffmpeg (this Alpine command installs ffmpeg)

The other major change was the script to create the mp3. It would do funky things like try to create the following (example): /data/recordings/record_7/1/2023,-11-32-21-AM_5551239876.mp3

I think what is meant to happen is it creates a file called record_7-1-2023,-11-32-21-AM_5551239876.mp3 but it has slashes instead of dashes and because the folders record_7 and 1 don't exist, the mp3 file is never made. Plus there's the weird, random comma in there. Here is a script that will create a file such as 2023-07-01_11-32-21_5551239876.mp3 right in the /data/recordings folder (or /opt/recordings or whatever you want):

Double click on the node Clear Flow CID Variables / build command for next exec node to Rename File and convert to MP3 and change the script to this (substituting the folderPath with whatever your folder is where you want your recordings):

msg.payload = "";

var now = new Date();
var month = String(now.getMonth() + 1).padStart(2, "0");
var day = String(now.getDate()).padStart(2, "0");
var year = now.getFullYear();
var hours = String(now.getHours()).padStart(2, "0");
var minutes = String(now.getMinutes()).padStart(2, "0");
var seconds = String(now.getSeconds()).padStart(2, "0");

var timestamp = `${year}-${month}-${day}_${hours}-${minutes}-${seconds}`;

msg.now = timestamp;

// Clear the CID flow variable for this call only.
if (msg.port === "0") {
    var cid = flow.get("port0cid");
    flow.set("port0cid", "unknown");
}
if (msg.port === "1") {
    var cid = flow.get("port1cid");
    flow.set("port1cid", "unknown");
}

// Folder path
var folderPath = "/data/recordings/";
msg.folderPath = folderPath;

// Build Linux command to post-process the file, including renaming and conversion to MP3
var newName = folderPath + timestamp + "_" + cid + ".mp3";
msg.newName = newName;
msg.payload = "ffmpeg -i " + msg.filename + " " + newName + " && rm " + msg.filename;
return msg;

At this point, I'm not entirely sure what will happen with the other nodes with scripts for archiving and whatnot, but for now, it records the call automatically for me, and converts it to an mp3, which is top priority for me right now.

For reference, the original script is this:

msg.payload = "";
var now = new Date();
now = now.toLocaleString();
now = now.replace(/[ :]/g, "-");
msg.now = now;
// Clear the CID flow variable for this call only.
if (msg.port === "0") {
    var cid = flow.get("port0cid");
    flow.set("port0cid", "unknown");
}
if (msg.port === "1") {
    var cid = flow.get("port1cid");
    flow.set("port1cid", "unknown");
}

//Build Linux Command to post-process the file which includes renaming
//and possibly conversion to MP3
var newName = msg.filePath + "record_" + now + "_" + cid + ".mp3";
msg.newName = newName;
msg.payload = "ffmpeg -i " + msg.filename + " " + newName + " && rm " + msg.filename;
return msg;
Title: Re: Script to record call in progress
Post by: formerlyubergoober on September 23, 2023, 12:05:07 PM
Hello, ThreeHappyPenguins!
I wrote the node-red flow you've based your automations on.  For whatever reason, when I needed a password reset to access Obitalk, they forced me to re-enroll using a different username, so I tried to make it plain I'd previously used ubergoober as my handle.

I'm so glad that someone is getting some use out of the recording flow.  I have to admit there's some stuff in there that isn't optimal.  I'm hoping you worked around it.  I have always thought that node-red is so easy to work with and since it's cross-platform the solution wasn't restricted to a specific OS.

Glad you had an open mind.

Ubergoober