Skip to main content

Topic

Webhooks and notifications


Details

We have built an integration where the users get a ringing -> call active -> hangout notification on our application, plus it creates a record of this call on hours system. This works fine when the user calls or receives a call, to their direct number, through extension, or automatic redirection, after calling the company number.


However, while using the MAX Agent NICE, and receiving a call through this tool, no session webhook notification is received.


Request/Response


I am reproducing a detailed reproduction of the code used to subscribe to the session. This code is using the user oauth previously made authorization. The token is active, and the token refreshing is also being take care by the code, besides not being presented on the below snippet.


``` C#

const string SessionEventFilterUri = "/restapi/v1.0/account/~/extension/~/telephony/sessions";


var subscriptionInfo = await PostCreateSubscriptionAsync(

ringCentralContext,

new()

{

eventFilters = new[] { SessionEventFilterUri },

expiresIn = Convert.ToInt64(TimeSpan.FromDays(365).TotalSeconds),

deliveryMode = new()

{

transportType = "WebHook",

address = UrlBuilder.GetBaseApiUrl() + "webhook/session"

}

},

cancellationToken

).ConfigureAwait(false);


public Task<SubscriptionInfo> PostCreateSubscriptionAsync(

RingCentralContext context,

CreateSubscriptionRequest args,

CancellationToken cancellationToken) =>

_exec.ExecuteAsync(

context,

true,

(restClient, _) => restClient

.Restapi()

.Subscription()

.Post(

args,

new() { cancellationToken = cancellationToken }

),

cancellationToken

);


[DebuggerStepThrough]

private class Executer

{

private readonly RingCentralContextManager ContextManager;


public Executer(RingCentralService ringCentralService) =>

ContextManager = ringCentralService.ContextManager;


public Task ExecuteAsync(

RingCentralContext context,

bool isAccessTokenAuthorization,

Func<RestClient, OAuthToken?, Task> executeAsync,

CancellationToken cancellationToken)

=> ExecuteAsync(

context,

isAccessTokenAuthorization,

async (r, o) =>

{

await executeAsync(r, o).ConfigureAwait(false);

return true;

},

cancellationToken);


public Task<T> ExecuteAsync<T>(

RingCentralContext context,

bool isAccessTokenAuthorization,

Func<RestClient, OAuthToken?, Task<T>> executeAsync,

CancellationToken cancellationToken) =>

// the following code have only retry and token refreshing policy. Besides that, it does call the RingCentral api passed to the delegate param executeAsync

ContextManager

.ExecutionPolicy

.ExecuteAsync(

new PolicyRestClientExecutionContext(context)

{

IsAccessTokenAuthorization = isAccessTokenAuthorization

},

(_, _) => executeAsync(context.RestClient, context.OAuthToken),

cancellationToken);

}


public record RingCentralContext(RestClient RestClient, OAuthToken? OAuthToken);

```


I can confirm that the subscription is active and working, and the session notification is working for the scenarios described at the beginning of this ticket. However, when the call comes through the MAX Agent NICE, no notification is sent.


Steps to reproduce

1. Use MAX Agent NICE

2. Receive a call using the MAX Agent NICE application

3. The Ring Central softphone rings, but no notification is sent to the webhook


Error message

There is no error message, but the user API subscription is not triggered when a call is received through the MAX Agent NICE application.


Who build that MAX Agent NICE? Is that a 3rd party app/integration? Can you provide a link to the tool?


I am not sure how the MAX Agent Nice tool is configured to make a call or place a call to RingCentral number. But it maybe the config is using different user extension than the extension you are monitoring from your Webhooks app. Can you try with the account tel session event to see if you receive any notification at all.

const string SessionEventFilterUri = "/restapi/v1.0/account/~/telephony/sessions";

Let me know.


Reply