Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / cmContact / cmContact.model.js
index baee38e..72de88a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbcc3=['error','cmContact','CmHopper','findOne','then','isNil','cmContact,\x20afterCreate\x20','create','phone','ListId','priority','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','afterCreate','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','Lists','length','get','dialCheckDuplicateType','always','CmList','BlackLists','CmHopperBlack','Campaign','onlyIfOpen','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','VoiceQueueId','all','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmContact.attributes','exports','define','CmContact','cm_contacts','models'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbcc3,0x113));var _0x3bcc=function(_0x5e608c,_0x453591){_0x5e608c=_0x5e608c-0x0;var _0x44d7fc=_0xbcc3[_0x5e608c];return _0x44d7fc;};'use strict';var _=require(_0x3bcc('0x0'));var util=require(_0x3bcc('0x1'));var logger=require(_0x3bcc('0x2'))(_0x3bcc('0x3'));var moment=require(_0x3bcc('0x4'));var BPromise=require(_0x3bcc('0x5'));var rp=require(_0x3bcc('0x6'));var fs=require('fs');var path=require(_0x3bcc('0x7'));var rimraf=require(_0x3bcc('0x8'));var config=require('../../config/environment');var attributes=require(_0x3bcc('0x9'));module[_0x3bcc('0xa')]=function(_0x54715b,_0x6a86c1){return _0x54715b[_0x3bcc('0xb')](_0x3bcc('0xc'),attributes,{'tableName':_0x3bcc('0xd'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f08ff,_0x4eccdc,_0x18ff72){var _0x85dc98=_0x54715b[_0x3bcc('0xe')];var _0x418643=_0x4f08ff['get']({'plain':!![]});function _0x1672a0(){return function(_0x3153a8){logger[_0x3bcc('0xf')](_0x3bcc('0x10'),'afterCreate',util['inspect'](_0x3153a8,{'showHidden':![],'depth':null}));};}var _0xe85344=function(_0x5e39d0){return new BPromise(function(_0x4a5cd4,_0x1498f5){_0x85dc98[_0x3bcc('0x11')][_0x3bcc('0x12')]({'where':{'phone':_0x418643['phone'],'VoiceQueueId':_0x5e39d0['id']}})[_0x3bcc('0x13')](function(_0x48052e){if(!_[_0x3bcc('0x14')](_0x48052e)){throw new Error(_0x3bcc('0x15')+_0x418643['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5e39d0['id']);}return _0x85dc98[_0x3bcc('0x11')][_0x3bcc('0x16')]({'phone':_0x418643[_0x3bcc('0x17')],'ContactId':_0x418643['id'],'ListId':_0x418643[_0x3bcc('0x18')],'priority':_0x418643['priority']?_0x418643[_0x3bcc('0x19')]:0x2,'scheduledat':_0x418643[_0x3bcc('0x1a')]?_0x418643[_0x3bcc('0x1a')]:moment()[_0x3bcc('0x1b')](_0x3bcc('0x1c')),'callback':_0x418643['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x418643[_0x3bcc('0x1d')]?_0x418643['callbackUniqueid']:undefined,'callbackat':_0x418643[_0x3bcc('0x1d')]?moment()[_0x3bcc('0x1b')](_0x3bcc('0x1c')):undefined,'VoiceQueueId':_0x5e39d0['id']});})[_0x3bcc('0x1e')](function(_0x4117ee){_0x1498f5(_0x4117ee);});});};var _0x27ff8f=function(_0xddded5){return new BPromise(function(_0x5041a6,_0x318a5c){_0x85dc98[_0x3bcc('0x11')][_0x3bcc('0x12')]({'where':{'phone':_0x418643['phone'],'VoiceQueueId':_0xddded5['id']}})[_0x3bcc('0x13')](function(_0x25ea4f){if(!_[_0x3bcc('0x14')](_0x25ea4f)){throw new Error('cmContact,\x20afterCreate\x20'+_0x418643['phone']+_0x3bcc('0x1f')+_0xddded5['id']);}return _0x85dc98[_0x3bcc('0x20')][_0x3bcc('0x12')]({'where':{'calleridnum':_0x418643['phone'],'VoiceQueueId':_0xddded5['id']}});})[_0x3bcc('0x13')](function(_0x48f087){if(!_[_0x3bcc('0x14')](_0x48f087)){throw new Error(_0x3bcc('0x21')+_0x418643[_0x3bcc('0x17')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0xddded5['id']);}return _0x85dc98[_0x3bcc('0x11')][_0x3bcc('0x16')]({'phone':_0x418643['phone'],'ContactId':_0x418643['id'],'ListId':_0x418643[_0x3bcc('0x18')],'priority':_0x418643[_0x3bcc('0x19')]?_0x418643[_0x3bcc('0x19')]:0x2,'scheduledat':_0x418643['scheduledat']?_0x418643[_0x3bcc('0x1a')]:moment()[_0x3bcc('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x418643[_0x3bcc('0x1d')]?!![]:![],'callbackuniqueid':_0x418643[_0x3bcc('0x1d')]?_0x418643[_0x3bcc('0x1d')]:undefined,'callbackat':_0x418643[_0x3bcc('0x1d')]?moment()[_0x3bcc('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xddded5['id']});})[_0x3bcc('0x1e')](function(_0x48c365){_0x318a5c(_0x48c365);});});};function _0x564177(){return function(_0x20b0f6){logger[_0x3bcc('0xf')]('cmContact',_0x3bcc('0x22'),util['inspect'](_0x20b0f6,{'showHidden':![],'depth':null}));};}var _0x205a05=function(_0x25867d){return new BPromise(function(_0x36708a,_0x3d93dd){_0x85dc98[_0x3bcc('0x11')]['findOne']({'where':{'phone':_0x418643['phone'],'CampaignId':_0x25867d['id']}})[_0x3bcc('0x13')](function(_0x55e274){if(!_[_0x3bcc('0x14')](_0x55e274)){throw new Error(_0x3bcc('0x15')+_0x418643[_0x3bcc('0x17')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x25867d['id']);}return _0x85dc98[_0x3bcc('0x11')][_0x3bcc('0x16')]({'phone':_0x418643[_0x3bcc('0x17')],'ContactId':_0x418643['id'],'ListId':_0x418643['ListId'],'priority':_0x418643['priority']?_0x418643[_0x3bcc('0x19')]:0x2,'scheduledat':_0x418643[_0x3bcc('0x1a')]?_0x418643[_0x3bcc('0x1a')]:moment()[_0x3bcc('0x1b')](_0x3bcc('0x1c')),'callback':_0x418643[_0x3bcc('0x1d')]?!![]:![],'callbackuniqueid':_0x418643[_0x3bcc('0x1d')]?_0x418643[_0x3bcc('0x1d')]:undefined,'callbackat':_0x418643['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x25867d['id']});})[_0x3bcc('0x1e')](function(_0x53b010){_0x3d93dd(_0x53b010);});});};var _0x3a53c7=function(_0x3cf52e){return new BPromise(function(_0x24bc4e,_0x207fb2){_0x85dc98[_0x3bcc('0x11')][_0x3bcc('0x12')]({'where':{'phone':_0x418643[_0x3bcc('0x17')],'CampaignId':_0x3cf52e['id']}})[_0x3bcc('0x13')](function(_0x292012){if(!_['isNil'](_0x292012)){throw new Error(_0x3bcc('0x15')+_0x418643[_0x3bcc('0x17')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x3cf52e['id']);}return _0x85dc98[_0x3bcc('0x20')]['findOne']({'where':{'calleridnum':_0x418643[_0x3bcc('0x17')],'CampaignId':_0x3cf52e['id']}});})['then'](function(_0x5bff6e){if(!_[_0x3bcc('0x14')](_0x5bff6e)){throw new Error(_0x3bcc('0x21')+_0x418643[_0x3bcc('0x17')]+_0x3bcc('0x23')+_0x3cf52e['id']);}return _0x85dc98['CmHopper'][_0x3bcc('0x16')]({'phone':_0x418643[_0x3bcc('0x17')],'ContactId':_0x418643['id'],'ListId':_0x418643[_0x3bcc('0x18')],'priority':_0x418643[_0x3bcc('0x19')]?_0x418643[_0x3bcc('0x19')]:0x2,'scheduledat':_0x418643['scheduledat']?_0x418643[_0x3bcc('0x1a')]:moment()[_0x3bcc('0x1b')](_0x3bcc('0x1c')),'callback':_0x418643[_0x3bcc('0x1d')]?!![]:![],'callbackuniqueid':_0x418643['callbackUniqueid']?_0x418643[_0x3bcc('0x1d')]:undefined,'callbackat':_0x418643[_0x3bcc('0x1d')]?moment()['format'](_0x3bcc('0x1c')):undefined,'CampaignId':_0x3cf52e['id']});})[_0x3bcc('0x1e')](function(_0x35958b){_0x207fb2(_0x35958b);});});};if(_0x418643['ListId']){_0x85dc98[_0x3bcc('0x24')][_0x3bcc('0x25')]({'where':{'type':_0x3bcc('0x26')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x85dc98['CmList'],'as':_0x3bcc('0x27'),'where':{'id':_0x418643[_0x3bcc('0x18')]}}]})['then'](function(_0x41402e){if(_0x41402e){var _0x1320f6=[];for(var _0x65d259=0x0,_0x74b495;_0x65d259<_0x41402e[_0x3bcc('0x28')];_0x65d259+=0x1){_0x74b495=_0x41402e[_0x65d259][_0x3bcc('0x29')]({'plain':!![]});switch(_0x74b495[_0x3bcc('0x2a')]){case _0x3bcc('0x2b'):_0x27ff8f(_0x74b495)['catch'](_0x1672a0());break;case'onlyIfOpen':_0xe85344(_0x74b495)['catch'](_0x1672a0());break;default:_0x85dc98[_0x3bcc('0x11')][_0x3bcc('0x16')]({'phone':_0x418643[_0x3bcc('0x17')],'ContactId':_0x418643['id'],'ListId':_0x418643[_0x3bcc('0x18')],'scheduledat':_0x418643[_0x3bcc('0x1a')]?_0x418643[_0x3bcc('0x1a')]:moment()[_0x3bcc('0x1b')](_0x3bcc('0x1c')),'priority':_0x418643[_0x3bcc('0x19')]?_0x418643[_0x3bcc('0x19')]:0x2,'callback':_0x418643[_0x3bcc('0x1d')]?!![]:![],'callbackuniqueid':_0x418643[_0x3bcc('0x1d')]?_0x418643[_0x3bcc('0x1d')]:undefined,'callbackat':_0x418643[_0x3bcc('0x1d')]?moment()[_0x3bcc('0x1b')](_0x3bcc('0x1c')):undefined,'VoiceQueueId':_0x74b495['id']})[_0x3bcc('0x1e')](_0x1672a0());}}}})[_0x3bcc('0x13')](function(){return _0x85dc98['VoiceQueue']['findAll']({'where':{'type':_0x3bcc('0x26')},'attributes':['id'],'include':[{'model':_0x85dc98[_0x3bcc('0x2c')],'as':_0x3bcc('0x2d'),'where':{'id':_0x418643[_0x3bcc('0x18')]}}]})[_0x3bcc('0x13')](function(_0x17101b){if(_0x17101b){var _0x36b141=[];for(var _0x28ed09=0x0,_0x5dcc5e;_0x28ed09<_0x17101b[_0x3bcc('0x28')];_0x28ed09+=0x1){_0x5dcc5e=_0x17101b[_0x28ed09]['get']({'plain':!![]});_0x85dc98[_0x3bcc('0x2e')][_0x3bcc('0x16')]({'phone':_0x418643['phone'],'ContactId':_0x418643['id'],'ListId':_0x418643[_0x3bcc('0x18')],'VoiceQueueId':_0x5dcc5e['id']})['catch'](function(_0x17bf6f){logger[_0x3bcc('0xf')]('cmContact,\x20%s,\x20%s',_0x3bcc('0x22'),_0x17bf6f['message']);});}}});})['then'](function(){return _0x85dc98[_0x3bcc('0x2f')][_0x3bcc('0x25')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x85dc98[_0x3bcc('0x2c')],'as':'Lists','where':{'id':_0x418643['ListId']}}]})[_0x3bcc('0x13')](function(_0x5b9e32){if(_0x5b9e32){var _0x36561f=[];for(var _0x1a6f1f=0x0,_0x2963f4;_0x1a6f1f<_0x5b9e32[_0x3bcc('0x28')];_0x1a6f1f+=0x1){_0x2963f4=_0x5b9e32[_0x1a6f1f][_0x3bcc('0x29')]({'plain':!![]});switch(_0x2963f4['dialCheckDuplicateType']){case'always':_0x3a53c7(_0x2963f4)['catch'](_0x564177());break;case _0x3bcc('0x30'):_0x205a05(_0x2963f4)[_0x3bcc('0x1e')](_0x564177());break;default:_0x85dc98[_0x3bcc('0x11')][_0x3bcc('0x16')]({'phone':_0x418643['phone'],'ContactId':_0x418643['id'],'ListId':_0x418643['ListId'],'scheduledat':_0x418643['scheduledat']?_0x418643[_0x3bcc('0x1a')]:moment()['format'](_0x3bcc('0x1c')),'priority':_0x418643[_0x3bcc('0x19')]?_0x418643[_0x3bcc('0x19')]:0x2,'callback':_0x418643[_0x3bcc('0x1d')]?!![]:![],'callbackuniqueid':_0x418643[_0x3bcc('0x1d')]?_0x418643[_0x3bcc('0x1d')]:undefined,'callbackat':_0x418643[_0x3bcc('0x1d')]?moment()[_0x3bcc('0x1b')](_0x3bcc('0x1c')):undefined,'CampaignId':_0x2963f4['id']})['catch'](_0x564177());}}}});})[_0x3bcc('0x13')](function(){return _0x85dc98[_0x3bcc('0x2f')][_0x3bcc('0x25')]({'attributes':['id'],'include':[{'model':_0x85dc98[_0x3bcc('0x2c')],'as':_0x3bcc('0x2d'),'where':{'id':_0x418643[_0x3bcc('0x18')]}}]})['then'](function(_0x18a5b9){if(_0x18a5b9){var _0xaa2d8b=[];for(var _0x2c9192=0x0,_0x581e5a;_0x2c9192<_0x18a5b9[_0x3bcc('0x28')];_0x2c9192+=0x1){_0x581e5a=_0x18a5b9[_0x2c9192][_0x3bcc('0x29')]({'plain':!![]});_0x85dc98[_0x3bcc('0x2e')][_0x3bcc('0x16')]({'phone':_0x418643[_0x3bcc('0x17')],'ContactId':_0x418643['id'],'ListId':_0x418643[_0x3bcc('0x18')],'CampaignId':_0x581e5a['id']})[_0x3bcc('0x1e')](function(_0x168ed7){logger[_0x3bcc('0xf')](_0x3bcc('0x31'),_0x3bcc('0x22'),_0x168ed7['message']);});}}});})[_0x3bcc('0x13')](function(){_0x18ff72();})['catch'](function(_0x3fbe48){logger[_0x3bcc('0xf')](_0x3bcc('0x31'),'afterCreate',_0x3fbe48[_0x3bcc('0x32')]);_0x18ff72(_0x3fbe48);});}else{_0x18ff72(new Error(_0x3bcc('0x33')));}},'afterDestroy':function(_0x2d4669,_0x6dcc3d,_0x31a909){var _0x5f4781=_0x54715b[_0x3bcc('0xe')];var _0x1cd8d5=_0x2d4669['get']({'plain':!![]});return _0x5f4781[_0x3bcc('0x11')]['findAll']({'raw':!![],'where':{'ListId':_0x1cd8d5[_0x3bcc('0x18')],'ContactId':_0x1cd8d5['id']}})[_0x3bcc('0x13')](function(_0x12ad83){if(!_[_0x3bcc('0x34')](_0x12ad83)){var _0xbb957c=[];for(var _0x3abe0a=0x0;_0x3abe0a<_0x12ad83['length'];_0x3abe0a+=0x1){var _0x55fa6e=_0x5f4781[_0x3bcc('0x11')][_0x3bcc('0x35')]({'where':{'ListId':_0x12ad83[_0x3abe0a][_0x3bcc('0x18')],'ContactId':_0x12ad83[_0x3abe0a]['ContactId'],'VoiceQueueId':_0x12ad83[_0x3abe0a][_0x3bcc('0x36')],'CampaignId':_0x12ad83[_0x3abe0a]['CampaignId']}});_0xbb957c['push'](_0x55fa6e);}return BPromise[_0x3bcc('0x37')](_0xbb957c);}})[_0x3bcc('0x13')](function(_0x3d1f86){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x3bcc('0x38')](_0x3d1f86,{'showHidden':![],'depth':null}));_0x31a909();})[_0x3bcc('0x1e')](function(_0x546e52){logger[_0x3bcc('0xf')](_0x3bcc('0x39'),util['inspect'](_0x546e52,{'showHidden':![],'depth':null}));_0x31a909(_0x546e52);});}}});};
\ No newline at end of file
+var _0xb907=['List\x20not\x20found','destroy','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmContact','cm_contacts','phone','models','get','error','cmContact','inspect','CmHopper','then','isNil','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','findOne','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','afterCreate','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','always','onlyIfOpen','BlackLists','length','cmContact,\x20%s,\x20%s','message','Campaign','Lists'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb907,0x12a));var _0x7b90=function(_0x43c48,_0x274fb1){_0x43c48=_0x43c48-0x0;var _0x48a524=_0xb907[_0x43c48];return _0x48a524;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7b90('0x0'));var BPromise=require(_0x7b90('0x1'));var rp=require(_0x7b90('0x2'));var fs=require('fs');var path=require(_0x7b90('0x3'));var rimraf=require('rimraf');var config=require(_0x7b90('0x4'));var attributes=require('./cmContact.attributes');module[_0x7b90('0x5')]=function(_0x4f4cf,_0x232c54){return _0x4f4cf[_0x7b90('0x6')](_0x7b90('0x7'),attributes,{'tableName':_0x7b90('0x8'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x7b90('0x9')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56251d,_0x5e87fe,_0x2ab83f){var _0x1bf0f1=_0x4f4cf[_0x7b90('0xa')];var _0x1b8eaf=_0x56251d[_0x7b90('0xb')]({'plain':!![]});function _0x454f7e(){return function(_0x205078){logger[_0x7b90('0xc')](_0x7b90('0xd'),'afterCreate',util[_0x7b90('0xe')](_0x205078,{'showHidden':![],'depth':null}));};}var _0x3f7dad=function(_0x3fafc3){return new BPromise(function(_0x992904,_0x4663ca){_0x1bf0f1[_0x7b90('0xf')]['findOne']({'where':{'phone':_0x1b8eaf[_0x7b90('0x9')],'VoiceQueueId':_0x3fafc3['id']}})[_0x7b90('0x10')](function(_0x44e7e6){if(!_[_0x7b90('0x11')](_0x44e7e6)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1b8eaf[_0x7b90('0x9')]+_0x7b90('0x12')+_0x3fafc3['id']);}return _0x1bf0f1[_0x7b90('0xf')][_0x7b90('0x13')]({'phone':_0x1b8eaf[_0x7b90('0x9')],'ContactId':_0x1b8eaf['id'],'ListId':_0x1b8eaf[_0x7b90('0x14')],'priority':_0x1b8eaf[_0x7b90('0x15')]?_0x1b8eaf[_0x7b90('0x15')]:0x2,'scheduledat':_0x1b8eaf[_0x7b90('0x16')]?_0x1b8eaf['scheduledat']:moment()[_0x7b90('0x17')](_0x7b90('0x18')),'callback':_0x1b8eaf[_0x7b90('0x19')]?!![]:![],'callbackuniqueid':_0x1b8eaf[_0x7b90('0x19')]?_0x1b8eaf[_0x7b90('0x19')]:undefined,'callbackat':_0x1b8eaf['callbackUniqueid']?moment()['format'](_0x7b90('0x18')):undefined,'VoiceQueueId':_0x3fafc3['id']});})[_0x7b90('0x1a')](function(_0x7d57d9){_0x4663ca(_0x7d57d9);});});};var _0x3bb728=function(_0x2e4acb){return new BPromise(function(_0x5cc4f4,_0x564992){_0x1bf0f1['CmHopper']['findOne']({'where':{'phone':_0x1b8eaf['phone'],'VoiceQueueId':_0x2e4acb['id']}})[_0x7b90('0x10')](function(_0x4f6727){if(!_[_0x7b90('0x11')](_0x4f6727)){throw new Error(_0x7b90('0x1b')+_0x1b8eaf['phone']+_0x7b90('0x1c')+_0x2e4acb['id']);}return _0x1bf0f1[_0x7b90('0x1d')][_0x7b90('0x1e')]({'where':{'calleridnum':_0x1b8eaf[_0x7b90('0x9')],'VoiceQueueId':_0x2e4acb['id']}});})['then'](function(_0xbb193d){if(!_[_0x7b90('0x11')](_0xbb193d)){throw new Error(_0x7b90('0x1f')+_0x1b8eaf[_0x7b90('0x9')]+_0x7b90('0x20')+_0x2e4acb['id']);}return _0x1bf0f1[_0x7b90('0xf')][_0x7b90('0x13')]({'phone':_0x1b8eaf['phone'],'ContactId':_0x1b8eaf['id'],'ListId':_0x1b8eaf['ListId'],'priority':_0x1b8eaf[_0x7b90('0x15')]?_0x1b8eaf[_0x7b90('0x15')]:0x2,'scheduledat':_0x1b8eaf[_0x7b90('0x16')]?_0x1b8eaf['scheduledat']:moment()['format'](_0x7b90('0x18')),'callback':_0x1b8eaf[_0x7b90('0x19')]?!![]:![],'callbackuniqueid':_0x1b8eaf[_0x7b90('0x19')]?_0x1b8eaf[_0x7b90('0x19')]:undefined,'callbackat':_0x1b8eaf[_0x7b90('0x19')]?moment()[_0x7b90('0x17')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2e4acb['id']});})[_0x7b90('0x1a')](function(_0x3a345a){_0x564992(_0x3a345a);});});};function _0x3ecba0(){return function(_0x48a08c){logger[_0x7b90('0xc')](_0x7b90('0xd'),_0x7b90('0x21'),util[_0x7b90('0xe')](_0x48a08c,{'showHidden':![],'depth':null}));};}var _0x44fb02=function(_0x27ac5a){return new BPromise(function(_0x3a1b92,_0x1c8208){_0x1bf0f1[_0x7b90('0xf')][_0x7b90('0x1e')]({'where':{'phone':_0x1b8eaf['phone'],'CampaignId':_0x27ac5a['id']}})[_0x7b90('0x10')](function(_0x4ab1ee){if(!_['isNil'](_0x4ab1ee)){throw new Error(_0x7b90('0x1b')+_0x1b8eaf['phone']+_0x7b90('0x22')+_0x27ac5a['id']);}return _0x1bf0f1[_0x7b90('0xf')][_0x7b90('0x13')]({'phone':_0x1b8eaf['phone'],'ContactId':_0x1b8eaf['id'],'ListId':_0x1b8eaf[_0x7b90('0x14')],'priority':_0x1b8eaf['priority']?_0x1b8eaf[_0x7b90('0x15')]:0x2,'scheduledat':_0x1b8eaf[_0x7b90('0x16')]?_0x1b8eaf[_0x7b90('0x16')]:moment()[_0x7b90('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1b8eaf[_0x7b90('0x19')]?!![]:![],'callbackuniqueid':_0x1b8eaf[_0x7b90('0x19')]?_0x1b8eaf[_0x7b90('0x19')]:undefined,'callbackat':_0x1b8eaf['callbackUniqueid']?moment()[_0x7b90('0x17')](_0x7b90('0x18')):undefined,'CampaignId':_0x27ac5a['id']});})[_0x7b90('0x1a')](function(_0x4b9e1d){_0x1c8208(_0x4b9e1d);});});};var _0x11ee3b=function(_0xc8e902){return new BPromise(function(_0x31511b,_0xab667d){_0x1bf0f1[_0x7b90('0xf')]['findOne']({'where':{'phone':_0x1b8eaf['phone'],'CampaignId':_0xc8e902['id']}})['then'](function(_0x40a9a7){if(!_[_0x7b90('0x11')](_0x40a9a7)){throw new Error(_0x7b90('0x1b')+_0x1b8eaf[_0x7b90('0x9')]+_0x7b90('0x23')+_0xc8e902['id']);}return _0x1bf0f1[_0x7b90('0x1d')][_0x7b90('0x1e')]({'where':{'calleridnum':_0x1b8eaf['phone'],'CampaignId':_0xc8e902['id']}});})[_0x7b90('0x10')](function(_0x568d20){if(!_[_0x7b90('0x11')](_0x568d20)){throw new Error(_0x7b90('0x1f')+_0x1b8eaf['phone']+_0x7b90('0x24')+_0xc8e902['id']);}return _0x1bf0f1[_0x7b90('0xf')][_0x7b90('0x13')]({'phone':_0x1b8eaf['phone'],'ContactId':_0x1b8eaf['id'],'ListId':_0x1b8eaf[_0x7b90('0x14')],'priority':_0x1b8eaf['priority']?_0x1b8eaf['priority']:0x2,'scheduledat':_0x1b8eaf[_0x7b90('0x16')]?_0x1b8eaf[_0x7b90('0x16')]:moment()[_0x7b90('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1b8eaf[_0x7b90('0x19')]?!![]:![],'callbackuniqueid':_0x1b8eaf[_0x7b90('0x19')]?_0x1b8eaf[_0x7b90('0x19')]:undefined,'callbackat':_0x1b8eaf[_0x7b90('0x19')]?moment()[_0x7b90('0x17')](_0x7b90('0x18')):undefined,'CampaignId':_0xc8e902['id']});})[_0x7b90('0x1a')](function(_0x282fa7){_0xab667d(_0x282fa7);});});};if(_0x1b8eaf[_0x7b90('0x14')]){_0x1bf0f1[_0x7b90('0x25')][_0x7b90('0x26')]({'where':{'type':_0x7b90('0x27')},'attributes':['id',_0x7b90('0x28')],'include':[{'model':_0x1bf0f1[_0x7b90('0x29')],'as':'Lists','where':{'id':_0x1b8eaf[_0x7b90('0x14')]}}]})['then'](function(_0x1d8c6d){if(_0x1d8c6d){var _0x324ebb=[];for(var _0x2991f4=0x0,_0x3aabbe;_0x2991f4<_0x1d8c6d['length'];_0x2991f4+=0x1){_0x3aabbe=_0x1d8c6d[_0x2991f4][_0x7b90('0xb')]({'plain':!![]});switch(_0x3aabbe[_0x7b90('0x28')]){case _0x7b90('0x2a'):_0x3bb728(_0x3aabbe)[_0x7b90('0x1a')](_0x454f7e());break;case _0x7b90('0x2b'):_0x3f7dad(_0x3aabbe)[_0x7b90('0x1a')](_0x454f7e());break;default:_0x1bf0f1['CmHopper']['create']({'phone':_0x1b8eaf[_0x7b90('0x9')],'ContactId':_0x1b8eaf['id'],'ListId':_0x1b8eaf[_0x7b90('0x14')],'scheduledat':_0x1b8eaf[_0x7b90('0x16')]?_0x1b8eaf[_0x7b90('0x16')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1b8eaf[_0x7b90('0x15')]?_0x1b8eaf[_0x7b90('0x15')]:0x2,'callback':_0x1b8eaf['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1b8eaf[_0x7b90('0x19')]?_0x1b8eaf['callbackUniqueid']:undefined,'callbackat':_0x1b8eaf[_0x7b90('0x19')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x3aabbe['id']})[_0x7b90('0x1a')](_0x454f7e());}}}})[_0x7b90('0x10')](function(){return _0x1bf0f1['VoiceQueue'][_0x7b90('0x26')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x1bf0f1[_0x7b90('0x29')],'as':_0x7b90('0x2c'),'where':{'id':_0x1b8eaf[_0x7b90('0x14')]}}]})['then'](function(_0x213bb8){if(_0x213bb8){var _0x1186bc=[];for(var _0x596968=0x0,_0x4d8ef9;_0x596968<_0x213bb8[_0x7b90('0x2d')];_0x596968+=0x1){_0x4d8ef9=_0x213bb8[_0x596968]['get']({'plain':!![]});_0x1bf0f1['CmHopperBlack'][_0x7b90('0x13')]({'phone':_0x1b8eaf[_0x7b90('0x9')],'ContactId':_0x1b8eaf['id'],'ListId':_0x1b8eaf[_0x7b90('0x14')],'VoiceQueueId':_0x4d8ef9['id']})[_0x7b90('0x1a')](function(_0x394de0){logger[_0x7b90('0xc')](_0x7b90('0x2e'),_0x7b90('0x21'),_0x394de0[_0x7b90('0x2f')]);});}}});})['then'](function(){return _0x1bf0f1[_0x7b90('0x30')][_0x7b90('0x26')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x1bf0f1[_0x7b90('0x29')],'as':_0x7b90('0x31'),'where':{'id':_0x1b8eaf[_0x7b90('0x14')]}}]})[_0x7b90('0x10')](function(_0x5a3696){if(_0x5a3696){var _0x74a641=[];for(var _0x4f0cf8=0x0,_0x47bfd2;_0x4f0cf8<_0x5a3696[_0x7b90('0x2d')];_0x4f0cf8+=0x1){_0x47bfd2=_0x5a3696[_0x4f0cf8][_0x7b90('0xb')]({'plain':!![]});switch(_0x47bfd2[_0x7b90('0x28')]){case _0x7b90('0x2a'):_0x11ee3b(_0x47bfd2)['catch'](_0x3ecba0());break;case _0x7b90('0x2b'):_0x44fb02(_0x47bfd2)['catch'](_0x3ecba0());break;default:_0x1bf0f1[_0x7b90('0xf')]['create']({'phone':_0x1b8eaf[_0x7b90('0x9')],'ContactId':_0x1b8eaf['id'],'ListId':_0x1b8eaf[_0x7b90('0x14')],'scheduledat':_0x1b8eaf[_0x7b90('0x16')]?_0x1b8eaf['scheduledat']:moment()[_0x7b90('0x17')](_0x7b90('0x18')),'priority':_0x1b8eaf[_0x7b90('0x15')]?_0x1b8eaf['priority']:0x2,'callback':_0x1b8eaf[_0x7b90('0x19')]?!![]:![],'callbackuniqueid':_0x1b8eaf[_0x7b90('0x19')]?_0x1b8eaf['callbackUniqueid']:undefined,'callbackat':_0x1b8eaf[_0x7b90('0x19')]?moment()['format'](_0x7b90('0x18')):undefined,'CampaignId':_0x47bfd2['id']})['catch'](_0x3ecba0());}}}});})[_0x7b90('0x10')](function(){return _0x1bf0f1[_0x7b90('0x30')][_0x7b90('0x26')]({'attributes':['id'],'include':[{'model':_0x1bf0f1[_0x7b90('0x29')],'as':'BlackLists','where':{'id':_0x1b8eaf[_0x7b90('0x14')]}}]})[_0x7b90('0x10')](function(_0x157040){if(_0x157040){var _0x44f166=[];for(var _0x36852c=0x0,_0x2ecea2;_0x36852c<_0x157040[_0x7b90('0x2d')];_0x36852c+=0x1){_0x2ecea2=_0x157040[_0x36852c][_0x7b90('0xb')]({'plain':!![]});_0x1bf0f1['CmHopperBlack']['create']({'phone':_0x1b8eaf['phone'],'ContactId':_0x1b8eaf['id'],'ListId':_0x1b8eaf[_0x7b90('0x14')],'CampaignId':_0x2ecea2['id']})[_0x7b90('0x1a')](function(_0xa3d0a7){logger[_0x7b90('0xc')](_0x7b90('0x2e'),_0x7b90('0x21'),_0xa3d0a7[_0x7b90('0x2f')]);});}}});})['then'](function(){_0x2ab83f();})[_0x7b90('0x1a')](function(_0x598f37){logger[_0x7b90('0xc')](_0x7b90('0x2e'),_0x7b90('0x21'),_0x598f37[_0x7b90('0x2f')]);_0x2ab83f(_0x598f37);});}else{_0x2ab83f(new Error(_0x7b90('0x32')));}},'afterDestroy':function(_0x4db1df,_0x554c80,_0x395901){var _0x5053bd=_0x4f4cf['models'];var _0xd2bdc8=_0x4db1df[_0x7b90('0xb')]({'plain':!![]});return _0x5053bd[_0x7b90('0xf')]['findAll']({'raw':!![],'where':{'ListId':_0xd2bdc8[_0x7b90('0x14')],'ContactId':_0xd2bdc8['id']}})['then'](function(_0x14e07e){if(!_['isEmpty'](_0x14e07e)){var _0x3628a6=[];for(var _0x5834a1=0x0;_0x5834a1<_0x14e07e[_0x7b90('0x2d')];_0x5834a1+=0x1){var _0x386614=_0x5053bd[_0x7b90('0xf')][_0x7b90('0x33')]({'where':{'ListId':_0x14e07e[_0x5834a1][_0x7b90('0x14')],'ContactId':_0x14e07e[_0x5834a1]['ContactId'],'VoiceQueueId':_0x14e07e[_0x5834a1][_0x7b90('0x34')],'CampaignId':_0x14e07e[_0x5834a1][_0x7b90('0x35')]}});_0x3628a6[_0x7b90('0x36')](_0x386614);}return BPromise['all'](_0x3628a6);}})['then'](function(_0x481399){logger[_0x7b90('0x37')](_0x7b90('0x38'),util[_0x7b90('0xe')](_0x481399,{'showHidden':![],'depth':null}));_0x395901();})[_0x7b90('0x1a')](function(_0x575c1a){logger['error'](_0x7b90('0x39'),util[_0x7b90('0xe')](_0x575c1a,{'showHidden':![],'depth':null}));_0x395901(_0x575c1a);});}}});};
\ No newline at end of file