Randomly Recording Calls

Hi Guys,

Once again, I turn to the Digium Community for assistance. Google has returned little aid.

I’m always looking for ways to improve the callcenter that I work in. We want to setup some QA, and randomly record the calls.

I haven’t found any detailed documents on MixMonitor or Monitor cmd, that gives me a list of all the options that are available for these commands. My question to the community…

Has anyone or does anyone know how to set asterisk to randomly record/monitor an inbound call? I’m looking for something that can be inserted into the dialplan or something of that nature.

I look forward to any assistance. Thanks!

Hi

It would be far simpler to record all calls and have a script running to “randomly” delete some.

Ian

Hi,

I was thinking about something like this.
One problem I’m seeing, maybe I’m doing it wrong…

When using the Monitor cmd, it seems to fill up the system ram every few days.

Here’s my dialplan:

[incoming]
exten => s,1,Playback(/home/Sounds/def-greeting)
exten => s,2,Set(CALLERID(name)=Sales)
exten => s,3,Monitor(wav,Sales-${UNIQUEID},m)
exten => s,4,ResetCDR()
exten => s,5,Queue(CSR1)
exten => s,6,StopMonitor

Maybe I’m doing something wrong?

I have not used this, but it looks like what you are looking for.

voip-info.org/wiki/index.php … cmd+Random

Example

; Monitors a call 10% of the time exten => s,1,Random(90:s,3) exten => s,2,Monitor(gsm,/var/spool/asterisk/monitor/${EXTEN}-${TIMESTAMP},m) exten => s,3,Dial(SIP/8000)

davevg, you got me all excited. It seems Random was deprecated in Asterisk 1.4.

It says.

So I’ll give that a try and let everyone know the outcome. If we can build some good search terms here, at least I might be able to help someone else down the road.

[code]asterisk*CLI> show version
Asterisk SVN-branch-1.4-r69991 built by root @ asterisk on a i686 running Linux on 2007-06-19 17:04:12 UTC

asteriskCLI> core show application Random
asterisk
CLI>
-= Info about application ‘Random’ =-

[Synopsis]
Conditionally branches, based upon a probability

[Description]
Random([probability]:[[context|]extension|]priority)
probability := INTEGER in the range 1 to 100
DEPRECATED: Use GotoIf($[${RAND(1,100)} > ]?)

[/code]
The command is still there for 1.4, but you are right, you should probably use the new way for forward compatibility.

Yea, for some silly reason the Random cmd didn’t work on my version.
The mentioned method above worked just fine.

Once again Digium Forums come through for me! :smile:
Thanks Everyone!

Okay here’s the next part of this QA problem. Yes Calls are recorded randomly, that works great.

To make things easier for my QA Department, I want the recorded quality file to have the SIP extension that answered the call within the filename. Here’s my current dialplan:

[quote]exten => 1,1,Set(CALLERID(name)=Sales)
exten => 1,2,Playback(/home/Sounds/greeting)
exten => 1,3,GotoIf($[${RAND(0,99)} + 50 >= 100]?1|6)
exten => 1,4,Set(CALLFILENAME=Bob-${UNIQUEID})
exten => 1,5,Monitor(wav,${CALLFILENAME},m)
exten => 1,6,ResetCDR()
exten => 1,7,Queue(CSR1)
[/quote]

I’m not sure what you want is possible from within the 1.4 dialplan. Because the * dialplan does not know which agent it is going to send the call to until the queue application determines where to send the call based on its rules.

Probably the best bet would be to write something to go through the queue_log file and rename the files after the fact. Below should get the data you need to do the renaming. You can probably tweak the awk command to do the renames for you.

grep 'COMPLETE' /var/log/asterisk/queue_log|awk -F"|" '{print $2" "$4}'

Thanks for all the suggestions and assistance.

I’m finding one problem with the “Monitor” cmd, and hoping maybe I can get some help with that as well…

When using the monitor cmd, the ram is quickly filled up. The files are written to /var/spool/asterisk/monitor like normal. But 2GB of ram is used up rather quickly. Rebooting clears it up, and if I have the monitoring/recording turned off, it doesn’t fill up.

I assume if the dialplan has the call going into a queue after the monitor, then it would make no sense to use “StopMonitor” cmd.

[quote]exten => 1,1,Set(CALLERID(name)=Sales)
exten => 1,2,Playback(/home/Sounds/greeting)
exten => 1,3,GotoIf($[${RAND(0,99)} + 50 >= 100]?1|6)
exten => 1,4,Set(CALLFILENAME=${UNIQUEID})
exten => 1,5,Monitor(wav,${CALLFILENAME},m)
exten => 1,6,ResetCDR()
exten => 1,7,Queue(CSR1) [/quote]