diff --git a/src/app/integrations/integrations.component.ts b/src/app/integrations/integrations.component.ts index ec6e94426c15..ad9469ef08c5 100644 --- a/src/app/integrations/integrations.component.ts +++ b/src/app/integrations/integrations.component.ts @@ -284,7 +284,7 @@ export class IntegrationsComponent implements OnInit, OnDestroy { smsApp.runURL = environment['smsConfigUrl']; smsApp.channel = "sms"; } else { - telegramApp = { + smsApp = { runURL: environment['smsConfigUrl'], channel: "sms" } @@ -316,6 +316,31 @@ export class IntegrationsComponent implements OnInit, OnDestroy { } this.availableApps.push(voiceApp); + // ------- + + let voiceTwiloApp = response.apps.find(a => (a.title === APPS_TITLE.TWILIO_VOICE && a.version === "v2")); + + if (environment['voiceTwilioConfigUrl']) { + if (voiceTwiloApp) { + voiceTwiloApp.runURL = environment['voiceTwilioConfigUrl']; + voiceTwiloApp.channel = "voice-twilio"; + } else { + voiceTwiloApp = { + voiceTwiloApp: environment['voiceTwilioConfigUrl'], + channel: "voice-twilio" + } + } + } + else { + if (voiceTwiloApp) { + voiceTwiloApp.channel = "voice-twilio"; + } + } + this.availableApps.push(voiceTwiloApp); + + // ------- + + resolve(true); }, (error) => { diff --git a/src/app/integrations/list/ext-integration/ext-integration.component.ts b/src/app/integrations/list/ext-integration/ext-integration.component.ts index 9e6daeb75bda..7ab6aa400ce6 100644 --- a/src/app/integrations/list/ext-integration/ext-integration.component.ts +++ b/src/app/integrations/list/ext-integration/ext-integration.component.ts @@ -24,7 +24,7 @@ export class ExtIntegrationComponent implements OnInit { ) { } ngOnInit(): void { - this.logger.log("Starting External App Integration"); + console.log("Starting External App Integration"); } diff --git a/src/app/integrations/utils.ts b/src/app/integrations/utils.ts index 0ceac191abea..419c396b6fd2 100644 --- a/src/app/integrations/utils.ts +++ b/src/app/integrations/utils.ts @@ -18,6 +18,7 @@ export enum INTEGRATIONS_KEYS { TELEGRAM = 'telegram', TWILIO = 'twilio', VXML_VOICE = 'voice', + TWILIO_VOICE = "voice-twilio", WHATSAPP = 'whatsapp', ZAPIER = 'zapier', ZENDESK = 'zendesk', @@ -29,7 +30,8 @@ export enum APPS_TITLE { MESSENGER = "Facebook Messenger", TELEGRAM = "Telegram", VXML_VOICE = "VXML Voice", - TWILIO_SMS = "Twilio SMS" + TWILIO_SMS = "Twilio SMS", + TWILIO_VOICE = "Twilio Voice" } export enum INTEGRATIONS_CATEGORIES { @@ -107,6 +109,7 @@ export const INTEGRATION_LIST_ARRAY = [ { name: "Telegram", category: INTEGRATIONS_CATEGORIES.CHANNEL, key: INTEGRATIONS_KEYS.TELEGRAM, src_icon: "assets/img/int/telegram-icon.png", src_logo: "assets/img/int/telegram-logo.png", pro: false, plan: 'Sandbox' }, { name: "Twilio SMS", category: INTEGRATIONS_CATEGORIES.CHANNEL, key: INTEGRATIONS_KEYS.TWILIO_SMS, src_icon: "assets/img/int/twilio-sms.png", src_logo: "assets/img/int/twilio-sms.png", pro: false, plan: 'Premium' }, { name: "VXML Voice", category: INTEGRATIONS_CATEGORIES.CHANNEL, key: INTEGRATIONS_KEYS.VXML_VOICE, src_icon: "assets/img/int/vxml-icon.png", src_logo: "assets/img/int/vxml-icon.png", pro: true, plan: 'Premium' }, + { name: "Twilio Voice", category: INTEGRATIONS_CATEGORIES.CHANNEL, key: INTEGRATIONS_KEYS.TWILIO_VOICE, src_icon: "assets/img/int/voice-twilio-icon.png", src_logo: "assets/img/int/voice-twilio-icon.png", pro: true, plan: 'Premium' }, { name: "WhatsApp", category: INTEGRATIONS_CATEGORIES.CHANNEL, key: INTEGRATIONS_KEYS.WHATSAPP, src_icon: "assets/img/int/whatsapp-icon.png", src_logo: "assets/img/int/whatsapp-logo.png", pro: true, plan: 'Premium' }, //{ name: "Zapier", category: INTEGRATIONS_CATEGORIES.INT_PLAT, key: INTEGRATIONS_KEYS.ZAPIER, src_icon: "assets/img/int/zapier-icon.png", src_logo: "assets/img/int/zapier-logo.svg", pro: true, plan: 'Basic' }, //{ name: "Zendesk", category: INTEGRATIONS_CATEGORIES.LIVE_CHAT, key: INTEGRATIONS_KEYS.ZENDESK, src_icon: "assets/img/int/zendesk-icon.png", src_logo: "assets/img/int/zendesk-logo.png", pro: true, plan: 'Premium' }, diff --git a/src/app/utils/util.ts b/src/app/utils/util.ts index 722ca55919b2..360382edb081 100755 --- a/src/app/utils/util.ts +++ b/src/app/utils/util.ts @@ -730,6 +730,7 @@ export const CHANNELS_NAME = { MESSANGER: 'messenger', WHATSAPP: 'whatsapp', VOICE_VXML: 'voice-vxml', + VOICE_TWILIO: 'voice-twilio', SMS_TWILIO: 'sms-twilio', } @@ -741,6 +742,7 @@ export const CHANNELS = [ { id: CHANNELS_NAME.MESSANGER, name: 'Facebook Messenger' }, { id: CHANNELS_NAME.WHATSAPP, name: 'WhatsApp' }, { id: CHANNELS_NAME.VOICE_VXML, name: 'Voice' }, + { id: CHANNELS_NAME.VOICE_TWILIO, name: 'Voice' }, { id: CHANNELS_NAME.SMS_TWILIO, name: 'SMS' }, ] diff --git a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html index 72a6b9642f35..253522ca920a 100755 --- a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html +++ b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.html @@ -666,6 +666,7 @@ conversationTypeValue === CHANNELS_NAME.WHATSAPP || conversationTypeValue === CHANNELS_NAME.EMAIL || conversationTypeValue === CHANNELS_NAME.VOICE_VXML || + conversationTypeValue === CHANNELS_NAME.VOICE_TWILIO || conversationTypeValue === CHANNELS_NAME.SMS_TWILIO" class="applied-filter"> Chat @@ -696,6 +697,9 @@ Voice + + Voice + SMS @@ -1370,6 +1374,7 @@ Facebook Messenger WhatsApp Voice + Voice SMS @@ -1557,7 +1562,7 @@ - + diff --git a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts index 831a09b53a9c..4cd46d8d2342 100755 --- a/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts +++ b/src/app/ws_requests/history-and-nort-convs/history-and-nort-convs.component.ts @@ -652,6 +652,63 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O }); } + getCurrentProject() { + this.auth.project_bs.subscribe((project) => { + this.logger.log('[HISTORY & NORT-CONVS] - PRJCT FROM SUBSCRIPTION TO AUTH SERV ', project) + if (project) { + this.projectId = project._id; + this.findCurrentProjectAmongAll(this.projectId) + } + }); + } + + findCurrentProjectAmongAll(projectId: string) { + + this.projectService.getProjects().subscribe((projects: any) => { + this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - projects ', projects); + // const current_selected_prjct = projects.filter(prj => prj.id_project.id === projectId); + // this.logger.log('[SIDEBAR] - GET PROJECTS - current_selected_prjct ', current_selected_prjct); + + this.current_selected_prjct = projects.find(prj => prj.id_project.id === projectId); + this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct ', this.current_selected_prjct); + if (this.current_selected_prjct.id_project.profile) { + const projectProfile = this.current_selected_prjct.id_project.profile + // this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > projectProfile ', projectProfile); + // this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > conversationType ', this.conversationType); + if (projectProfile && projectProfile.customization && projectProfile.customization.voice && projectProfile.customization.voice === true) { + this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > projectProfile.customization.voice ', projectProfile.customization.voice); + if(this.payIsVisible) { + let voice_vxml_index = this.conversationType.findIndex(x => x['id'] === CHANNELS_NAME.VOICE_VXML); + this.conversationType.splice(voice_vxml_index, 1); + } else { + let voice_twilio_index = this.conversationType.findIndex(x => x['id'] === CHANNELS_NAME.VOICE_TWILIO); + this.conversationType.splice(voice_twilio_index, 1); + } + // if (projectProfile.customization.voice) { + + // } else { + // this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > projectProfile.customization.voice ', projectProfile.customization.voice); + // } + } else { + this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > projectProfile.customization ', projectProfile.customization); + this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - conversationType ', this.conversationType); + let voice_vxml_index = this.conversationType.findIndex(x => x['id'] === CHANNELS_NAME.VOICE_VXML); + let voice_twilio_index = this.conversationType.findIndex(x => x['id'] === CHANNELS_NAME.VOICE_TWILIO); + this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > CHANNELS_NAME.VOICE_VXML ++++ 1 index', voice_vxml_index); + this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > CHANNELS_NAME.VOICE_TWILIO ++++ 1 index', voice_twilio_index); + this.conversationType.splice(voice_vxml_index, 1); + this.conversationType.splice(voice_twilio_index, 1); + } + + } + + this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - projects ', projects); + }, error => { + this.logger.error('[HISTORY & NORT-CONVS] - GET PROJECTS - ERROR: ', error); + }, () => { + this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS * COMPLETE * '); + }); + } getCurrentUrlLoadRequests() { const currentUrl = this.router.url; @@ -1403,7 +1460,7 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O // User Agent // ------------------------------------------------------------------- const user_agent_result = this.parseUserAgent(request.userAgent); - // console.log('[HISTORY & NORT-CONVS] - user_agent_result ', user_agent_result); + // this.logger.log('[HISTORY & NORT-CONVS] - user_agent_result ', user_agent_result); const ua_browser = user_agent_result.browser.name + ' ' + user_agent_result.browser.version request['ua_browser'] = ua_browser; const ua_os = user_agent_result.os.name + ' ' + user_agent_result.os.version @@ -1948,8 +2005,6 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O this.conversation_type = 'messenger' } - - if (this.conversation_type === 'email') { // this.conversationTypeValue = 'email' this.conversation_type = 'email' @@ -1970,6 +2025,11 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O // this.conversationTypeValue = 'whatsapp' this.conversation_type = 'voice-vxml' } + + if (this.conversation_type === 'voice-twilio') { + // this.conversationTypeValue = 'whatsapp' + this.conversation_type = 'voice-twilio' + } } @@ -2930,52 +2990,7 @@ export class HistoryAndNortConvsComponent extends WsSharedComponent implements O } - getCurrentProject() { - this.auth.project_bs.subscribe((project) => { - this.logger.log('[HISTORY & NORT-CONVS] - PRJCT FROM SUBSCRIPTION TO AUTH SERV ', project) - if (project) { - this.projectId = project._id; - this.findCurrentProjectAmongAll(this.projectId) - } - }); - } - - findCurrentProjectAmongAll(projectId: string) { - - this.projectService.getProjects().subscribe((projects: any) => { - this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - projects ', projects); - // const current_selected_prjct = projects.filter(prj => prj.id_project.id === projectId); - // this.logger.log('[SIDEBAR] - GET PROJECTS - current_selected_prjct ', current_selected_prjct); - - this.current_selected_prjct = projects.find(prj => prj.id_project.id === projectId); - this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct ', this.current_selected_prjct); - if (this.current_selected_prjct.id_project.profile) { - const projectProfile = this.current_selected_prjct.id_project.profile - this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > projectProfile ', projectProfile); - if (projectProfile && projectProfile.customization && projectProfile.customization.voice && projectProfile.customization.voice === true) { - this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > projectProfile.customization.voice ', projectProfile.customization.voice); - // if (projectProfile.customization.voice) { - - // } else { - // this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > projectProfile.customization.voice ', projectProfile.customization.voice); - // } - } else { - this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > projectProfile.customization ', projectProfile.customization); - this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - conversationType ', this.conversationType); - let index = this.conversationType.findIndex(x => x['id'] === CHANNELS_NAME.VOICE_VXML); - this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - current_selected_prjct > CHANNELS_NAME.VOICE_VXML ++++ 1 index', index); - this.conversationType.splice(index, 1); - } - - } - - this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS - projects ', projects); - }, error => { - this.logger.error('[HISTORY & NORT-CONVS] - GET PROJECTS - ERROR: ', error); - }, () => { - this.logger.log('[HISTORY & NORT-CONVS] - GET PROJECTS * COMPLETE * '); - }); - } + getRequestText(text: string): string { if (text) { diff --git a/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.html b/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.html index d685189dda88..e60298989280 100755 --- a/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.html +++ b/src/app/ws_requests/ws-requests-list/ws-requests-served/ws-requests-served.component.html @@ -310,6 +310,7 @@

Facebook Messenger WhatsApp Voice + Voice SMS @@ -515,7 +516,7 @@

- + @@ -610,94 +611,6 @@

- - - - diff --git a/src/app/ws_requests/ws-requests-list/ws-requests-unserved/ws-requests-unserved.component.html b/src/app/ws_requests/ws-requests-list/ws-requests-unserved/ws-requests-unserved.component.html index fe824327153b..a8a632f84f88 100755 --- a/src/app/ws_requests/ws-requests-list/ws-requests-unserved/ws-requests-unserved.component.html +++ b/src/app/ws_requests/ws-requests-list/ws-requests-unserved/ws-requests-unserved.component.html @@ -401,6 +401,7 @@

Facebook Messenger WhatsApp Voice + Voice SMS @@ -596,7 +597,7 @@

- + diff --git a/src/assets/img/int/voice-twilio-icon.png b/src/assets/img/int/voice-twilio-icon.png new file mode 100644 index 000000000000..a069b5d470bd Binary files /dev/null and b/src/assets/img/int/voice-twilio-icon.png differ