Need to capture some specific info in CDR database

I can access the CDR database using Admirer and it works well. I’m trying to use FreePBX to capture information that the caller types into the phone dial pad after the call is answered. Here’s the call logic:

User calls in to a specific phone number, they enter in an employee ID number (There are hundreds), after they enter their employee ID it shoots the call over to a DISA. They then dial another phone number.

I need to be able to pull this data from the database:
The number they called in from
The time they called in
The employee ID they typed in
The number they dialed after reaching the DISA.

In order to get the call logic to work I used a IVR on the inbound route. I then enabled direct dialing expecting the employee ID to never match an actual extension. If it doesn’t match an extension it gets routed to the DISA.

I’ve been able to pull all the data I need from the CDR database EXCEPT for the employee ID they typed in. That doesn’t seem to be recorded in the database anywhere.

Is there a better way to achieve the same result? Where in FreePBX can I set up a call route so the user has to first dial a number (that doesn’t match anything in the system), that number is recorded and then the call get’s sent to a DISA?

If you are not using them for something else,you can write the variable (read digits) to the CDR Usrfield:

or Account Code:

Both of these fields show up on the FreePBX CDR GUI and the underlying table.

Yeah I saw those columns in the table and no, we don’t use either. Where in the FreePBX gui do I route the call so I can use either of those options?

Writing variables and routing on them would need to be done via custom dialplan. You could link the custom dialplan to your GUI via the Custom Destinations module, once you have written it.

Any chance you could help me write the custom dial plan in a way that would capture what was input by the caller and populate one of those fields? I don’t care if its account code or usrfield. I’m not experienced in custom dial plans.

Unfortunately I do not have the time, but several members here are capable and may help you. If you are looking for something more “concrete” Sangoma can be engaged for custom development.

Lastly, I would say that this is quickly learnable if you’re interested. The Asterisk Book was a quick way to learn and gain proficiency with Asterisk. It really opened a lot of doors as far as what is possible (basically anything).

You are not doing anything to capture the digits. You are using the invalid destination of the ivr to route the call, it sounds like.

Yes I know. comtech helped me understand this earlier in the thread. Now I’m just trying to figure out how to use a custom dial plan to capture the digits into the usrfield so I can pull it out of the cdr database. Struggling with this.

Use read to collect the digits.

Examples are on the page.

Once you have the read variable, write the data to the CDR user field or account code.

I paid Sangoma and Lorne the man wrote a custom dial plan that does exactly what I needed it to do!


Care to let Sangoma share said dialplan?

Inbound call goes to a custom destination first:

Here is the custom dial plan being referenced in “Target”:

; Prompt caller for TRM number and store in CDR userfield
; created by lgaetz 2019-08-19
; Usage: Custom Destination with goto line set to get-user-input,s,1
;        Enable return destination and send caller to next destination

exten => s,1,Noop(Entering user defined context [get-user-input] in extensions_custom.conf)
;exten => s,n,Read(CDR(userfield),please-enter-your&letters/t&letters/r&letters/m&number&then-press-pound,,,,)
 exten => s,n,Read(CDR(userfield),custom/TRM_No_and_then_Dial_Tone_for_District_Contact,,,,)
exten => s,n,Return

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.