cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
686
Views
0
Helpful
1
Replies

Unable to get CDR. information for Webex calling from Service App.

Translator
Community Manager
Community Manager

I will ask you a question.
I want to get the CDR. information of Webex calling from the service app using the API, but it doesn't work.
In order to find out the cause, I tried it from the Webex for Developers site with administrator rights, this is working.

Site
https://developer.webex.com/docs/api/v1/webex-calling-detailed-call-history/get-detailed-call-history
startTime:2023-07-13T00:00:00.000Z
endTime :2023-07-13T10:00:00.000Z
locations: None
max: None

Results
{
"items": [
{
"Answer time": "2023-07-13T04:45:27.508Z",
"Answered": "true",
"Direction": "ORIGINATING",
"Called line ID": "xxxxxxxxxxxxxxx",
"Call ID": "xxxxxxx",
"Calling line ID": "NA",
"Start time": "2023-07-13T04:45:25.563Z",
"Call type": "SIP_ENTERPRISE",
 :

In addition, if you use the URL and access token generated by the Developers site from Python, it will work correctly.

url ='https://analytics.webexapis.com/v1/cdr_feed?startTime=2023-07-13T00%3A00%3A00.000Z&endTime=2023-07-13T10%3A00%3A00.000Z'
header = {}
header['Authorization'] = f'Bearer {Copy token from Developers site}'
res = requests.get(url, headers=header, verify=False)

However, when you try with Service App, the results are different as follows. It looks like you don't have permission.

url ='https://analytics.webexapis.com/v1/cdr_feed?startTime=2023-07-13T00%3A00%3A00.000Z&endTime=2023-07-13T10%3A00%3A00.000Z'
header = {}
header['Authorization'] = f'Bearer {token generated by service app}'
res = requests.get(url, headers=header, verify=False)

Error message
status:401
'{"message":"User does not have authorized roles.","errors":[{"errorCode":401}],
 "trackingId":"CdrReports_1f388d57-f1bd-4eaa-a8e5-f992588xxxxxx"}'

Service App grants the following scope. The User list can be obtained with the same access token.
※We believe that spark-admin:calling_cdr_read is sufficient.

 scopes:
  * spark-admin:calling_cdr_read
  * spark-admin:people_read
  * spark-admin:telephony_config_read
  * spark-admin:telephony_config_write
  * spark:kms

Below is the URL to get the list of users. This works.
url = 'https://webexapis.com/v1/people'
header = {}
header['Authorization'] = f'Bearer {token generated by service app}'
res = requests.get(url, headers=header, verify=False)

What are the possible causes? Thank you for your advice.

1 Reply 1

TDoan
Level 1
Level 1

Hi Kozaka,

You need to check the following steps.

1) In Administrator Roles section, the "Webex Calling Detailed Call History API access" option is enabled.

TDoan_0-1692242947506.png

 

2) In Licenses section, Calling - Webex Calling is enabled.

TDoan_1-1692243062560.png

Hope it would help you.

Regards

TDoan