55cb3ded61b4b803d570c6f10fc702de92f84cba
[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 _0xee4f=['phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','substring','voiceQueue','dialCutDigit','number','getQueue','exports','util','isNil','uniqueid','name','Contact','firstName','lastName'];(function(_0x4c6087,_0x45f9fb){var _0x84bc54=function(_0x37a020){while(--_0x37a020){_0x4c6087['push'](_0x4c6087['shift']());}};_0x84bc54(++_0x45f9fb);}(_0xee4f,0xad));var _0xfee4=function(_0xefd3bb,_0x191e55){_0xefd3bb=_0xefd3bb-0x0;var _0x4284d1=_0xee4f[_0xefd3bb];return _0x4284d1;};'use strict';var util=require(_0xfee4('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x2afb7d,_0x41b170,_0xf1acd6){var _0x5a03c9='';if(!_[_0xfee4('0x1')](_0x41b170)&&'string'===typeof _0x41b170){_0x5a03c9+=_0x41b170;}if(!_[_0xfee4('0x1')](_0xf1acd6)&&'string'===typeof _0xf1acd6){_0x5a03c9+='\x20'+_0xf1acd6;}if(_0x5a03c9!==''){return _0x5a03c9;}return _0x2afb7d;}function Action(_0x4da9b6,_0x1c39b1,_0x498647){this['voiceQueue']=_0x4da9b6;this[_0xfee4('0x2')]=_0x498647||undefined;this[_0xfee4('0x3')]=checkNameSurname(_0x1c39b1[_0xfee4('0x4')]['phone'],_0x1c39b1['Contact'][_0xfee4('0x5')],_0x1c39b1[_0xfee4('0x4')][_0xfee4('0x6')]);this['number']=_0x1c39b1['Contact'][_0xfee4('0x7')];this[_0xfee4('0x8')]=_0x4da9b6[_0xfee4('0x3')];this['active']=_0x1c39b1[_0xfee4('0x9')]||![];this[_0xfee4('0xa')]=_0x4da9b6[_0xfee4('0xa')];this[_0xfee4('0xb')]=_0x4da9b6[_0xfee4('0xb')]||0x3;this[_0xfee4('0xc')]=_0x1c39b1[_0xfee4('0xc')];this['countbusyretry']=_0x1c39b1[_0xfee4('0xd')];this[_0xfee4('0xe')]=_0x1c39b1['countcongestionretry'];this[_0xfee4('0xf')]=_0x1c39b1[_0xfee4('0xf')];this[_0xfee4('0x10')]=_0x1c39b1[_0xfee4('0x10')];this[_0xfee4('0x11')]=_0x1c39b1[_0xfee4('0x11')];this[_0xfee4('0x12')]=_0x1c39b1['countabandonedretry'];this[_0xfee4('0x13')]=_0x1c39b1[_0xfee4('0x13')];this[_0xfee4('0x14')]=_0x1c39b1['countagentrejectretry'];this[_0xfee4('0x15')]=_0x1c39b1['ContactId'];this['ListId']=_0x1c39b1[_0xfee4('0x16')];this[_0xfee4('0x17')]=_0x1c39b1[_0xfee4('0x17')];this[_0xfee4('0x18')]=_0x1c39b1[_0xfee4('0x18')];this[_0xfee4('0x19')]=_0x1c39b1[_0xfee4('0x19')];this[_0xfee4('0x1a')]=_0x1c39b1['id'];this[_0xfee4('0x1b')]=_0x1c39b1['Contact'][_0xfee4('0x5')]||'';this[_0xfee4('0x1c')]=moment()[_0xfee4('0x1d')](_0xfee4('0x1e'));this[_0xfee4('0x1f')]=_0x1c39b1[_0xfee4('0x1f')];this['callbackuniqueid']=_0x1c39b1[_0xfee4('0x20')];this[_0xfee4('0x21')]=_0x1c39b1[_0xfee4('0x21')];this[_0xfee4('0x22')]=_0x1c39b1[_0xfee4('0x22')];this[_0xfee4('0x23')]='';this[_0xfee4('0x24')]='';}Action[_0xfee4('0x25')][_0xfee4('0x26')]=function(){return util[_0xfee4('0x1d')]('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue']['dialCutDigit']>0x0?this['number'][_0xfee4('0x27')](this[_0xfee4('0x28')][_0xfee4('0x29')]):this[_0xfee4('0x2a')]);};Action[_0xfee4('0x25')][_0xfee4('0x2b')]=function(){return this[_0xfee4('0x8')];};module[_0xfee4('0x2c')]=Action;