Merge pull request #31 from navi-commons/NTP-21033/hotfix-connected_call

Ntp-21033/hotfix for availability change
This commit is contained in:
Varnit Goyal
2025-01-15 09:37:46 +05:30
committed by GitHub
13 changed files with 171 additions and 28 deletions

View File

@@ -19,6 +19,46 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
## 1.1.3 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
## 1.1.2 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
## 1.1.1 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
## 1.0.100 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
## 1.0.99 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo
## 1.0.98 (2025-01-03)
**Note:** Version bump only for package @universal-call-sdk/adapter-ameyo

View File

@@ -207,6 +207,21 @@ export const getAllAgentsForTransferCall = (sessionId: string) => {
});
}
export const logoutFromAmeyo = (sessionId: string) => {
const LOGOUT_PAYLOAD_TEXT = `7|0|7|${window.BASE_AMEYO_URL}/app/application_ui/|C066834E4747CF348FD8D1A68865C24D|com.drishti.ameyo.common.ui.rpc.CommonGwtRpcService|doLogout|java.lang.String/2004016611|${sessionId}|Logout from UI|1|2|3|4|2|5|5|6|7|${sessionId}|`;
return getResponseWithoutCors({
url: `${window.BASE_AMEYO_URL}/ameyo40/service`,
method: 'POST',
requestKey: RequestKeys.LOGOUT_FROM_AMEYO,
requestType: RequestType.RAW,
data: LOGOUT_PAYLOAD_TEXT,
headers: {
'Content-Type': 'text/x-gwt-rpc; charset=UTF-8',
'X-GWT-Permutation': '11B39EE372921423BCA4DF11986A500D'
}
});
};
export const transferCallToAgent = (data: CallTransferData, sessionId: string, crtObjectId: string, userCRTObjectId: string, campaignId: string) => {
return getResponseWithoutCors({

View File

@@ -12,6 +12,7 @@ export enum MessagingType {
ON_AMEYO_AGENT_ON_BREAK = 'onAmeyoAgentOnBreak',
ON_AMEYO_FORCED_LOGOUT = 'onAmeyoForcedLogout',
ON_AMEYO_CALL_TRANSFER = 'onAmeyoCallTransfer',
ON_AMEYO_AVAILABILITY_CHANGE = 'onAmeyoAvailabilityChange'
}
@@ -117,15 +118,14 @@ function extractUserCallModelUpdatedPush(rawResponse) {
}
if (jsonData?.pushType === pushResponseTypes.UserCCRuntimeUpdatedPush) {
const payload = jsonData?.data;
//handle ameyo erroronous condition
if (payload?.isOnBreak) {
window.postMessage({
type: MessagingType.ON_AMEYO_AGENT_ON_BREAK,
data: {
reason: payload,
}
});
}
//handle ameyo availablility changes
window.postMessage({
type: messagingType.ON_AMEYO_AVAILABILITY_CHANGE,
data:{
isOnBreak: payload?.isOnBreak,
reason: payload?.statusDescription
}
})
}
if (jsonData?.pushType == pushResponseTypes.UserLoggedOffPush) {
const payload = jsonData?.data;

View File

@@ -19,7 +19,7 @@ import {
setAgentActive, setAgentOnBreak,
setAutoStatus,
getCampaignId, ameyoDisposeCall,
getAllAgentsForTransferCall, transferCallToAgent
getAllAgentsForTransferCall, transferCallToAgent, logoutFromAmeyo
} from "./api.ts";
import {
acceptSipCall,
@@ -39,7 +39,7 @@ class AmeyoAdapter implements IAdapter {
onCallDisconnected: (data: StateType) => void;
onCallIncoming: (data: StateType) => void,
onAdapterReady: () => void,
onAgentAvailabilityChange: (isAgentAvailable: boolean) => void
onAgentAvailabilityChange: (isAgentAvailable: boolean, reason: string) => void
onForcedLogout: () => void,
onLoginFailed: (err: GenericObject)=>void
onAgentsForCallTransfer: (data: GenericObject) => void
@@ -186,9 +186,6 @@ class AmeyoAdapter implements IAdapter {
}
if (payload?.data?.requestKey === RequestKeys.AMEYO_AVAILABLE) {
setAutoStatus(this.sessionId);
this.isAgentAvailable = true;
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: true});
this.callbacks.onAgentAvailabilityChange(true)
}
if (payload?.data?.requestKey === RequestKeys.OMNIQUEUE_SERVICE) {
@@ -198,13 +195,9 @@ class AmeyoAdapter implements IAdapter {
autoSelectExtension(this.sessionId, this.userName.toLowerCase());
this.callbacks.onAdapterReady();
this.currentCallState = CALL_STATES.IDLE;
this.callbacks.onAgentAvailabilityChange(true);
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: false},);
}
if (payload?.data?.requestKey === RequestKeys.AMEYO_ON_BREAK) {
setAutoStatus(this.sessionId);
this.isAgentAvailable = false;
this.callbacks.onAgentAvailabilityChange(false);
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: false},);
}
if (payload?.data?.requestKey === RequestKeys.GET_AGENTS_FOR_CALL_TRANSFER) {
@@ -243,9 +236,11 @@ class AmeyoAdapter implements IAdapter {
audioElement?.play();
}
if (data?.type === MessagingType.ON_AMEYO_AGENT_ON_BREAK) {
this.isAgentAvailable = false;
this.callbacks.onAgentAvailabilityChange(false);
if (data?.type === MessagingType.ON_AMEYO_AVAILABILITY_CHANGE) {
this.isAgentAvailable = !data?.data?.isOnBreak;
this.callbacks.onAgentAvailabilityChange(this.isAgentAvailable, data?.data?.reason || '');
window.postMessage({type: 'onAmeyoAvailabiltyChange', data: this.isAgentAvailable,});
}
if (data?.type === MessagingType.ON_AMEYO_FORCED_LOGOUT) {
this.callbacks.onForcedLogout()
@@ -275,7 +270,7 @@ class AmeyoAdapter implements IAdapter {
this.callbacks.onAdapterReady = callback;
}
registerOnAgentAvailabilityChange(callback: (isAgentAvailable: boolean) => void) {
registerOnAgentAvailabilityChange(callback: (isAgentAvailable: boolean, reason: string) => void) {
console.log('registerOnAgentAvailabilityChange');
this.callbacks.onAgentAvailabilityChange = callback;
}
@@ -348,6 +343,10 @@ class AmeyoAdapter implements IAdapter {
this.campaignId);
}
logOut() {
logoutFromAmeyo(this.sessionId);
}
private _appendTags: () => void = () => {
const script = document.createElement('script');
script.src = 'https://public-assets.np.navi-gi.in/jarvis/sip5ml.js'; // Assuming it's placed in the public folder

View File

@@ -26,6 +26,7 @@ export enum RequestKeys {
GET_CAMPAIGN_ID = "get_campaign_id",
GET_AGENTS_FOR_CALL_TRANSFER = "get_agents_for_call_transfer",
TRANSFER_CALL_TO_AGENT = "transfer_call_to_agent",
LOGOUT_FROM_AMEYO = 'logout_from_ameyo'
}
export type AmeyoInitializationOptions = {

View File

@@ -1,6 +1,6 @@
{
"name": "@universal-call-sdk/adapter-ameyo",
"version": "1.0.100",
"version": "1.1.3",
"type": "module",
"scripts": {
"dev": "vite",
@@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@universal-call-sdk/common": "^1.0.51",
"@universal-call-sdk/common": "^1.0.54",
"uuid": "^11.0.3"
},
"devDependencies": {

View File

@@ -7,6 +7,7 @@
ON_AMEYO_AGENT_ON_BREAK = 'onAmeyoAgentOnBreak',
ON_AMEYO_FORCED_LOGOUT = 'onAmeyoForcedLogout',
ON_AMEYO_CALL_TRANSFER = 'onAmeyoCallTransfer',
ON_AMEYO_AVAILABILITY_CHANGE= 'onAmeyoAvailablityChange'
}

View File

@@ -19,6 +19,46 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
## 1.0.54 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/common
## 1.0.53 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/common
## 1.0.52 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/common
## 1.0.51 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/common
## 1.0.50 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/common
## 1.0.49 (2025-01-03)
**Note:** Version bump only for package @universal-call-sdk/common

View File

@@ -8,7 +8,7 @@ class IAdapter {
registerOnCallConnected(callback: (callState: GenericObject)=>void) {callback({})}
registerOnCallDisconnected(callback: (callState: GenericObject)=>void) {callback({})}
registerOnAdapterReady(callback: ()=> void) {callback()}
registerOnAgentAvailabilityChange(callback: (isAgentAvailable: boolean) => void) {callback(false)}
registerOnAgentAvailabilityChange(callback: (isAgentAvailable: boolean, reason: string) => void) {callback(false, '')}
registerOnForcedLogoutListener(callback:()=>void) {callback()}
registerOnLoginFailedListener(callback:()=>void) {callback()}
registerOnAgentsForCallTransfer(callback: (data : GenericObject) => void) {callback({})}
@@ -21,6 +21,8 @@ class IAdapter {
setOnBreak() {}
setAvailable() {}
logOut() {}
init(metricProcessor: (MetricsProcessor) | undefined, clickStreamProcessor: (ClickStreamProcessor)| undefined) {
console.log('metric processor and click stream processor', metricProcessor, clickStreamProcessor)
}

View File

@@ -1,6 +1,6 @@
{
"name": "@universal-call-sdk/common",
"version": "1.0.51",
"version": "1.0.54",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -19,6 +19,46 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
## 1.0.58 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/core
## 1.0.57 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/core
## 1.0.56 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/core
## 1.0.55 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/core
## 1.0.54 (2025-01-06)
**Note:** Version bump only for package @universal-call-sdk/core
## 1.0.53 (2025-01-03)
**Note:** Version bump only for package @universal-call-sdk/core

View File

@@ -113,7 +113,7 @@ function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamCon
}
function registerOnAgentAvailabilityChange(callback : (isAgentAvailable: boolean) => void) {
function registerOnAgentAvailabilityChange(callback : (isAgentAvailable: boolean, reason: string) => void) {
adapter.registerOnAgentAvailabilityChange(callback);
}
@@ -153,6 +153,10 @@ function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamCon
adapter.unmuteCall();
}
function logOut() {
adapter.logOut();
}
function initialize() {
let metricProcessor;
let clickStreamProcessor;
@@ -207,6 +211,7 @@ function UseCallSdk({AdapterClass, adapterOptions, metricsConfig, clickStreamCon
muteCall,
unmuteCall,
initialize,
logOut,
setAvailable,
getLatestCallState,
setOnBreak,

View File

@@ -1,6 +1,6 @@
{
"name": "@universal-call-sdk/core",
"version": "1.0.55",
"version": "1.0.58",
"type": "module",
"scripts": {
"dev": "vite",