[SOLVED] - Attach call recording to email - Unable to retrieve Destination and Disposition variables

Hi All,
I’m trying to use FreePBX to record all inbound calls and attach them in a mail at the end with some call details.
It has a simple configuration. I have 5 Misc Destinations (ext mobile number) that are called depending from the caller choise. Everything works fine, but I’m not able to find the Destination (Misc Destination) and the Disposition (ANSWERED, BUSY and so on) variables even if I can see them in Call Detail Record (see below screenshot)


The other variable used are the following (they work properly):
^{YEAR}, ^{MONTH}, ^{DAY}, ^{TIMESTR}, ^{FROMEXTEN}, ^{CALLFILENAME}.^{MIXMON_FORMAT}, ^{ARG3}

FreePBX 15.0.16
Asterisk 16.4.0

Thank you in advance,
Gianluca

You can use ^{UNIQUEID} to look up the fields in the MySQL table asteriskcdrdb.cdr

Hi Dicko,
I tried your suggestion using the uniqueid to retrieve data from db. I can see the number called under “dst” column but sadly if I try to use it as a parameter the script is unable to get data (empty variable).
I double checked both lower and uppercase but with no luck. Below the screenshot (divided in two pieces) of record got from db (dst is the number starting with 335):

Hope it helps,
Regards,
Gianluca

Please post the script you wrote, but basically you need ao add the ^{UNIQUEID} as parameter ‘n’ and if using bash, inside the script use something like :-

DST=$(mysql asteriskcdrdb -e "SELECT dst FROM cdr WHERE uniqueid = '$n' " ORDER BY calldate desc LIMIT 1)
echo $DST

Hello Dicko,
finally I was able to get destination record (I had to add -NB flags before -e to remove heading and ascii art).
Thank you for your support, I really appreciate it!

Regards,
Gianluca

1 Like

Oops, I missed that, sorry.

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