How to Query for RingOut Call Duration - ringcentral

I have a requirement to record the details of calls initiated by RingOut upon completion of the call. I'm successfully polling the Ring Out Status until the call is finished, but I can't find a way to then query for the User Call Record for the completed RingOut. Is there a way to get the Session Id for a RingOut call which can be used to retrieve the User Call Record and/or query for a User Call Record using a RingOut Id? Better yet, can I create a subscription which will notify my service when a RingOut call is completed?

Instead of using the Polling, try using the push notifications to subscribe for the detailed extension presence event. Within the notification payload, you will be able to detect detect the status of the call. More information can be found here https://developers.ringcentral.com/api-reference/Detailed-Extension-Presence-Event
Hope this help!
ringcentral

Related

Can a lambda return a response and wait for a new body without closing the session?

I am running a puppeteer function in AWS Lambda and I have a scenario that the user makes a POST request to the lambda with his username and email. The function is going to check if they are valid in a website and return the JSON to the user with the answer. Is it possible to use the same lambda session to receive another input/body from the user?
The reason I need it to be the same session is because each time an user and email is sent to the lambda, the puppeteer website is going to generate unique ID's that need to be used AFTER the user sends his data in that exact moment because it is logged into the website with an unique session.
I'm currently running this function in a NodeJS and it is fine because the session isnt going to be closed but the session is closed once the lambda returns the first response.
Like people mentioned above, Lambda function is stateless resource and you can ultimately use dynamoDB to store any values such session ID or so.
Additionally, if the Lambda function should wait for response or any updated values by querying DynamoDB, then you can implement AWS Step Function or Airflow which provides the "wait" state.
See what States you can leverage in the AWS Docs.

Retrieve taskToken for the next state in Step function

I have a state in my step function where I need to make an API call and then wait for the callback. The API call will call a lambda function outside of the step function as the API has a registered callback link for the response and cannot be changed. The lambda function will receive the response and progress the step function by sending task success/failure.
I want to make the request in one state, move to another state and wait for the response. I can save the taskToken in the DB for the lambda function to send success/failure. Is there a way to retrieve the taskToken for the next state so I can do one write in the DB while sending the request. The lambda can retrieve the task token and send the response with success/failure directly to the state to progress the state machine.
The other options I can see is to poll the DB in the next state, move to the next state and write the taskToken in the DB. Any other solution?
Which is the best way to handle this scenario?
Thanks.

Best way to retrieve active calls without making request each second?

We need to create a monitor that will show any income calls in our extranet in live time.
We were able to show active calls by using /account/~/extension/~/active-calls, however, to achieve what we need we would need to make a request each second which I guess will be blocked by rate limits.
Is there a better solution for it?
Thanks
Subscription (Push Notification) API resource empowers developers to enable the client application(s) to create a single subscription (to one or more extension's) and continually receive push notifications in real time for each subscribed extension.When using this approach for your application(s) to receive events on your RingCentral account, no polling is involved.
You can create a subscription using either of the below-mentioned transportType for receiving push notifications:
PubNub
WebHook
Notifications which the client wants to receive can be specified by the event filters which are set in the subscription request. The event filter is exposed as a URL, pointing to the required RingCentral API resource. Currently the following event types are available for notifications: extensions, messages and presence. They are described in detail below:
Notifications Event Types
You can take a look at the Subscription API below:
Subscription API
If you are interested in Subscribing to Push notifications via WebHook then we have an Easy-to-follow Quickstart guide here:
RingCentral Webhooks Quickstart Guide

Is it possible to trigger a web service (or callback event) after authorize.net "AUTH_ONLY"

I want to update the status of the order when the merchant manually capture an Authorize Only transaction. Is is possible? If so, how to do that?
I have gone through the link https://support.authorize.net/authkb/index?page=content&id=A64 and it is very clear about the "AUTH_ONLY" transaction. But the link does not provide the details about the callback event.
You would need to use the Webhooks API to create a webhook for those transactions. Specifically the net.authorize.payment.capture.created event. Then your system would be notified whenever a capture occurs.

Webservice with always in memory object with queue

I have a function to give recommendations to users. This function need to make a lot of calcs to start, but after start it use the already calculed matrix on memory. After this, any other calc that is made, "fills" the object in memory to continuous learning.
My intention is to use this function to website users, but the response need to come from the same "object" in memory and need to be sequential by request because it is not thread safe.
How is the best way to get this working? My first idea was use signalr so the user dont need to wait to response and a queue to send the requests to objects. But how the signalr can receive the response for this specific request?
The entire flow is:
User enter on a page.
A javascript will call a service with the user ID and actual page.
The server will queue the ID an page.
The service will be calculating the results for each request on queue and sending responses.
The server will "receive" the response and send back to client.
The main problem is that I dont see a way to the service receive the response to send back to client until it is complete, without need to be looping in queues.
Thanks!
If you are going to use SignalR, I would suggest using a hub method to accept these potentially long running requests from the client. By doing so it should be obvious "how the signalr can receive the response for this specific request".
You should be able to queue your calculations from inside your hub method where you will have access to the caller's connection id (via the Context.ConnectionId property).
If you can await the results of your queued operation inside of the hub method you queue from, you can then simply return the result from your hub method and SignalR will flow the result back to the calling JavaScript. You can also use Clients.Caller.... to send the result back.
If you go this route I suggest you use async/await instead of blocking request threads waiting for your long-running calculations to complete.
http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-server
If you can't process your calculation results from the same method you queued the calculation from, you still have options. Just be sure to queue the caller's connection id and a request id along with the calculation to be processed.
Then, you can process the results of all your calculations from outside of your hub using GlobalHost.ConnectionManager.GetHubContext:
private IHubContext _context = GlobalHost.ConnectionManager.GetHubContext<MyHub>()
// Call ProcessResults whenever results are ready to send back to the client
public void ProcessResults(string connectionId, uint requestId, MyResult result)
{
// Presumably there's JS code mapping request id's to results
// if you can have multiple ongoing requests per client
_context.Clients.Client(connectionId).receiveResult(requestId, result);
}
http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-server#callfromoutsidehub