Script to record call in progress
b3ll:
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!!!
siafu2000:
Is there a script or instructions on how to record all calls automatically in windows?
restamp:
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.
Code:
#
# 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!
Ruslan:
Here's a Python script that can run on any OS (Windows, Mac, Linux etc).
Code:
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.
ubergoober:
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.
Navigation
[0] Message Index
[#] Next page
[*] Previous page