fbpx

Retrieval with Python

This program will list, download and delete available calls that were recorded on your MIXpbx. The action can be defined by editing the .cmd file. Downloading soundfiles will not overwrite existing soundfiles with the same name, instead a copy will be created.

Download

Recordings retrieval v0.7.zip

Contents:

  • Python 2.7
  • Python script: recordings.py
  • .cmd file: recordings.cmd

How to use

Simply set the parameters in recordings.cmd by editing it in a text editor and double click it when you’ve saved your changes.

Setting up recordings.cmd

Launching this program requires several parameters to be set in recordings.cmd:

%~dp0p27\python.exe %~dp0p27\recordings.py -D $USERNAME.mixpbx.net -u $USERNAME -p $MANAGER_PASSWORD -a $ACTION -d $TARGET_DIR -k -s $SECONDS -i
pause

  • %~dp0p27\python.exe: Do not change this – it means that python.exe from folder p27 is used to execute the program.
  • %~dp0p27\recordings.py: Do not change this – it’s the script name that is executed
  • -D $USERNAME.mixpbx.net: The domain to connect to for checking the soundfiles. Replace $USERNAME by your MIXvoip username or replace $USERNAME.mixpbx.net by an IP address of your MIXpbx server.
  • -u $USERNAME: The username to use to connect to the soundfiles. Replace $USERNAME by your MIXvoip username.
  • -p $MANAGER_PASSWORD: The password to use to connect to -D. Replace $MANAGER_PASSWORD by the Manager password found on the MIXpbx webinterface under Configuration.
  • -a $ACTION: The action to use. Replace $ACTION by any of the following:
    • index: Lists all available soundfiles. This action ignores the parameters -d and -k as they have no impact on the listing.
    • get: Downloads all available soundfiles, saves them to -d and deletes them on the server (unless the parameter -k is given)
  • -d $TARGET_DIR: Target directory to save the soundfiles into. Replace $TARGET_DIR by an absolute path (e.g.: C:\Users\Example\Recordings). If the given path/folder does not exist, this program creates it. Don’t forget to use quotes  if your path has spaces in it (e.g. “C:\Firstname Lastname\Example\Recordings”).
  • -k: Stands for “keep” and disables the deleting process of the soundfiles on the server. If -k is omitted, every downloaded soundfile is deleted on the server.
  • -s $SECONDS optional: This parameter sets a sleep timer between downloads. The default value (if -s isn’t set) is 0.5 seconds. It was added because some systems block the script from downloading when it’s too fast. Try playing around with this parameter if the script doesn’t download everything at once.
  • pause: This pauses the command window to let you see what has been done. Without this pause, the window will close as soon as the script ended. If the script is automated, this pause should be removed
  • -i: Ignore already downloaded files. (If -k is not set the files will be deleted on the server)

First usage

If you execute the program for the first time, we recommend using the parameter -k to make sure everything works fine without losing the soundfiles from the server.

Worst case scenario without -k would be something like the soundfile was downloaded and deleted on the server but the file is corrupt on the local machine and no way to get back the original soundfile.

Another advantage using -k would be that you can test it on your computer at home to get to know the program and then download the files again on a different computer at work.