Elastix Call Recording
-
Hi All,
I have recently built a new Elastix box (2.4.0) running FOP2 2.27 and I cannot get call recordings to display in the Elastix admin tab.
I can see that the call is being recorded -
127.0.0.1 -> Action: SetVar
127.0.0.1 -> Channel: SIP/7026-0000b975
127.0.0.1 -> Variable: MONITOR_EXEC
127.0.0.1 -> Value: /usr/local/fop2/recording_elastix.pl127.0.0.1 -> Action: Setvar
127.0.0.1 -> Channel: SIP/7026-0000b975
127.0.0.1 -> Variable: MONITOR_EXEC_ARGS
127.0.0.1 -> Value: 1382969176.168878127.0.0.1 -> Mix: 1
127.0.0.1 -> Action: Monitor
127.0.0.1 -> Async: 1
127.0.0.1 -> File: /var/spool/asterisk/monitor/7026_7026_140619_1382969176.168878
127.0.0.1 -> Channel: SIP/7026-0000b975
127.0.0.1 -> Format: wav
127.0.0.1 -> ActionID: 181fop2.cfg is set to call recording_elastix.pl with the following parameters
monitor_filename=/var/spool/asterisk/monitor/${ORIG_EXTENSION}${DEST_EXTENSION}%h%i%s_${UNIQUEID}
monitor_format=wav
monitor_mix=true
monitor_exec=/usr/local/fop2/recording_elastix.plI presume that recording_elastix.pl is being executed as the file reported above disappears shortly after recording has stopped.
However, i think the mysql database connection fails as I do not see any data in the fop2.fop2recordings table.
I am settings the $MYSQLPASS variable in recording_elastix.pl correctly. If I connect to the mysql server with the user fop2 , I cannot access the asteriskcdrdb database.
mysql -u fop2 -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.mysql> use asteriskcdrdb;
ERROR 1044 (42000): Access denied for user 'fop2'@'localhost' to database 'asteriskcdrdb'I cant find any reference in the setup guides to allow the fop2 access to the asteriskcdrdb database however?
-
If you use the mysql fop2 user in the script, then you must grant access to the table in mysql, something similar to this:
mysql -u root -p -e "grant all privileges on asteriskcdrdb.* to fop2@localhost identified by 'yourpassword'"
Or you can use another user like the one that is set in FreePBX in the .pl script instead of the fop2 user.. it is up to you. (Ex: grep AMPDB /etc/amportal.conf)
-
Hi,
Many thanks - I've updated that now the cdrdb table can be read.
Does the filename formatting look correct ;
-rw-r--r-- 1 asterisk asterisk 210924 Oct 28 18:24 g7027-1382984590.175456.wav
-rw-r--r-- 1 asterisk asterisk 787564 Oct 28 18:33 g7027-1382985002.175481.wavI still cannot see recorded calls via the webui/extension page logged in as the user (in above example extension 7027).
Gavin
-
I do not follow elastix development, so I do not know if their interface have changed in any way. The recording script task is to update the cdr table and set the userfield field in the table to "audio:xxxxx". The filename is not relevant. Check the cdr table and see if userfields are being populated or not on the respective entries.
-
-
The .pl script will override any manual mysql credentials with the ones set in amportal.conf or freepbx.conf files:
if(-f "/etc/amportal.conf") {
my $ampconf = parse_amportal_conf( "/etc/amportal.conf" );
$MYSQLUSER = $ampconf->{"AMPDBUSER"};
$MYSQLPASS = $ampconf->{"AMPDBPASS"};
$MYSQLHOST = $ampconf->{"AMPDBHOST"};
} elsif(-f "/etc/freepbx/freepbx.conf") {
my $ampconf = parse_amportal_conf( "/etc/freepbx/freepbx.conf" );
$MYSQLUSER = $ampconf->{"AMPDBUSER"};
$MYSQLPASS = $ampconf->{"AMPDBPASS"};
$MYSQLHOST = $ampconf->{"AMPDBHOST"};
}Try to grep for AMPDB in /etc/amportal.conf and try to connect to mysql asteriskcdrdb database with those. Does that work?
In any case, to troubleshot you should enable full debug in Asterisk itself and check the /var/log/asterisk/full log for the execution of the post monitor script. The full command, including all parameters, will be logged, something like
Executing /usr/local/fop2/recording_elastix.pl some-in.wav some-out.wav some.wav 123123123123.123
Then you can "su asterisk" in the command line and run the exact same command you see in the log wit the same parameters and see if you get an error or something. You might want to comment the unlink lines from the script so the original sound files are in place by the time you run the script by hand (otherwise the files will be removed and the script will fail for a file not found, and not because something else happened). So, look for this:
if ( -f $LEFT . "-tmp.wav" ) {
unlink $LEFT . "-tmp.wav";
}if ( -f $RIGHT . "-tmp.wav" ) {
unlink $RIGHT . "-tmp.wav";
}if ( -f $OUT ) {
unlink $LEFT;
unlink $RIGHT;
}and just prefix all the unlinks with a # symbol when doing tests.
-
Hi Nicolas,
If I run the script from the command line I get the following errors ;
$ /usr/local/fop2/recording_elastix.pl g7046-1383038562.8061-in.wav g7046-1383038562.8061-out.wav 1383038562.8061.wav
Use of uninitialized value in substitution (s///) at /usr/local/fop2/recording_elastix.pl line 173.
Use of uninitialized value in concatenation (.) or string at /usr/local/fop2/recording_elastix.pl line 202.Is the script mixing the files together, then die'ing before doing the SQL work?
Many Thanks,
-
-
Hi Nicolas,
I have tried passing this
/usr/local/fop2/recording_elastix.pl g7046-1383046959.12073-in.wav g7046-1383046959.12073-out.wav 1383046959.12073.wav 1383046959.12073
Use of uninitialized value in substitution (s///) at /usr/local/fop2/recording_elastix.pl line 173.and also
/usr/local/fop2/recording_elastix.pl g7046-1383046959.12073-in.wav g7046-1383046959.12073-out.wav 1383046959.12073.wav 1383046959
Use of uninitialized value in substitution (s///) at /usr/local/fop2/recording_elastix.pl line 173.
and also
/usr/local/fop2/recording_elastix.pl g7046-1383046959.12073-in.wav g7046-1383046959.12073-out.wav g7046-1383046959.12073.wav 1383046959
Use of uninitialized value in substitution (s///) at /usr/local/fop2/recording_elastix.pl line 173.
All giving the same error on line 173
$uniqueid =~ s/.wav//g;
-
Hmm, the Execute line is not obeying what it was told (or what you posted as AMI events received) as the monitor filename:
/var/spool/asterisk/monitor/7026_7026_140619_1382969176.168878
The monitor filename should look like that. The script will split the name and get fields for the database queries, the filename you posted on your last mail is not following that convention. So, not sure if you changed the monitor_filename entry in fop2.cfg or something else is happening down the pipe.
-
Hi Nicolas,
fop2.conf ;
; For elastix Monitoring Tab:
;monitor_filename=g${DEST_EXTENSION}-${UNIQUEID}monitor_filename=/var/spool/asterisk/monitor/${ORIG_EXTENSION}${DEST_EXTENSION}%h%i%s_${UNIQUEID}
; For fop2 recording interface
;monitor_filename=/var/spool/asterisk/monitor/${ORIG_EXTENSION}${DEST_EXTENSION}%h%i%s_${UNIQUEID}Which results in the following files being created ;
-rw-r--r-- 1 asterisk asterisk 312364 Oct 29 12:35 g7046-1383046959.12073-out.wav
-rw-r--r-- 1 asterisk asterisk 312364 Oct 29 12:35 g7046-1383046959.12073-in.wav -
Hi Gavin,
It does not make much sense, the config AND the events you posted are showing the correct format for the filname. Where is your fop2.cfg file located? Perhaps you are modifying the incorrect one .. elastix stores the file in /etc/asterisk/fop2 and the tarball install in /usr/local/fop2
The gXXX is the "old" name for Elastix, your config looks right:
monitor_filename=/var/spool/asterisk/monitor/${ORIG_EXTENSION}${DEST_EXTENSION}%h%i%s_${UNIQUEID}
there is no g at the start of the filename...
-
Hi,
Ok - there was the first problem, elastix calling the config file from /etc/asterisk/fop2 , I have moved the config files from /usr/local/fop2 into /etc/asterisk/fop2
However, now I have a problem where fop2 will start and no longer accepts connections - I will take some time to remove all the configuration and rebuild.
-
If you use Elastix that forces https, then you need either disable websockets in /var/www/html/fop2/js/presence.js OR set the ssl certificates in fop2.cfg so your browser accepts secure websocket connections.
The fop2.cfg bundled with 2.27 has commented out the lines to enable the certificates, and I think the locations of the commented files are indeed the ones used by Elastix and other Centos based distributions.
; If you access fop2 via https, browsers will try to use wss (Secure ; web sockets) and for that it requires a certificate file and key file, ; the same ones you have in your web server configuration: ; ;ssl_certificate_file=/etc/pki/tls/certs/localhost.crt ;ssl_certificate_key_file=/etc/pki/tls/private/localhost.keyBest regards,
-
Hi Nicolas,
I have fixed the problem
The issues were;
1/ Elastix FOP2 config files being in /etc/elastix/fop2 (Removed these and symlinked to /usr/local/fop2)
2/ Asterisk mysql_so not loading , fixed by uninstalling/reinstalling asterisk-add*
2a/ Incorrect line in /etc/asterisk/cdr files , modified to enable cdr logging
3/ Incorrect passwords in /etc/asterisk/mysql files - auto generated and fixed by manually changing passwordsMany thanks for all your help - finally got there and call recording is working and data is displayed in Elastix Recordings tab again.
Gavin
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login