Built motion from commit 19a84241.|2.5.34
[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 _0x9c40=['util','isNil','string','uniqueid','Contact','phone','lastName','number','queue','name','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','callback','callbackuniqueid','recallme','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','prototype','exports'];(function(_0x339a06,_0x12ac35){var _0x5745d5=function(_0x3e0b74){while(--_0x3e0b74){_0x339a06['push'](_0x339a06['shift']());}};_0x5745d5(++_0x12ac35);}(_0x9c40,0x148));var _0x09c4=function(_0x57a1e3,_0x1d748c){_0x57a1e3=_0x57a1e3-0x0;var _0x3ba9b4=_0x9c40[_0x57a1e3];return _0x3ba9b4;};'use strict';var util=require(_0x09c4('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x198233,_0x3b21ea,_0x4ad27f){var _0x257fc9='';if(!_[_0x09c4('0x1')](_0x3b21ea)&&_0x09c4('0x2')===typeof _0x3b21ea){_0x257fc9+=_0x3b21ea;}if(!_[_0x09c4('0x1')](_0x4ad27f)&&_0x09c4('0x2')===typeof _0x4ad27f){_0x257fc9+='\x20'+_0x4ad27f;}if(_0x257fc9!==''){return _0x257fc9;}return _0x198233;}function Action(_0x595f62,_0x10d6f2,_0x129ab1){this['voiceQueue']=_0x595f62;this[_0x09c4('0x3')]=_0x129ab1||undefined;this['name']=checkNameSurname(_0x10d6f2[_0x09c4('0x4')][_0x09c4('0x5')],_0x10d6f2[_0x09c4('0x4')]['firstName'],_0x10d6f2[_0x09c4('0x4')][_0x09c4('0x6')]);this[_0x09c4('0x7')]=_0x10d6f2[_0x09c4('0x4')][_0x09c4('0x5')];this[_0x09c4('0x8')]=_0x595f62[_0x09c4('0x9')];this[_0x09c4('0xa')]=_0x10d6f2['active']||![];this['type']=_0x595f62[_0x09c4('0xb')];this['dialQueueTimeout']=_0x595f62[_0x09c4('0xc')]||0x3;this['scheduledat']=_0x10d6f2['scheduledat'];this[_0x09c4('0xd')]=_0x10d6f2[_0x09c4('0xd')];this[_0x09c4('0xe')]=_0x10d6f2['countcongestionretry'];this['countnoanswerretry']=_0x10d6f2[_0x09c4('0xf')];this[_0x09c4('0x10')]=_0x10d6f2[_0x09c4('0x10')];this[_0x09c4('0x11')]=_0x10d6f2[_0x09c4('0x11')];this['countabandonedretry']=_0x10d6f2[_0x09c4('0x12')];this[_0x09c4('0x13')]=_0x10d6f2['countmachineretry'];this[_0x09c4('0x14')]=_0x10d6f2[_0x09c4('0x14')];this[_0x09c4('0x15')]=_0x10d6f2[_0x09c4('0x15')];this[_0x09c4('0x16')]=_0x10d6f2[_0x09c4('0x16')];this[_0x09c4('0x17')]=_0x10d6f2[_0x09c4('0x17')];this['VoiceQueueId']=_0x10d6f2[_0x09c4('0x18')];this[_0x09c4('0x19')]=_0x10d6f2['CampaignId'];this[_0x09c4('0x1a')]=_0x10d6f2['id'];this[_0x09c4('0x1b')]=_0x10d6f2['Contact'][_0x09c4('0x1c')]||'';this[_0x09c4('0x1d')]=moment()[_0x09c4('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x09c4('0x1f')]=_0x10d6f2['callback'];this[_0x09c4('0x20')]=_0x10d6f2[_0x09c4('0x20')];this['callbackat']=_0x10d6f2['callbackat'];this[_0x09c4('0x21')]=_0x10d6f2[_0x09c4('0x21')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0x09c4('0x22')]=function(){return util[_0x09c4('0x1e')](_0x09c4('0x23'),this[_0x09c4('0x9')],this[_0x09c4('0x24')][_0x09c4('0x25')]>0x0?this[_0x09c4('0x7')][_0x09c4('0x26')](this[_0x09c4('0x24')]['dialCutDigit']):this['number']);};Action[_0x09c4('0x27')]['getQueue']=function(){return this[_0x09c4('0x8')];};module[_0x09c4('0x28')]=Action;