Conversion of Call History FreePBX -> MikoPBX
What is migrated
Only the call history (database records) is migrated.
Call recording files are not copied or re-encoded. Paths to the
.mp3files are written into the database, but the files themselves must be transferred and, if necessary, re-encoded separately — see «Transferring call recording files».
Downloading the script
The script is maintained in the MikoPBX Core repository. Download it onto your working machine:
curl -o miko-cdr-migrate.sh \
'https://raw.githubusercontent.com/mikopbx/Core/develop/tools/migration/miko-cdr-migrate.sh'Step 1. On FreePBX — exporting the history
Copy the script to the FreePBX station and connect to it:
scp miko-cdr-migrate.sh root@FREEPBX_IP:/usr/src/ ssh root@FREEPBX_IPRun the script. It reads the MySQL login and password from
/etc/freepbx.confon its own:cd /usr/src && sh miko-cdr-migrate.sh
The script detects that this is FreePBX, selects the source table (PT1C_cdr, or cdr otherwise) and creates the file /usr/src/miko-mysql-to-sqlite/master.db.
Step 2. Transferring the master.db file
Copy the resulting master.db to MikoPBX into the upload directory:
Step 3. On MikoPBX — importing
Copy the script to MikoPBX into the upload directory and connect:
First preview what will be done, without changing anything:
If everything looks fine, run the import:
The script detects the station and the table inside master.db, makes a backup of the working database (cdr.db.dmp), clears and fills cdr_general with the correct mapping, and puts cdr.db back in place.
Done! The history will appear in the MikoPBX web interface.
Transferring call recording files
The script writes the recording file paths into the database in the MikoPBX format (/storage/usbdisk1/mikopbx/voicemailarchive/monitor/YYYY/MM/DD/<name>.mp3), but the files themselves stay on FreePBX. To transfer and re-encode them to MP3:
On MikoPBX, prepare the list of files to download (specify your own date):
Download the recordings from FreePBX and re-encode them to MP3 (the FreePBX address is the second argument):
Useful options
sh miko-cdr-migrate.sh --dry-run
Show what will be done without changing anything (on MikoPBX prints the resulting SQL)
sh miko-cdr-migrate.sh --mode=freepbx
Force FreePBX mode, skipping auto-detection
sh miko-cdr-migrate.sh --mode=mikopbx
Force MikoPBX mode
sh miko-cdr-migrate.sh --master=/path/master.db
Non-standard path to master.db
sh miko-cdr-migrate.sh -h
Help
If the paths or credentials are non-standard, they can be overridden via environment variables:
Rollback on MikoPBX
If the result is not satisfactory, restore the backup made during the import:
Last updated
Was this helpful?

