Recording custom context question

Hi, thanks everyone for your time, I need to create a custom context which will record the calls of the other context would be something like sub-record-check context, I need this context to be executed in all the context that pbx has, where I can Get an example?

for example
out call
in call
internal calls

This is built in, what doesn’t work for you?

Hello, thank you for your time, I am in charge of communications and networks of a financial company, we had an Avaya Central and changed it to Freepbx like 300 Stations, my security department is requesting some changes in the recording module of calls and I need to make those changes due to my security department, if I do not have to have to remove Freepbx and buy another solution of telephony

My security department is demanding a number of changes and information for this I need a custom context.

You have determined the solution without sharing what problem you are trying to solve. I would be very surprised if what you need to do actually requires a custom context, and if it does, you need to be much more specific about what you are trying to do for anyone to assist.

This sounds very much like your security people want you to go back to Avaya.

What particular problems (you don’t need to give us proprietary information, just the highlights) are they saying the system needs to solve.

The community is generally willing to help, and Sangoma is very good about improving the FreePBX product when real problems are identified. At this point, it sounds like your security people are driving the bus, but don’t really know where the wheel is. Help us help you. If there are real security concerns in the way that call recording is done, it will benefit the entire community to fix them.

One of the most advantageous things of freepbx or asterisk is to be able to make a custom dialplan which allows you to add or remove context information.

My security department has some requirements such as:

1 - Modify the name of the file that is a unique id.
2 - Save all records in a proprietary database like mysql / sql / oracle.
3 - Change the recording path.

The idea is that this information will be sent using an url agi and will be captured and verified by the security department.

  1. Recordings have a unique filename already
  2. This is a terrible idea. Using a database for binary storage in the words of prince “is why doves cry”
  3. This is in advanced settings

I know but in the database whe only save the path on the file on the X Server, for a later consult ot the file by the Security Department

mysql> select * from asteriskcdrdb.cdr LIMIT 1 OFFSET 9\G
*************************** 1. row ***************************
     calldate: 2017-08-03 08:59:05
         clid: "One Thousand PJSIP" <1000>
          src: 1000
          dst: REDACTED
     dcontext: REDACTED
      channel: PJSIP/1000-00000006
   dstchannel: REDACTED
      lastapp: Dial
     lastdata: REDACTED
     duration: 25
      billsec: 15
  disposition: ANSWERED
     amaflags: 3
     uniqueid: 1501775945.12
recordingfile: out-REDACTED-1000-20170803-085905-1501775945.12.wav
         cnum: 1000
         cnam: One Thousand PJSIP
outbound_cnum: 1000
outbound_cnam: One Thousand PJSIP
1 row in set (0.00 sec)

That is all stored in a database already

If I was forced to do this I would set a hangup handler for every call (easier said than done) then do everything you need in the HH. Inbound calls and outbound calls are easy, the trick are local calls and probably a dozen edge cases I’m not seeing right now.

Yes, I understand that perfectly, but security wants a separate database of the pbx and that they have the control, I would really be very helpful if they indicate how I can do what I ask in the first post and so I can continue to enjoy Freepbx and its benefits, of course if possible, otherwise I will have to keep asking in the forums.

Thank you!

ok, thanks for you information

You are asking for what is there already

My car has headlights how can I add headlights
I would love to keep driving my car with headlights but to do so I need headlights

1 Like

All the recordings have an embedded unique id
All recordings are saved to the ASTSPOOLDIR as defined in /etc/asterisk/asterisk.conf, you can change that in the advanced settings and it could be any remote mount that your bus driver accepts and you have implemented (you should probably enable cacheing also if you can’t guarantee the robustness of that mountpoint)
you can do anything you want in the “post recording script” as defined in advanced settings (you might need to enable the readonly settings there) blobbing them up and putting them there is as easy as you or your bus driver is competent in :slight_smile:

1 Like

Hi, I show the whole module to the security department but they still want to control many things they want something more extensive and complete, to indicate that they could make a custom context and use an agi and that with this we could do what they needed without needing Search other pbx solutions, Boys, Thanks for your time, I’ll keep looking on the net, and if I get a solution I’ll tell you

If you won’t actually define exactly what you want, We can’t actually belp you.

for example!

1 - Get Uniqueid of Call.
2 - Get Src Channel.
3 - Get Dst Channel.
4 - Call Day
5 - Call Month
6 - Call Year
7 - Call Context
8 - Call Macro Context
9 - Call Src
10 - Call Dst
11 - Record call on all pbx context.
12 - Filename
13 - File Path
14 - Set custom file name
15 - Set custom file path

Insert the information in to database using an agi url

this my context
exten => s,1,NoOp(Recording Call)
exten => s,n,Set(SRCCHANNEL=${CDR(channel)})
exten => s,n,Set(DSTCHANNEL=${CDR(dstchannel)})
exten => s,n,Set(ACCOUNT=${CDR(accountcode)})
exten => s,n,Set(SYSNAME=${SYSTEMNAME})
exten => s,n,Set(DATETIME=${STRFTIME(${EPOCH},%Y-%m-%d %H:%M:%S)})
exten => s,n,Set(FDIR=${STRFTIME(${EPOCH},%Y%m%d)})
exten => s,n,Set(ENABLE1=${CALLERID(num)})
exten => s,n,Set(ENABLE2=${MACRO_EXTEN})
exten => s,n,Set(getuid=${UNIQUEID})
exten => s,n,Set(context=${CONTEXT})
exten => s,n,Set(mcontext=${MACRO_CONTEXT})
exten => s,n,Agi(agi://
exten => s,n,MacroExit()

when the agi is execute the php connect to database mysql insert the information and find the recording extension for look if is enable for recording then the agi return a custom file name and path, this is working fin but i need to execute on all pbx context for get the information

he LITERALLY want cdr. But for some reason he wants to do CDR without using CDR

you can create as many cdr backends with as many columns as you want and disable any backends you find objectionable

That should cover 1-6,9 and 10


Should cover a lot more

noop(${VARIABL}) for anything missing
12-15 by setting AMPSPOOLDIR or setting “Override Call Recording Location” in Advanced Settings, and writing a “post recording script”

For 11, recording all calls can be done at the extension level also conferences,queues and ringgroups.