1ed5e51e4f7091fe0273044a4737ef7e55c35bfd
[motion2.git] / server / services / ami / preview / 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 _0xff76=['isNil','string','idContact','name','type','queue','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','util','lodash'];(function(_0x226f94,_0x111cb2){var _0xb4249f=function(_0x3754f9){while(--_0x3754f9){_0x226f94['push'](_0x226f94['shift']());}};_0xb4249f(++_0x111cb2);}(_0xff76,0xa6));var _0x6ff7=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xff76[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0x6ff7('0x0'));var _=require(_0x6ff7('0x1'));var moment=require('moment');function checkNameSurname(_0x1b5cdd,_0x1a9aca,_0x5ce2a8){var _0x39d353='';if(!_[_0x6ff7('0x2')](_0x1a9aca)&&_0x6ff7('0x3')===typeof _0x1a9aca){_0x39d353+=_0x1a9aca;}if(!_[_0x6ff7('0x2')](_0x5ce2a8)&&_0x6ff7('0x3')===typeof _0x5ce2a8){_0x39d353+='\x20'+_0x5ce2a8;}if(_0x39d353!==''){return _0x39d353;}return _0x1b5cdd;}function Action(_0x2a24d1,_0x249fde,_0x1ca84a,_0x5a2100,_0x45e64a){this['uniqueid']=_0x1ca84a||undefined;this[_0x6ff7('0x4')]=_0x2a24d1['id'];this['queue']=_0x249fde[_0x6ff7('0x5')];this[_0x6ff7('0x6')]=_0x249fde[_0x6ff7('0x6')];this['campaigntype']=_0x6ff7('0x7');this[_0x6ff7('0x8')]=![];this[_0x6ff7('0x9')]=_[_0x6ff7('0x2')](_0x2a24d1[_0x6ff7('0xa')])?undefined:_0x2a24d1['Agent'][_0x6ff7('0x5')];this[_0x6ff7('0xb')]=this[_0x6ff7('0x9')]?util['format'](_0x6ff7('0xc'),this[_0x6ff7('0x9')]):_0x5a2100||undefined;this[_0x6ff7('0xd')]=checkNameSurname(_0x2a24d1[_0x6ff7('0xe')][_0x6ff7('0xf')],_0x2a24d1[_0x6ff7('0xe')]['firstName'],_0x2a24d1[_0x6ff7('0xe')][_0x6ff7('0x10')]);this['active']=_0x2a24d1[_0x6ff7('0x11')]||![];this['calleridnum']=_0x2a24d1[_0x6ff7('0xe')]['phone'];this['scheduledat']=_0x2a24d1[_0x6ff7('0x12')];this[_0x6ff7('0x13')]=_0x2a24d1[_0x6ff7('0x13')]||0x0;this[_0x6ff7('0x14')]=_0x2a24d1[_0x6ff7('0x14')]||0x0;this[_0x6ff7('0x15')]=_0x2a24d1[_0x6ff7('0x15')]||0x0;this[_0x6ff7('0x16')]=(_0x2a24d1[_0x6ff7('0x13')]||0x0)+(_0x2a24d1[_0x6ff7('0x14')]||0x0)+(_0x2a24d1['countnoanswerretry']||0x0)+(_0x2a24d1[_0x6ff7('0x17')]||0x0)+(_0x2a24d1[_0x6ff7('0x18')]||0x0)+(_0x2a24d1[_0x6ff7('0x19')]||0x0)+(_0x2a24d1['countmachineretry']||0x0)+(_0x2a24d1['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x2a24d1[_0x6ff7('0x17')]||0x0;this[_0x6ff7('0x18')]=_0x2a24d1['countdropretry']||0x0;this[_0x6ff7('0x19')]=_0x2a24d1['countabandonedretry']||0x0;this['countmachineretry']=_0x2a24d1[_0x6ff7('0x1a')]||0x0;this[_0x6ff7('0x1b')]=_0x2a24d1['countagentrejectretry']||0x0;this[_0x6ff7('0x1c')]=_0x2a24d1['callback'];this['callbackuniqueid']=_0x2a24d1[_0x6ff7('0x1d')];this['callbackat']=_0x2a24d1[_0x6ff7('0x1e')];this[_0x6ff7('0x1f')]=_0x2a24d1[_0x6ff7('0x1f')];this[_0x6ff7('0x20')]=_0x2a24d1['ContactId'];this['ListId']=_0x2a24d1[_0x6ff7('0x21')];this['UserId']=_['isNil'](_0x2a24d1['Agent'])?_0x2a24d1[_0x6ff7('0x22')]:_0x2a24d1[_0x6ff7('0xa')]['id'];this[_0x6ff7('0x23')]=_0x2a24d1[_0x6ff7('0x23')];this[_0x6ff7('0x24')]='';this[_0x6ff7('0x25')]='';}Action[_0x6ff7('0x26')][_0x6ff7('0x27')]=function(){return util[_0x6ff7('0x28')](_0x6ff7('0x29'),this['calleridname'],this['number']);};module['exports']=Action;