Ask caller to approve Call Recordiing

I want to activate call recording but give the caller the option to disable it. So an IVR plays "“this call may be recorded for quality assurance, if you wish it wont be recorded, please press 1” and then … and do i have to create the same IVR for each extension even if all do the same, just EXTEN differs?

u must create 3 IVR

  1. first IVR :if you wish it wont be recorded, please press 1

    1.1 main IVR with Call recording .make that in queue or extensions or … option with “Call recording= Force”

    1.2 main ivr without Call recording.make that in queue or extensions or … option with “Call recording= Never”

and that for each extension?

no.usually do not use extension in ivr.
u must do it for each entry of ivr

u can add that extension in a ring group an use in ivr

We dont use ring groups. We have a trunk and point each extension number to the extension

012345678-30 -> exten 30
012345678-31 -> exten 31
012345678-32 -> exten 32

If i point the IVR to a ring group, all phones would ring, right? So there is no solution which would offer one IVR to use for all of them?

012345678-30 -.         ,- exten 30
012345678-31 -- [ IVR ] -- exten 31
012345678-32 -´         `- exten 32

i mean create a ring group with 1 extension and use it in the ivr

What is the benefit of using a ring group instead of using the extension directly?

I dont want to let all phones ring. If somebody wants to call xxx30, they should be asked for permissing and then goes straight to extension 30. If they call xxx31, the same applies and they go to exten 31.

So I guess there is no way to do it without one IVR for each extension?

I did this Trixbox about 10 years ago. I’ll dig around for the code and update it. What version of asterisk do you use? I’ll update it.

If you are willing to write custom code in a context that you execute before the IVR (to set the extension), you should be able to redirect all of your calls based on the last two digits of the Inbound Number. In fact, you may be able to do it after the IVR by looking at the DID (which you should still have in scope) and redirect from there.

We’ve talked about redirecting calls based on parts of the DID many times before (one guy had something crazy like 10,000 DIDs) and used a database (IIRC) to do it. It was still custom code, but it can be done.

Here you go!
This a demo, so I just used a default recording that says “this call may be monitored”. You can easily replace this with one that makes more sense. “Press 1 to permit us to record this call, any other key to decline”

Pressing 1 will FORCE recording of the calls. Any other key, or if they press nothing after a couple of asks it will automatically set the recording to “NO”

This works for all calls marked as external. Internal calls I’ve bypassed it asking the question and set it to ‘dontcare’. If you want internal extension to extension calls record, change ‘dontcare’ to ‘force’

ASSUMPTION
You’ve set all call recording options in FreePBX to "DONT CARE"
Thats how i tested it. In FreePBX Distro 10.13.66

INSTALLATION
Don’t test this in production environment…etc yadda bla…butt covering.

Open up extension_additional.conf and look for the context
[sub-record-check]

Copy that entire section (its probably about 100 lines) and ends with
;–== end of [sub-record-check] ==–;

Paste that into extensions_override_freepbx.conf

Find these two lines about 12 or so lines down.

exten => recordcheck,1,Noop(Starting recording check against ${ARG1})
exten => recordcheck,n,Goto(${ARG1})

INSERT these 4 lines in between the above two lines.

exten => recordcheck,n,GotoIf($["${CALLTYPE}" = “internal”]?dontcare)
exten => recordcheck,n,ExecIf($["${CALLTYPE}" = “external”]?Read(FOOrecord,this-call-may-be-monitored-or-recorded,1,2,3))
exten => recordcheck,n,ExecIf($["${CALLTYPE}" = “external” | “${FOOrecord}” = “” ]?Set(ARG1=no)
exten => recordcheck,n,ExecIf($["${CALLTYPE}" = “external” | “${FOOrecord}” = “1” ]?Set(ARG1=force)

Save your changes
Reload the config
Make a test call.

CODE EXPLAINED:

Check to see if its an internal extension to extension call, we bypass it asking for permission to record and ring the phone.
exten => recordcheck,n,GotoIf($["${CALLTYPE}" = “internal”]?dontcare)

If this is an external call, we prompt the caller if they permit us to record the call. the syntax is:
READ(DTMFvariable, soundfile, max number of digits, number of times it will ask, how long it will wait for an answer
exten => recordcheck,n,ExecIf($["${CALLTYPE}" = “external”]?Read(FOOrecord,this-call-may-be-monitored-or-recorded,1,2,3))

If the caller doesn’t respond with any input, then we assume “no” and continue the call.
exten => recordcheck,n,ExecIf($["${CALLTYPE}" = “external” | “${FOOrecord}” = “” ]?Set(ARG1=no)

If the callers presses 1, then we set the call recording to on and ring the extension
exten => recordcheck,n,ExecIf($["${CALLTYPE}" = “external” | “${FOOrecord}” = “1” ]?Set(ARG1=force)

As always, using the override file is discouraged as there is always the possibility that future updates will be incompatible with your changes. Only for advanced users.

AH yes. absolutely. This change is advanced…but i’m not sure how i’d snake this kind of adjustment into the FreePBX code.
Tips?

Not an easy thing to do elegantly, but if it was me, I would send all trunk calls to a context specifically for the purpose of setting call recording, then proceeding onto the from-trunk context to use the inbound routes as set.

Hi Igaetz, could you explain how to setup a custom context and route it through call recording settings? I am not used to use custom context and didn’t even played around with call recordings yet.

Here is a post explaining how to run your own dialplan on an inbound call:

Right now all my trunks have an incoming setting context=from-trunk. So I would set the custom context for all related trunks and then at the end of the context, send all calls to from-trunk for further processing as before? It’s that easy?

Yep, that’s all there is to it.

1 Like