e0c8075f6e86f6e7c22123921ef87690affb3060
[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 _0x5f66=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','lodash','isNil','uniqueid','idContact','queue','name','type','dialAnswer','membername','Agent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var util=require('util');var _=require(_0x65f6('0x0'));var moment=require('moment');function checkNameSurname(_0x2d5fd9,_0x2f06ae,_0x3461cd){var _0xbce843='';if(!_[_0x65f6('0x1')](_0x2f06ae)&&'string'===typeof _0x2f06ae){_0xbce843+=_0x2f06ae;}if(!_[_0x65f6('0x1')](_0x3461cd)&&'string'===typeof _0x3461cd){_0xbce843+='\x20'+_0x3461cd;}if(_0xbce843!==''){return _0xbce843;}return _0x2d5fd9;}function Action(_0x1c9f5b,_0x22b017,_0x4ec221,_0x4ed98f,_0x1c0e12){this[_0x65f6('0x2')]=_0x4ec221||undefined;this[_0x65f6('0x3')]=_0x1c9f5b['id'];this[_0x65f6('0x4')]=_0x22b017[_0x65f6('0x5')];this[_0x65f6('0x6')]=_0x22b017['type'];this['campaigntype']=_0x65f6('0x4');this[_0x65f6('0x7')]=![];this[_0x65f6('0x8')]=_[_0x65f6('0x1')](_0x1c9f5b['Agent'])?undefined:_0x1c9f5b[_0x65f6('0x9')]['name'];this['channelAgent']=this[_0x65f6('0x8')]?util['format'](_0x65f6('0xa'),this['membername']):_0x4ed98f||undefined;this[_0x65f6('0xb')]=checkNameSurname(_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xd')],_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xe')],_0x1c9f5b[_0x65f6('0xc')][_0x65f6('0xf')]);this[_0x65f6('0x10')]=_0x1c9f5b[_0x65f6('0x10')]||![];this[_0x65f6('0x11')]=_0x1c9f5b['phone'];this[_0x65f6('0x12')]=_0x1c9f5b['scheduledat'];this['countbusyretry']=_0x1c9f5b[_0x65f6('0x13')]||0x0;this[_0x65f6('0x14')]=_0x1c9f5b[_0x65f6('0x14')]||0x0;this[_0x65f6('0x15')]=_0x1c9f5b[_0x65f6('0x15')]||0x0;this[_0x65f6('0x16')]=(_0x1c9f5b[_0x65f6('0x13')]||0x0)+(_0x1c9f5b[_0x65f6('0x14')]||0x0)+(_0x1c9f5b['countnoanswerretry']||0x0)+(_0x1c9f5b['countnosuchnumberretry']||0x0)+(_0x1c9f5b[_0x65f6('0x17')]||0x0)+(_0x1c9f5b['countabandonedretry']||0x0)+(_0x1c9f5b['countmachineretry']||0x0)+(_0x1c9f5b['countagentrejectretry']||0x0);this[_0x65f6('0x18')]=_0x1c9f5b[_0x65f6('0x18')]||0x0;this['countdropretry']=_0x1c9f5b[_0x65f6('0x17')]||0x0;this[_0x65f6('0x19')]=_0x1c9f5b[_0x65f6('0x19')]||0x0;this[_0x65f6('0x1a')]=_0x1c9f5b[_0x65f6('0x1a')]||0x0;this[_0x65f6('0x1b')]=_0x1c9f5b['countagentrejectretry']||0x0;this[_0x65f6('0x1c')]=_0x1c9f5b['callback'];this['callbackuniqueid']=_0x1c9f5b[_0x65f6('0x1d')];this[_0x65f6('0x1e')]=_0x1c9f5b['callbackat'];this[_0x65f6('0x1f')]=_0x1c9f5b[_0x65f6('0x1f')];this[_0x65f6('0x20')]=_0x1c9f5b[_0x65f6('0x20')];this['ListId']=_0x1c9f5b[_0x65f6('0x21')];this[_0x65f6('0x22')]=_[_0x65f6('0x1')](_0x1c9f5b['Agent'])?_0x1c9f5b['UserId']:_0x1c9f5b['Agent']['id'];this[_0x65f6('0x23')]=_0x1c9f5b[_0x65f6('0x23')];this['originatecalleridnum']='';this[_0x65f6('0x24')]='';}Action[_0x65f6('0x25')]['getCaller']=function(){return util[_0x65f6('0x26')](_0x65f6('0x27'),this[_0x65f6('0xb')],this['number']);};module['exports']=Action;