loripino21
(Loripino21)
January 17, 2025, 12:48pm
1
Hi,
I am trying to fetch CDR Reports from APIs. I am interested in fetching recordings of calls.
I tried the following query from the Explorer:
{
fetchAllCdr(first: 10, startDate: “2022-1-1”, endDate: “2026-1-1”{
edges {
node {
id
timestamp
}
}
}
}
but this yields null as edges - and it’s wrong because i have many calls.
Removing the startDate/endDate leads to Internal Server Error.
Can someone help me?
EDIT: by including “message” in the query, I was able to understand that I was using the wrong format.
Now, edges is anyway null, and cdr fields reports only few calls.
kgupta
(Kapil Gupta)
January 17, 2025, 12:54pm
2
Is this Freepbx 17? May be you can try to execute SQL query directly in the freepbx system to confirm if it works fine or not.
SQL query in the code - cdr/Cdr.class.php at release/17.0 · FreePBX/cdr · GitHub
For internal server error, please raise Github issue.
Regards,
Kapil
kgupta:
Is this Freepbx 17?
Don’t worry. I will check it one day.
1 Like
loripino21
(Loripino21)
January 17, 2025, 2:20pm
4
Yes, FreePBX 17.
See my last edit.
And another problem is: also for those few calls returned, “recordingfile” is null.
https://sangomakb.atlassian.net/wiki/spaces/PG/pages/26083384/CDR+Module+GraphQL+APIs#Fetch-All-CDR’s-data
Looking at your query. I have some doubts.
Should be like this:
query{
fetchAllCdrs (
first : 4
after : 1
orderby : duration
startDate: "2022-1-1"
endDate: "2025-1-1"
)
{
cdrs {
id
uniqueid
calldate
timestamp
clid
src
dst
dcontext
channel
dstchannel
lastapp
lastdata
duration
billsec
disposition
accountcode
userfield
did
recordingfile
cnum
outbound_cnum
outbound_cnam
dst_cnam
linkedid
peeraccount
sequence
amaflags
}
totalCount
status
message
}
}
I tried on 16, it should be the same for 17. But maybe there is a bug on 17.
Try to set:
first : 10000
query{
fetchAllCdrs (
first : 10000
orderby : date
startDate: "2023-10-31"
endDate: "2025-01-17"
)
{
cdrs {
recordingfile
}
totalCount
status
message
}
}