Request for Help with Inbound Call Not Responding Issue (webRTC)

Hello,

I am developing softphone functionality using purecloud-platform-client with JavaScript (using webRTC).
I am receiving notifications via WebSocket and have implemented call answering using the patchConversationsCallParticipant method for inbound calls.

However, although the patchConversationsCallParticipant method returns a response with state 202, the inbound call is still not being answered even though the phone rings.

I am requesting assistance with this issue.

Thank you.

Make sure the user is using the station via PUT /api/v2/users/{userId}/station/associatedstation/{stationId}. If that's correct and your softphone implementation is implemented per the documentation, please open a case with Genesys Cloud Care to investigate. You'll need to form the question in a certain way to get them to answer and not kick you to the dev forum simply because it involves your code. The question you need to ask is why the Genesys Cloud edge is failing to connect the media when the API instructs the call to be connected. They'll need the correlation ID from that API request, a description of the issue, and the user and station IDs involved, at a minimum.

I apologize for the confusion earlier. Here is a revised description of the testing method and the problem I am requesting help with.

I received an ACCESS_CODE through a code verification process.

ACCESS_CODE = '1EIUwKtS4CoJkEWSybeEyu1ZbyVzhRmItDg3P6akYinU5SsSgR2p8qVuhZpZ_zEDIgzZkJF1l9RN1zHVcexY8A';

used the purecloud library and created an object, and then received notifications via WebSocket.

I used the following code:

const platformClient = require('platformClient');
platformClient.ApiClient.instance.setAccessToken(ACCESS_CODE);

const client = platformClient.ApiClient.instance;
client.setEnvironment(platformClient.PureCloudRegionHosts.ap_northeast_2);
const conversationsApi = new platformClient.ConversationsApi();
const notificationsApi = new platformClient.NotificationsApi();

client.loginImplicitGrant(CLIENT_ID, REDIRECT_URI).then(() => {
return usersApi.getUsersMe();
})
.then((userMe) => {
me = userMe.body;
return notificationsApi.postNotificationsChannels();
})
.then((channel) => {
notificationChannel = channel.body;
webSocket = new WebSocket(notificationChannel.connectUri);
webSocket.onmessage = handleNotification;
conversationsTopic = 'v2.users.' + me.id + '.conversations';
const body = [ { id: conversationsTopic } ];
return notificationsApi.putNotificationsChannelSubscriptions(notificationChannel.id, body);
}).catch((err) => console.error(err));

function handleNotification(message) {
const notification = JSON.parse(message.data);
if (notification.topicName.toLowerCase() === 'channel.metadata') {
return;
} else if (notification.topicName.toLowerCase() !== conversationsTopic.toLowerCase()) {
return;
}

var conversation = notification.eventBody;
conversation.participants.forEach((participant) => {
if (!participant.calls || participant.calls.length === 0) return;
if(participant.calls[0].state === 'alerting'){
$("#noti_id").val(conversation.id);
$("#participant_id").val(participant.id);
}
});
}

I received a call and obtained a conversation ID: c86dfb59-2ce6-4882-babb-30e114239873 and a participant ID: 722c2d3f-89de-45ca-8fb5-0668e2776736. Then, I clicked the receive button:

$('button#btn_accept').click(() => {
var c_id = $("#noti_id").val();
var p_id = $("#participant_id").val();
call_accept(c_id, p_id);
});

function call_accept(conversationId, participantId) {
let body = {
'state': 'Connected'
};
conversationsApi.patchConversationsCallParticipant(conversationId, participantId, body)
.then((response) => {
console.log('response', response);
console.log('headers', response.headers);
}).catch((err) => console.error(err, err.body.message));
}

However, after clicking the receive button, the response showed up as follows, and the call continued to ring without being answered:

{
"status": 202,
"statusText": "",
"headers": {
"cache-control": "no-cache, no-store, must-revalidate",
"content-type": "application/json"
},
"body": {},
"error": null
}

It appears your code never sets the user's station.

I put user's station in my code as below.

usersApi.getUserStation(userId).then((data) => {
station_id = data.body.associatedStation.id;
usersApi.putUserStationAssociatedstationStationId(userId, station_id).then((response) => {
console.log("putUserStationAssociatedstationStationId returned successfully.", response);
})
.catch((err) => {
console. error(err);
});
})
.catch((err) => {
console. error(err);
});

I checked the response value as below.

"body": {
"userId": "fb138e02-bff6-4246-94aa-fbc8b042a5da",
"associatedStation": {
"id": "7bd8ef09-49b1-4384-8df8-2878e39f14f4",
"name": "WebrRTC-7162",
"type": "inin_webrtc_softphone",
"associatedUser": {
"id": "fb138e02-bff6-4246-94aa-fbc8b042a5da",
"selfUri": "/api/v2/users/fb138e02-bff6-4246-94aa-fbc8b042a5da"
},
"associatedDate": "2023-03-21T07:50:19.736Z",
"defaultUser": {
"id": "fb138e02-bff6-4246-94aa-fbc8b042a5da",
"selfUri": "/api/v2/users/fb138e02-bff6-4246-94aa-fbc8b042a5da"
},
"providerInfo": {
"locationId": "cfae433f-a155-4b11-a91b-c34f1543fa44",
"name": "63bba4f5a3eef51b8942a117+insunginformationcoltd.orgspan.com",
"edgeGroupId": "5c6a01d7-21bd-4e37-b411-afff034edc57"
}
},
"effectiveStation": {
"id": "7bd8ef09-49b1-4384-8df8-2878e39f14f4",
"name": "WebrRTC-7162",
"type": "inin_webrtc_softphone",
"associatedUser": {
"id": "fb138e02-bff6-4246-94aa-fbc8b042a5da",
"selfUri": "/api/v2/users/fb138e02-bff6-4246-94aa-fbc8b042a5da"
},
"associatedDate": "2023-03-21T07:50:19.736Z",
"defaultUser": {
"id": "fb138e02-bff6-4246-94aa-fbc8b042a5da",
"selfUri": "/api/v2/users/fb138e02-bff6-4246-94aa-fbc8b042a5da"
},
"providerInfo": {
"locationId": "cfae433f-a155-4b11-a91b-c34f1543fa44",
"name": "63bba4f5a3eef51b8942a117+insunginformationcoltd.orgspan.com",
"edgeGroupId": "5c6a01d7-21bd-4e37-b411-afff034edc57"
}
},
"defaultStation": {
"id": "7bd8ef09-49b1-4384-8df8-2878e39f14f4",
"name": "WebrRTC-7162",
"type": "inin_webrtc_softphone",
"associatedUser": {
"id": "fb138e02-bff6-4246-94aa-fbc8b042a5da",
"selfUri": "/api/v2/users/fb138e02-bff6-4246-94aa-fbc8b042a5da"
},
"associatedDate": "2023-03-21T07:50:19.736Z",
"defaultUser": {
"id": "fb138e02-bff6-4246-94aa-fbc8b042a5da",
"selfUri": "/api/v2/users/fb138e02-bff6-4246-94aa-fbc8b042a5da"
},
"providerInfo": {
"locationId": "cfae433f-a155-4b11-a91b-c34f1543fa44",
"name": "63bba4f5a3eef51b8942a117+insunginformationcoltd.orgspan.com",
"edgeGroupId": "5c6a01d7-21bd-4e37-b411-afff034edc57"
}
},
"lastAssociatedStation": {
"id": "7bd8ef09-49b1-4384-8df8-2878e39f14f4",
"name": "WebrRTC-7162",
"type": "inin_webrtc_softphone",
"associatedUser": {
"id": "fb138e02-bff6-4246-94aa-fbc8b042a5da",
"selfUri": "/api/v2/users/fb138e02-bff6-4246-94aa-fbc8b042a5da"
},
"associatedDate": "2023-03-21T07:50:19.736Z",
"defaultUser": {
"id": "fb138e02-bff6-4246-94aa-fbc8b042a5da",
"selfUri": "/api/v2/users/fb138e02-bff6-4246-94aa-fbc8b042a5da"
},
"providerInfo": {
"locationId": "cfae433f-a155-4b11-a91b-c34f1543fa44",
"name": "63bba4f5a3eef51b8942a117+insunginformationcoltd.orgspan.com",
"edgeGroupId": "5c6a01d7-21bd-4e37-b411-afff034edc57"
}
}
},
"error": null

But still when I call patchConversationsCallParticipant(conversationId, participantId, body)

{
"status": 202,
"statusText": "",
"headers": {
"cache-control": "no-cache, no-store, must-revalidate",
"content-type": "application/json"
},
"body": {},
"error": null
}

Unable to receive inbound call with response value as above.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.