CDR Module GraphQL APIs

This wiki is to capture the CDR module provided GraphQL APIs.

 

Please find below list of APIs supported by CDR module.

CDR module APIs are useful to fetch cdr values

Fetch All CDR's data

API Name :  fetchAllCdrs

API Parameters: 

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

first

Optional

Int

 

First value is the no of records (Limit value)

after

Optional

Int

 

After value is the page number (Offset value)

orderby

Optional

Enum

 

The final known disposition of the CDR record. Orders can be changed by duration or date

startDate

Optional

String

 

The start date is the date from where the data needs to be fetched. Format is "YYYY-MM-DD"

endDate

Optional

String

 

The end date is the date till where the data needs to be fetched. Format is "YYYY-MM-DD"

Example for first and after values

  • if first is 10 records and after is 0 it will fetch from 0-10.

  • if first is 10 records and after is 10 it will fetch from 11-20

  • if first is 10 records and after is 20 it will fetch from 21-30

API Parameters to query

Query Parameters 

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

 

 

API Request 

GQLAPI: /admin/api/api/gql     query{   fetchAllCdrs (     first : 4     after : 1     orderby : duration     startDate: "2021-08-23"     endDate: "2021-11-23"   )   {     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   } }

API Response 

{     "data": {         "fetchAllCdrs": {             "cdrs": [                 {                     "id": "Y2RyOjE2MjI4NDsd2EyOTguMTI=",                     "uniqueid": "1622832341298.12",                     "calldate": "2021-06-04 21:14:58",                     "timestamp": 3232323,                     "clid": "\"Lorem Ipsum\" <1256565233191>",                     "src": "324",                     "dst": "s",                     "dcontext": "from-pstn",                     "channel": "SIP/fpbx-1-2cSnGYdfsAnRDnB-0000000c",                     "dstchannel": "",                     "lastapp": "Playback",                     "lastdata": "ss-noservice",                     "duration": 6,                     "billsec": 6,                     "disposition": "",                     "accountcode": "",                     "userfield": "",                     "did": "",                     "recordingfile": "",                     "cnum": "",                     "outbound_cnum": "",                     "outbound_cnam": "",                     "dst_cnam": "",                     "linkedid": "1622832341298.12",                     "peeraccount": "",                     "sequence": "12",                     "amaflags": "DOCUMENTATION"                 },                 {                     "id": "Y2RyOjE2MjI4ddNDE0MDIuMTM=",                     "uniqueid": "162283341402.13",                     "calldate": "2021-06-04 21:16:42",                     "timestamp": 16228413402,                     "clid": "\"57581037094\" <157581307094>",                     "src": "15758107094",                     "dst": "s",                     "dcontext": "from-pstn",                     "channel": "SIP/fpbx-1-2cSednGYAnRDnB-0000000d",                     "dstchannel": "",                     "lastapp": "Playback",                     "lastdata": "ss-noservice",                     "duration": 6,                     "billsec": 6,                     "disposition": "",                     "accountcode": "",                     "userfield": "",                     "did": "",                     "recordingfile": "",                     "cnum": "",                     "outbound_cnum": "",                     "outbound_cnam": "",                     "dst_cnam": "",                     "linkedid": "162283341402.13",                     "peeraccount": "",                     "sequence": "13",                     "amaflags": "DOCUMENTATION"                 }             ],             "totalCount": 39,             "status": true,             "message": "CDR data found successfully"         }     } }

Fetch CDR record

API Parameters: 

Name

Required

Type

Default

Description

Name

Required

Type

Default

Description

id

Mandatory

Id

 

ID of the record

API Parameters to query

Query Parameters 

 

 

API Request 

API Response 

Return to Documentation Home I Return to Sangoma Support