• Welcome to SAIL Community Supported PBX . Please login or sign up.
 

Call Recording & Conference Rooms

Started by Del, April 11, 2020, 09:33:07 PM

Previous topic - Next topic

Del

I've been playing with some of the new V6 features in particular the recordings retrieval/playback (which is brilliant).
Just thought I'd post some findings that may help other users and a few questions along the way.

I couldn't get internal calls to show up and I thought maybe they weren't being recorded anymore, then after some digging I realised they were recorded but had been left out the add call portion in the recording class PHP (intended I assume)
Have very basic knowledge with coding but I added the following to catch any files with the to/from portion both being less than 4:

else if ((strlen($file_list[1+$this->offset]) <= 4) && (strlen($file_list[2+$this->offset]) <= 4))

Then added the relevant table for internal calls and then the calls showed up in the retrieval and playback.

Next I thought it would be cool if I could have the conference room calls show up in the retrieval too, I hit a few snags on this.

First thing I noticed (slightly off topic) is when I tested the conference room, the user entering/leaving sound was Alison American voice even though I have the country set to GB and the en-gb sounds installed, when I watched the Asterisk console I noted the following:


Playing 'conf-hasjoin.gsm' (language 'en')
Playing 'confbridge-leave.gsm' (language 'en')
Playing 'conf-hasleft.gsm' (language 'en')


These all had language 'en' where as everything else that was working correctly had 'en-gb' I wasn't sure how to fix this so I just copied those 3 files from the gb sounds and overwrote them in the Alison sounds, it then worked as required.
I don't know if this is a bug or whether my install just got messed up somehow?

So with that out the way I uncommented "record_conference=yes" in the confbridge, which I believe is the correct way to turn on recording for the conference rooms? (it did work)
The conference recordings started popping up in the monitor folder, but then I realised that these aren't processed/moved to the monout folder by the selmix script like the regular calls are.
To get around this I setup a script to rename and move them into the monout folder so the offload script would move them along with the other recordings:

#!/bin/bash

for file in /var/spool/asterisk/monitor/confbridge*; do
    bn=$(basename $file)
    checkifempty=${#bn}
    if [[ "$checkifempty" = 1 ]]; then exit
fi

IFS='-|\.' read var1 var2 var3 var4 <<< "$bn"

newfile="$var3-default-$var2-$var2.$var4"

mv $file /var/spool/asterisk/monout/$newfile

done
exit


This basically moved the portion of the file name around so it could be inline with the format of the other recordings:
confbridge-100-1586602936.wav
would be come
1586602936-default-100-100.wav
I added the default tenant to pass the recordings result file check and added the extra conference room number so I could match a rule when searching.

So with the conference files in a useable format matching the others I added the following into the recording class file
else if (strcmp($file_list[1+$this->offset], $file_list[2+$this->offset]) == 0)

This checks the to and from portion of the recording file name to see if they are the same, since I renamed the conference recording files to have the room number in both the to and from portion they should be the only files that ever match this rule (I couldn't think of any other circumstances)
I added the relevant table, and then conference calls now show for retreival and playback too (finished output screenshot attached)

Issues with the above from what I can see:
1. Due to me forcing default into the filename it makes the solution only for single tenant, which leads me to a quick question, is multiple tenant implemented on conferences? I couldn't see an option.
2. The script for moving the conference recordings from monitor to monout has to be run when the system isn't active because the conference file is in the monitor folder before the conference is finished so could potentially be moved before complete (I've set it to run in a cron job at 1am)

The workaround to both in an ideal situation would be the conferences given over to selmix and be processed and moved like the regular recordings and then just comment out the lines in recording class file if you don't want them to show in the retreival.
Also some sort of multi tenant could be added on the conference section of the gui to have that picked up/added in the recording name and maybe a little record yes/no option for each conference room on the gui could be cool (if conferences can have individual options like that in Asterisk)

I don't know if any of that is possible, I'm pretty limited with my knowledge and I may be misunderstanding how everything works and the limitations from what can be done within the SARK interface. Looking to learn and play with it more now.

Sorry for the long post, hopefully no one comes along and tells me there's a toggle option somewhere in the web GUI for all of this!  ;D








sysadmin

April 17, 2020, 09:06:34 PM #1 Last Edit: April 18, 2020, 10:18:28 AM by sysadmin
wow!  You did a lot of work. 

OK, let's see.   Which release of 6 are you running?  I wasn't aware of issues with internal calls not showing up.  I'm assuming you are talking about the recordings browser component, not the underlying data.  Yes?

In terms of conference rooms and call recording, we took a slightly different path to you.  To be fair, it's quite rare we get asked for conference recording so it hasn't been a high priority but here's how we do it when asked.  We use a custom app and we record the conferences to a different directory to the regular recordings.  This makes it somewhat easier to deal with them when it comes to offloading to the final recordings directory which in our customer base is usually some kind of LAN addressed storage.

Bear in mind, customers don't always want recording to be turned on for a particular conference room so we wanted to give them the choice.   So, what we did was to come up with a conference room prefix which the customer could dial to start a conference with call recording enabled.  Here's an example from a customer who has 6 conference rooms; 2894, 2895, 2896, 2897, 2898 and 2899.   What we have is an app which uses a prefix (in this case 2) to invoke the conference with recording enabled, e.g. 22894, 22895 and so on. Here it is


exten=>_2289[4-9],1,SET(CONFBRIDGE(bridge,record_conference)=yes)
exten=>_2289[4-9],n,SET(CONFBRIDGE(bridge,record_file)=/var/spool/asterisk/confrecordings/${STRFTIME(${EPOCH},,%s)}-confcall-${CALLERID(num)}-${EXTEN:1}.wav)
exten=>_2289[4-9],n,ConfBridge(${EXTEN:1},,sark_hosted_user)
exten=>_2289[4-9],n,HangUp


You can see we invoke the bridge with record_conference=yes which is enough to get call recording done.  However, we also point the recording at a new folder in /var/spool/asterisk called confrecordings and give the file a name the recording browser software will understand.   And that's it for the invocation.  As it turns out, as long as at least one conference attendee uses the prefix, then call recording will work as advertised.

So, now we have a bunch of recordings in our new folder confrecordings.  To deal with them we use a new cron mover to ship them off to the final recordings directory.   You can run it as often as you like but we tend to run it once an hour.  Here is how it looks


#!/bin/bash
logger "checking share..."
if ! mount | grep "on /mnt/callrecordings" > /dev/null; then
        logger "share not mounted - Mounting share at /mnt/callrecordings"
        mount -t cifs //some.share/callrecordings -o username=xxxx,password=xxxxx /mnt/callrecordings
        if ! mount | grep "on /mnt/callrecordings" > /dev/null; then
                logger "offload_recordings couldn't mount share - ending"
                exit 8
        fi
fi
# check if there are any files to move...
if find /var/spool/asterisk/confrecordings -maxdepth 0 -empty | read v; then
        logger "no recordings to copy - ending"
        exit 4
fi

#OK, move what we have
logger "beginning conf recordings rsync"
rsync --remove-source-files -a /var/spool/asterisk/confrecordings/* /mnt/callrecordings/`date +%F`/
logger "conf recordings rsync done"
exit 0


As you can see, we just move the file(s) as-is. They look like this, which is compatible with regular recording filenames.


xxxxxx6795-confcall-2238-2894-xxxxxx6805.wav


Now, as you've guessed, it doesn't work very well with tenants, but we are looking at that in V7.  Finally, rsync won't move files that are busy so you can run this as often as you like.

The main benefit I see for this is that it is a bolt-on which shouldn't require any changes to the SARK code itself.

Del

Quote from: sysadmin on April 17, 2020, 09:06:34 PM
OK, let's see.   Which release of 6 are you running?  I wasn't aware of issues with internal calls not showing up.  I'm assuming you are talking about the recordings browser component, not the underlying data.  Yes?

It shows as running 6.0.1-52.

Yes the internal calls are all recorded fine and they are searched and found fine, it's just the recording class PHP file (sark/www/origrecs/lib/Recording.class.php ) didn't have anything in it that would match those calls to be shown in a table on the browser, so they don't actually show up in the list to playback. I had to add the line from my first post along with table data in the PHP file to get Internal calls to show up when searched.


For conference recording I ended up (since my post) adding the following to the "sark_customer_extensions_globals.conf" (perhaps incorrect way to do this now reading your post) so I could eliminate the need to rename the files when moving them.


[conferences]
exten => 101,1,NoOp(conference 101)
same => n,Answer(500)
same => n,Authenticate(1234)
same => n,Set(Confbridge(bridge,record_file)=/var/spool/asterisk/confbridge/${STRFTIME(${EPOCH},,%s)}default-${EXTEN}-${EXTEN}.wav)
same => n,Set(Confbridge(bridge,record_file_timestamp)=no);
same => n,ConfBridge(${EXTEN},,sark_hosted_user)
same => n,Hangup()


To give me the format I needed and I added the "record_file_timestamp=no" because it seemed Asterisk added the time to the end of each file which I didn't want in my formatting. My files end up like this:

xxxxxx6795-default-101-101.wav

Only reason I went for this is I wanted it to look exactly like the other recordings so I didn't need to add much the the PHP file to get this to be matched up and shown in a table and because I've forced the conference room number as both the in and outgoing ID I can use that to match it with the line from my first post. I manually added the tenant name so potentially the recording could just be shown to the Tenant searching the recordings from the browser (I haven't looked at this yet but it looks like the recordings can be password protected with tenant as users)


Quote from: sysadmin on April 17, 2020, 09:06:34 PMIn terms of conference rooms and call recording, we took a slightly different path to you. 

Bear in mind, customers don't always want recording to be turned on for a particular conference room so we wanted to give them the choice.   What we have is an app which uses a prefix (in this case 2) to invoke the conference with recording enabled


I never thought about this and I've never touched custom apps before. I like this approach better and going to have a play when I get chance to see if I can get this working, thanks for the tip/code.

Quote from: sysadmin on April 17, 2020, 09:06:34 PM
Finally, rsync won't move files that are busy so you can run this as often as you like.

This was the missing piece, thanks for that, I'll try rsync so I don't have to wait to run the cron job.

Were you able to reproduce the GB sounds not working (playing Alison US) on a new member entering/leaving?