TP-89230 | campaign id fix
This commit is contained in:
@@ -6,7 +6,6 @@ import RequestType from "@universal-call-sdk/common/lib/types/RequestType.ts";
|
||||
|
||||
export const loginInAmeyo = (userId: string, password: string) => {
|
||||
console.log('loginInAmeyo', userId, password);
|
||||
console.log("***");
|
||||
return getResponseWithoutCors({
|
||||
url: `${window.BASE_AMEYO_URL}/ameyorestapi/userLogin/login`,
|
||||
method: 'POST',
|
||||
@@ -58,8 +57,8 @@ export const setAgentOnBreak = (sessionId: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const attachOmniqueService = (sessionId: string, userId: string) => {
|
||||
const OMNIQUEUE_TEXT = `7|0|9|${window.BASE_AMEYO_URL}/app/application_ui/|5B1786BFF89E87DC6EAAACDE629A89E2|com.drishti.ameyo.omniqueue.shared.CommonGwtRpcService|selectCamapign|java.lang.String/2004016611|[Ljava.lang.Integer;/1574882222|${sessionId}|${userId}|java.lang.Integer/3438268394|1|2|3|4|3|5|5|6|7|8|6|1|9|482|${sessionId}|`;
|
||||
export const attachOmniqueService = (sessionId: string, userId: string, campaignId: string) => {
|
||||
const OMNIQUEUE_TEXT = `7|0|9|${window.BASE_AMEYO_URL}/app/application_ui/|5B1786BFF89E87DC6EAAACDE629A89E2|com.drishti.ameyo.omniqueue.shared.CommonGwtRpcService|selectCamapign|java.lang.String/2004016611|[Ljava.lang.Integer;/1574882222|${sessionId}|${userId}|java.lang.Integer/3438268394|1|2|3|4|3|5|5|6|7|8|6|1|9|${campaignId}|${sessionId}|`;
|
||||
return getResponseWithoutCors({
|
||||
url: `${window.BASE_AMEYO_URL}/ameyoomniqueue/service`,
|
||||
method: 'POST',
|
||||
@@ -119,8 +118,8 @@ export const autoSelectExtension = (sessionId: string, userId: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const selectCampaign = (sessionId: string, userId: string) => {
|
||||
const SELECT_CAMPAIGN_TEXT = `7|0|9|${window.BASE_AMEYO_URL}/app/application_ui/|5B1786BFF89E87DC6EAAACDE629A89E2|com.drishti.ameyo.omniqueue.shared.CommonGwtRpcService|selectCamapign|java.lang.String/2004016611|[Ljava.lang.Integer;/1574882222|${sessionId}|${userId}|java.lang.Integer/3438268394|1|2|3|4|3|5|5|6|7|8|6|1|9|5|${sessionId}|`;
|
||||
export const selectCampaign = (sessionId: string, userId: string, campaignId: string) => {
|
||||
const SELECT_CAMPAIGN_TEXT = `7|0|9|${window.BASE_AMEYO_URL}/app/application_ui/|5B1786BFF89E87DC6EAAACDE629A89E2|com.drishti.ameyo.omniqueue.shared.CommonGwtRpcService|selectCamapign|java.lang.String/2004016611|[Ljava.lang.Integer;/1574882222|${sessionId}|${userId}|java.lang.Integer/3438268394|1|2|3|4|3|5|5|6|7|8|6|1|9|${campaignId}|${sessionId}|`;
|
||||
return getResponseWithoutCors({
|
||||
url: `${window.BASE_AMEYO_URL}/ameyoomniqueue/service`,
|
||||
method: 'POST',
|
||||
@@ -149,7 +148,7 @@ export const setAutoStatus = (sessionId: string) => {
|
||||
|
||||
export const ameyoHangupUser = (sessionId: string, userCRTObjectId: string) => {
|
||||
return getResponseWithoutCors({
|
||||
url: `${window.BASE_AMEYO_URL}/ameyorestapi/voice/hangupUser s`,
|
||||
url: `${window.BASE_AMEYO_URL}/ameyorestapi/voice/hangupUser`,
|
||||
method: 'POST',
|
||||
requestKey: RequestKeys.HANGUP_USER,
|
||||
requestType: RequestType.JSON,
|
||||
@@ -159,3 +158,16 @@ export const ameyoHangupUser = (sessionId: string, userCRTObjectId: string) => {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const getCampaignId = (sessionId: string) => {
|
||||
return getResponseWithoutCors({
|
||||
url: `${window.BASE_AMEYO_URL}/ameyorestapi/cc/getAllSessionData`,
|
||||
method: 'GET',
|
||||
requestKey: RequestKeys.GET_CAMPAIGN_ID,
|
||||
requestType: RequestType.JSON,
|
||||
data : {},
|
||||
headers: {
|
||||
sessionId
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ import {
|
||||
loginInAmeyo, maintainHeartbeat,
|
||||
selectCampaign,
|
||||
setAgentActive, setAgentOnBreak,
|
||||
setAutoStatus
|
||||
setAutoStatus,
|
||||
getCampaignId
|
||||
} from "./api.ts";
|
||||
import {
|
||||
acceptSipCall,
|
||||
@@ -34,6 +35,7 @@ class AmeyoAdapter implements IAdapter {
|
||||
private eventListenerUrl: string;
|
||||
private baseUrl: string;
|
||||
private sessionId: string;
|
||||
private campaignId: string;
|
||||
private userName: string;
|
||||
private password: string;
|
||||
private currentCallMetadata: GenericObject;
|
||||
@@ -59,6 +61,7 @@ class AmeyoAdapter implements IAdapter {
|
||||
this.sessionId = '';
|
||||
this.userName = options.userName;
|
||||
this.password = options.password;
|
||||
this.campaignId = '';
|
||||
this.sipAccountInfo = {};
|
||||
this.currentCallMetadata= {};
|
||||
this.isAgentAvailable= false;
|
||||
@@ -110,10 +113,14 @@ class AmeyoAdapter implements IAdapter {
|
||||
domain: response?.domain,
|
||||
password: response?.secret
|
||||
});
|
||||
this.sipAccountInfo = payload?.data?.response;
|
||||
console.log('sip account info', this.sipAccountInfo)
|
||||
this.sipAccountInfo = payload?.data?.response;
|
||||
getCampaignId(this.sessionId);
|
||||
setAutoStatus(this.sessionId);
|
||||
attachOmniqueService(this.sessionId, this.userName.toLowerCase());
|
||||
}
|
||||
if(payload?.data?.requestKey === RequestKeys.GET_CAMPAIGN_ID) {
|
||||
this.campaignId = payload?.data?.response?.campaignInfos?.campaignId;
|
||||
attachOmniqueService(this.sessionId, this.userName.toLowerCase(), this.campaignId);
|
||||
}
|
||||
if(payload?.data?.requestKey === RequestKeys.AMEYO_AVAILABLE) {
|
||||
setAutoStatus(this.sessionId);
|
||||
@@ -122,7 +129,7 @@ class AmeyoAdapter implements IAdapter {
|
||||
|
||||
}
|
||||
if (payload?.data?.requestKey === RequestKeys.OMNIQUEUE_SERVICE) {
|
||||
selectCampaign(this.sessionId, this.userName.toLowerCase());
|
||||
selectCampaign(this.sessionId, this.userName.toLowerCase(), this.campaignId);
|
||||
}
|
||||
if(payload?.data?.requestKey === RequestKeys.SELECT_CAMPAIGN) {
|
||||
console.log('campaign selected', payload?.data?.response);
|
||||
|
||||
@@ -22,7 +22,8 @@ export enum RequestKeys {
|
||||
SELECT_CAMPAIGN = 'select_campaign',
|
||||
HANGUP_USER = 'hangup_user',
|
||||
AUTO_SELECT_EXTENSION = 'auto_select_extension',
|
||||
SET_AUTO_STATUS = "set_auto_status"
|
||||
SET_AUTO_STATUS = "set_auto_status",
|
||||
GET_CAMPAIGN_ID = "get_campaign_id",
|
||||
}
|
||||
|
||||
export type AmeyoInitializationOptions = {
|
||||
@@ -53,4 +54,4 @@ export type SipAccountInfo = {
|
||||
userName: string,
|
||||
domain: string,
|
||||
password: string
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user