This endpoint will be used in two scenarios
1) When a user reloads or signs in to Upsales, we want to know if the user has any ongoing phone calls.
2) While a call is in progress, we poll every 10 seconds to know if the call is still going. We only poll if your app's config json has a capabilities object without pickupHook. Apps with pickupHook are not polled: add hangupHook and send the Hangup webhook when a call ends.
Apps with useCallToLinks don't get this request.
Your app gets a request to the following endpoint
/ongoing
The request is a POST with a JSON body, and your app's endpoint must use HTTPS. The body has the same fields as every app request (see Request body), and body.data is empty. Use body.user, the account's config body.config or the user's config body.userConfig to know which user to check ongoing calls for. It's up to you how the matching is done!
Respond within 30 seconds with status 200 or 201.
If there's an ongoing call, look up and respond with the corresponding phoneCall object from Upsales API. Upsales reads these fields:
-
phoneNumber: required. Without it, Upsales treats the call as ended. -
id: the ID of the phone call. -
date: when the call was started. -
contactandclient: the contact and company shown in the call.
If there's no ongoing call, respond with an empty JSON object {} and 200 OK. If a call is open in Upsales, it is closed without sending /hangup.