News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Best practices for syncing calls into external system
Tags: call logs, webhooks
Dec 28, 2023 at 7:51am   •   1 replies  •  0 likes
Denis Kostromitskiy

Hey, guys.

I have just recently started working with Ringcentral platform and Ringcentral API in particular. The Developer Guide and API Reference are well written and contain a lot of helpful information.

The thing I'm missing though are some guides on how to cover specific workflows.

The task I have is to sync calls users made in Ringcentral to external CRM app.

I figured it would be good to use a webhooks for that matter.
I subscribe to Account Telephony Sessions Event for Disconnected calls only.

/restapi/v1.0/account/~/telephony/sessions?statusCode=Disconnected


As far as I can tell, there are about 3-4 "Disconnected" webhooks fires for every call.
So I need to filter those somehow to process only one that I really need.


By trial and error I found out that webhooks with "reason" ('body', 'parties', 0, 'status', 'reason') CallerInputRedirect and BlindTransfer can be ignored (?).
Maybe something else can be dropped?


Then I drop webhooks without "extensionId" ('body', 'parties', 0, 'extensionId').
Finally, I want to skip internal calls. Not sure what's the best way to do this, but right now here is the logic:


Internal inbound call: ('body', 'parties', 0, 'direction') == 'Inbound' && ('body', 'parties', 0, 'from', 'extensionId').present?
Outbound call: ('body', 'parties', 0, 'direction') == 'Outbound' && ('body', 'parties', 0, 'to', 'extensionId').present?

To get detailed information about a call is expensive API operation, so need to use as much information as possible from the webhook data.

If webhook passes all these checks, I call call-log API to get detailed information about the call, like duration, start time, recording etc. and create corresponding record in CRM.

restapi/v1.0/account/~/extension/#{extension_id}/call-log?telephonySessionId=telephony_session_id


So the question is does all the precaution checks I use makes sense or can I tweak/simplify it in any way? Or maybe something is missing in my flow.
And in general, is webhook approach is the right solution here or maybe Sync Company Call Log would be more appropriate.
Any advice is greatly appreciated.

1 Answer
answered on Dec 28, 2023 at 8:08am  

If you just need to export/sync the call log data from your RingCentral account to your own database, you can use the read account call log API or the call log sync API to do so. Please read these articles to learn more and come back if you have further questions.

https://medium.com/ringcentral-developers/visualize-your-business-communications-history-2c81f85c324a

https://medium.com/ringcentral-developers/sync-ringcentral-call-log-into-google-sheets-with-google-apps-script-daacc9a73b72

If you really want to create your own call log in real time using the raw data, you can use the telephony session events notifications and parse the event payload. However, this will be much more complicated than the other option. Please read these articles to learn more about the telephony session events

https://medium.com/ringcentral-developers/ringcentral-telephony-session-events-notifications-98b3f8d29745

https://medium.com/ringcentral-developers/building-a-real-time-call-report-app-3eee247a141d



 1



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us