Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / services / ami / dialer / models / 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 _0x3b79=['UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','moment','isNil','string','voiceQueue','uniqueid','Contact','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId'];(function(_0x1e1b22,_0x46e58c){var _0xdb2f91=function(_0x538055){while(--_0x538055){_0x1e1b22['push'](_0x1e1b22['shift']());}};_0xdb2f91(++_0x46e58c);}(_0x3b79,0x162));var _0x93b7=function(_0x500105,_0x341501){_0x500105=_0x500105-0x0;var _0x5ed0ce=_0x3b79[_0x500105];return _0x5ed0ce;};'use strict';var util=require(_0x93b7('0x0'));var _=require('lodash');var moment=require(_0x93b7('0x1'));function checkNameSurname(_0x4a8c1a,_0x5a98ee,_0x2f9cbb){var _0x1671f6='';if(!_[_0x93b7('0x2')](_0x5a98ee)&&_0x93b7('0x3')===typeof _0x5a98ee){_0x1671f6+=_0x5a98ee;}if(!_[_0x93b7('0x2')](_0x2f9cbb)&&'string'===typeof _0x2f9cbb){_0x1671f6+='\x20'+_0x2f9cbb;}if(_0x1671f6!==''){return _0x1671f6;}return _0x4a8c1a;}function Action(_0x201280,_0x3d3a97,_0x158242){this[_0x93b7('0x4')]=_0x201280;this[_0x93b7('0x5')]=_0x158242||undefined;this['name']=checkNameSurname(_0x3d3a97[_0x93b7('0x6')]['phone'],_0x3d3a97['Contact']['firstName'],_0x3d3a97[_0x93b7('0x6')][_0x93b7('0x7')]);this[_0x93b7('0x8')]=_0x3d3a97['phone'];this[_0x93b7('0x9')]=_0x201280[_0x93b7('0xa')];this[_0x93b7('0xb')]=_0x3d3a97['active']||![];this['type']=_0x201280[_0x93b7('0xc')];this[_0x93b7('0xd')]=_0x201280[_0x93b7('0xd')]||0x3;this[_0x93b7('0xe')]=_0x3d3a97[_0x93b7('0xe')];this[_0x93b7('0xf')]=_0x3d3a97[_0x93b7('0xf')];this[_0x93b7('0x10')]=_0x3d3a97[_0x93b7('0x10')];this[_0x93b7('0x11')]=_0x3d3a97[_0x93b7('0x11')];this['countnosuchnumberretry']=_0x3d3a97[_0x93b7('0x12')];this['countdropretry']=_0x3d3a97['countdropretry'];this['countabandonedretry']=_0x3d3a97[_0x93b7('0x13')];this[_0x93b7('0x14')]=_0x3d3a97['countmachineretry'];this[_0x93b7('0x15')]=_0x3d3a97[_0x93b7('0x15')];this['ContactId']=_0x3d3a97[_0x93b7('0x16')];this['ListId']=_0x3d3a97[_0x93b7('0x17')];this[_0x93b7('0x18')]=_0x3d3a97['UserId'];this['VoiceQueueId']=_0x3d3a97[_0x93b7('0x19')];this['CampaignId']=_0x3d3a97[_0x93b7('0x1a')];this[_0x93b7('0x1b')]=_0x3d3a97['id'];this[_0x93b7('0x1c')]=_0x3d3a97[_0x93b7('0x6')][_0x93b7('0x1d')]||'';this['starttime']=moment()[_0x93b7('0x1e')](_0x93b7('0x1f'));this[_0x93b7('0x20')]=_0x3d3a97['callback'];this['callbackuniqueid']=_0x3d3a97['callbackuniqueid'];this[_0x93b7('0x21')]=_0x3d3a97[_0x93b7('0x21')];this[_0x93b7('0x22')]=_0x3d3a97[_0x93b7('0x22')];this['originatecalleridnum']='';this[_0x93b7('0x23')]='';}Action[_0x93b7('0x24')][_0x93b7('0x25')]=function(){return util[_0x93b7('0x1e')](_0x93b7('0x26'),this[_0x93b7('0xa')],this[_0x93b7('0x4')][_0x93b7('0x27')]>0x0?this['number'][_0x93b7('0x28')](this['voiceQueue'][_0x93b7('0x27')]):this['number']);};Action[_0x93b7('0x24')]['getQueue']=function(){return this['queue'];};module[_0x93b7('0x29')]=Action;