56ab12ef822c79da96a242f7a17a1c306edaf578
[motion2.git] / server / services / ami / dialer / action.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x8a0d=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','moment','string','voiceQueue','name','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x56890c,_0x575817){var _0x250846=function(_0xdc11dd){while(--_0xdc11dd){_0x56890c['push'](_0x56890c['shift']());}};_0x250846(++_0x575817);}(_0x8a0d,0x156));var _0xd8a0=function(_0x17c896,_0x3cad2d){_0x17c896=_0x17c896-0x0;var _0x1afa73=_0x8a0d[_0x17c896];return _0x1afa73;};'use strict';var util=require(_0xd8a0('0x0'));var _=require('lodash');var moment=require(_0xd8a0('0x1'));function checkNameSurname(_0x470cf8,_0x3305f3,_0x5171a0){var _0x200ef5='';if(!_['isNil'](_0x3305f3)&&_0xd8a0('0x2')===typeof _0x3305f3){_0x200ef5+=_0x3305f3;}if(!_['isNil'](_0x5171a0)&&_0xd8a0('0x2')===typeof _0x5171a0){_0x200ef5+='\x20'+_0x5171a0;}if(_0x200ef5!==''){return _0x200ef5;}return _0x470cf8;}function Action(_0x349b49,_0x33a302,_0x3433db){this[_0xd8a0('0x3')]=_0x349b49;this['uniqueid']=_0x3433db||undefined;this[_0xd8a0('0x4')]=checkNameSurname(_0x33a302[_0xd8a0('0x5')]['phone'],_0x33a302[_0xd8a0('0x5')][_0xd8a0('0x6')],_0x33a302[_0xd8a0('0x5')][_0xd8a0('0x7')]);this[_0xd8a0('0x8')]=_0x33a302[_0xd8a0('0x5')]['phone'];this[_0xd8a0('0x9')]=_0x349b49[_0xd8a0('0x4')];this[_0xd8a0('0xa')]=_0x33a302[_0xd8a0('0xa')]||![];this[_0xd8a0('0xb')]=_0x349b49['type'];this['dialQueueTimeout']=_0x349b49[_0xd8a0('0xc')]||0x3;this['scheduledat']=_0x33a302[_0xd8a0('0xd')];this[_0xd8a0('0xe')]=_0x33a302['countbusyretry'];this['countcongestionretry']=_0x33a302[_0xd8a0('0xf')];this['countnoanswerretry']=_0x33a302[_0xd8a0('0x10')];this[_0xd8a0('0x11')]=_0x33a302['countnosuchnumberretry'];this['countdropretry']=_0x33a302[_0xd8a0('0x12')];this[_0xd8a0('0x13')]=_0x33a302[_0xd8a0('0x13')];this['countmachineretry']=_0x33a302[_0xd8a0('0x14')];this[_0xd8a0('0x15')]=_0x33a302[_0xd8a0('0x15')];this['ContactId']=_0x33a302[_0xd8a0('0x16')];this[_0xd8a0('0x17')]=_0x33a302['ListId'];this[_0xd8a0('0x18')]=_0x33a302['UserId'];this['VoiceQueueId']=_0x33a302[_0xd8a0('0x19')];this['CampaignId']=_0x33a302[_0xd8a0('0x1a')];this[_0xd8a0('0x1b')]=_0x33a302['id'];this[_0xd8a0('0x1c')]=_0x33a302[_0xd8a0('0x5')][_0xd8a0('0x6')]||'';this[_0xd8a0('0x1d')]=moment()['format'](_0xd8a0('0x1e'));this[_0xd8a0('0x1f')]=_0x33a302[_0xd8a0('0x1f')];this[_0xd8a0('0x20')]=_0x33a302[_0xd8a0('0x20')];this[_0xd8a0('0x21')]=_0x33a302[_0xd8a0('0x21')];this[_0xd8a0('0x22')]=_0x33a302[_0xd8a0('0x22')];this[_0xd8a0('0x23')]='';this[_0xd8a0('0x24')]='';}Action[_0xd8a0('0x25')][_0xd8a0('0x26')]=function(){return util[_0xd8a0('0x27')](_0xd8a0('0x28'),this[_0xd8a0('0x4')],this['voiceQueue'][_0xd8a0('0x29')]>0x0?this[_0xd8a0('0x8')][_0xd8a0('0x2a')](this[_0xd8a0('0x3')][_0xd8a0('0x29')]):this[_0xd8a0('0x8')]);};Action[_0xd8a0('0x25')][_0xd8a0('0x2b')]=function(){return this['queue'];};module[_0xd8a0('0x2c')]=Action;