Built motion from commit 709aa6fb5ed03aa61bc373fcdbf622215d37d30b. Version 3.0.0...
[motion-next.git] / server / api / cmContact / cmContact.model.js
index d40e2ec..4948649 100644 (file)
@@ -1 +1 @@
-const a128_0x1969=['Campaign','Lists','push','mobile','ListId','BlackLists','FULLTEXT','cmContact,\x20afterCreate,\x20','cm_contacts','onlyIfOpen','get','lodash','util','phone','inspect','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','lastName','moment','VoiceQueueId','afterCreate','then','isNil','error','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','always','CmList','cmContact,\x20%s,\x20%s','CmHopperFinal','dialCheckDuplicateType','fax','define','./cmContact.attributes','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','../../config/logger','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','exports','findAll','email','VoiceQueue','CmContact','catch','callbackUniqueid','isEmpty','CmHopperBlack','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','message','scheduledat','outbound','YYYY-MM-DD\x20HH:mm:ss','api','CmHopper','format','priority','cmContact','models','create','findOne','length','[CmContact][afterDestroy][Error]','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','info','[CmContact][afterDestroy][Succesfull]'];(function(_0x424651,_0x196968){const _0x3a9447=function(_0x369fca){while(--_0x369fca){_0x424651['push'](_0x424651['shift']());}};_0x3a9447(++_0x196968);}(a128_0x1969,0x1ed));const a128_0x3a94=function(_0x424651,_0x196968){_0x424651=_0x424651-0x0;let _0x3a9447=a128_0x1969[_0x424651];return _0x3a9447;};const _0x4bd49f=a128_0x3a94;'use strict';const _=require(_0x4bd49f('0x16')),util=require(_0x4bd49f('0x17')),logger=require(_0x4bd49f('0x2d'))(_0x4bd49f('0x3d')),moment=require(_0x4bd49f('0x1c')),attributes=require(_0x4bd49f('0x2a'));module[_0x4bd49f('0x2f')]=function(_0x369fca){const _0x1725b4=_0x4bd49f,_0x48a2a3=_0x369fca[_0x1725b4('0x3')],_0x267871=_0x369fca[_0x1725b4('0x29')](_0x1725b4('0x33'),attributes,{'tableName':_0x1725b4('0x13'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x1725b4('0x18')]},{'name':'fti_cm_contacts','fields':['firstName',_0x1725b4('0x1b'),_0x1725b4('0x18'),_0x1725b4('0xe'),_0x1725b4('0x28'),_0x1725b4('0x31')],'type':_0x1725b4('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5de68d){const _0x54cfd2=_0x1725b4,_0x2d3de9=_0x5de68d[_0x54cfd2('0x15')]({'plain':!![]});function _0xd5664(){return function(_0x5ea1ab){const _0x3f7293=a128_0x3a94;logger[_0x3f7293('0x21')](_0x3f7293('0x2'),_0x3f7293('0x1e'),util['inspect'](_0x5ea1ab,{'showHidden':![],'depth':null}));};}const _0x27af6d=function(_0x1fdb64){return new Promise(function(_0x53711f,_0x30671a){const _0x4ac02e=a128_0x3a94;_0x48a2a3[_0x4ac02e('0x3e')][_0x4ac02e('0x5')]({'where':{'phone':_0x2d3de9['phone'],'VoiceQueueId':_0x1fdb64['id']}})[_0x4ac02e('0x1f')](function(_0x2ea5ee){const _0x2aebc3=_0x4ac02e;if(!_[_0x2aebc3('0x20')](_0x2ea5ee))throw new Error(_0x2aebc3('0x2b')+_0x2d3de9[_0x2aebc3('0x18')]+_0x2aebc3('0x2e')+_0x1fdb64['id']);return _0x48a2a3[_0x2aebc3('0x3e')]['create']({'phone':_0x2d3de9[_0x2aebc3('0x18')],'ContactId':_0x2d3de9['id'],'ListId':_0x2d3de9[_0x2aebc3('0xf')],'priority':_0x2d3de9[_0x2aebc3('0x1')]?_0x2d3de9[_0x2aebc3('0x1')]:0x2,'scheduledat':_0x2d3de9['scheduledat']?_0x2d3de9[_0x2aebc3('0x3a')]:moment()['format'](_0x2aebc3('0x3c')),'callback':_0x2d3de9[_0x2aebc3('0x35')]?!![]:![],'callbackuniqueid':_0x2d3de9[_0x2aebc3('0x35')]?_0x2d3de9[_0x2aebc3('0x35')]:undefined,'callbackat':_0x2d3de9[_0x2aebc3('0x35')]?moment()['format'](_0x2aebc3('0x3c')):undefined,'VoiceQueueId':_0x1fdb64['id']});})[_0x4ac02e('0x34')](function(_0x1e8240){_0x30671a(_0x1e8240);});});},_0x3170c9=function(_0x944731){return new Promise(function(_0x5eadd0,_0x4daa9f){const _0x3f47f8=a128_0x3a94;_0x48a2a3[_0x3f47f8('0x3e')][_0x3f47f8('0x5')]({'where':{'phone':_0x2d3de9[_0x3f47f8('0x18')],'VoiceQueueId':_0x944731['id']}})[_0x3f47f8('0x1f')](function(_0x2e37a6){const _0x6f22a4=_0x3f47f8;if(!_[_0x6f22a4('0x20')](_0x2e37a6))throw new Error(_0x6f22a4('0x2b')+_0x2d3de9[_0x6f22a4('0x18')]+_0x6f22a4('0x1a')+_0x944731['id']);return _0x48a2a3[_0x6f22a4('0x26')][_0x6f22a4('0x5')]({'where':{'calleridnum':_0x2d3de9[_0x6f22a4('0x18')],'VoiceQueueId':_0x944731['id']}});})[_0x3f47f8('0x1f')](function(_0x31c29d){const _0x506937=_0x3f47f8;if(!_[_0x506937('0x20')](_0x31c29d))throw new Error('cmContact,\x20afterCreate,\x20'+_0x2d3de9[_0x506937('0x18')]+_0x506937('0x38')+_0x944731['id']);return _0x48a2a3[_0x506937('0x3e')][_0x506937('0x4')]({'phone':_0x2d3de9['phone'],'ContactId':_0x2d3de9['id'],'ListId':_0x2d3de9[_0x506937('0xf')],'priority':_0x2d3de9['priority']?_0x2d3de9['priority']:0x2,'scheduledat':_0x2d3de9[_0x506937('0x3a')]?_0x2d3de9['scheduledat']:moment()['format'](_0x506937('0x3c')),'callback':_0x2d3de9['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2d3de9[_0x506937('0x35')]?_0x2d3de9[_0x506937('0x35')]:undefined,'callbackat':_0x2d3de9['callbackUniqueid']?moment()[_0x506937('0x0')](_0x506937('0x3c')):undefined,'VoiceQueueId':_0x944731['id']});})[_0x3f47f8('0x34')](function(_0x55d397){_0x4daa9f(_0x55d397);});});};function _0x2366fc(){return function(_0x5f17e7){const _0x39318d=a128_0x3a94;logger['error'](_0x39318d('0x2'),'afterCreate',util[_0x39318d('0x19')](_0x5f17e7,{'showHidden':![],'depth':null}));};}const _0x2d8052=function(_0x73b735){return new Promise(function(_0x4258ff,_0x2a1595){const _0x2ecd68=a128_0x3a94;_0x48a2a3[_0x2ecd68('0x3e')][_0x2ecd68('0x5')]({'where':{'phone':_0x2d3de9[_0x2ecd68('0x18')],'CampaignId':_0x73b735['id']}})[_0x2ecd68('0x1f')](function(_0x5be944){const _0x4fda53=_0x2ecd68;if(!_[_0x4fda53('0x20')](_0x5be944))throw new Error(_0x4fda53('0x2b')+_0x2d3de9[_0x4fda53('0x18')]+_0x4fda53('0x8')+_0x73b735['id']);return _0x48a2a3[_0x4fda53('0x3e')][_0x4fda53('0x4')]({'phone':_0x2d3de9[_0x4fda53('0x18')],'ContactId':_0x2d3de9['id'],'ListId':_0x2d3de9[_0x4fda53('0xf')],'priority':_0x2d3de9[_0x4fda53('0x1')]?_0x2d3de9['priority']:0x2,'scheduledat':_0x2d3de9[_0x4fda53('0x3a')]?_0x2d3de9[_0x4fda53('0x3a')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2d3de9[_0x4fda53('0x35')]?!![]:![],'callbackuniqueid':_0x2d3de9['callbackUniqueid']?_0x2d3de9[_0x4fda53('0x35')]:undefined,'callbackat':_0x2d3de9[_0x4fda53('0x35')]?moment()[_0x4fda53('0x0')](_0x4fda53('0x3c')):undefined,'CampaignId':_0x73b735['id']});})[_0x2ecd68('0x34')](function(_0x35fa5b){_0x2a1595(_0x35fa5b);});});},_0xb77ff5=function(_0x432389){return new Promise(function(_0x9cf836,_0x41e4d3){const _0x36aed8=a128_0x3a94;_0x48a2a3['CmHopper'][_0x36aed8('0x5')]({'where':{'phone':_0x2d3de9[_0x36aed8('0x18')],'CampaignId':_0x432389['id']}})[_0x36aed8('0x1f')](function(_0x5e516d){const _0x3deb1d=_0x36aed8;if(!_[_0x3deb1d('0x20')](_0x5e516d))throw new Error(_0x3deb1d('0x2b')+_0x2d3de9[_0x3deb1d('0x18')]+_0x3deb1d('0x2c')+_0x432389['id']);return _0x48a2a3[_0x3deb1d('0x26')][_0x3deb1d('0x5')]({'where':{'calleridnum':_0x2d3de9[_0x3deb1d('0x18')],'CampaignId':_0x432389['id']}});})[_0x36aed8('0x1f')](function(_0x2e9692){const _0x225be8=_0x36aed8;if(!_[_0x225be8('0x20')](_0x2e9692))throw new Error(_0x225be8('0x12')+_0x2d3de9[_0x225be8('0x18')]+_0x225be8('0x22')+_0x432389['id']);return _0x48a2a3[_0x225be8('0x3e')][_0x225be8('0x4')]({'phone':_0x2d3de9[_0x225be8('0x18')],'ContactId':_0x2d3de9['id'],'ListId':_0x2d3de9['ListId'],'priority':_0x2d3de9[_0x225be8('0x1')]?_0x2d3de9['priority']:0x2,'scheduledat':_0x2d3de9[_0x225be8('0x3a')]?_0x2d3de9[_0x225be8('0x3a')]:moment()[_0x225be8('0x0')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2d3de9[_0x225be8('0x35')]?!![]:![],'callbackuniqueid':_0x2d3de9[_0x225be8('0x35')]?_0x2d3de9[_0x225be8('0x35')]:undefined,'callbackat':_0x2d3de9[_0x225be8('0x35')]?moment()['format'](_0x225be8('0x3c')):undefined,'CampaignId':_0x432389['id']});})[_0x36aed8('0x34')](function(_0x3a4d36){_0x41e4d3(_0x3a4d36);});});};if(_0x2d3de9[_0x54cfd2('0xf')])_0x48a2a3[_0x54cfd2('0x32')]['findAll']({'where':{'type':_0x54cfd2('0x3b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x48a2a3[_0x54cfd2('0x24')],'as':'Lists','where':{'id':_0x2d3de9['ListId']}}]})['then'](function(_0x1303e6){const _0x568b6c=_0x54cfd2;if(_0x1303e6)for(let _0x5955b7=0x0,_0x15158d;_0x5955b7<_0x1303e6[_0x568b6c('0x6')];_0x5955b7+=0x1){_0x15158d=_0x1303e6[_0x5955b7][_0x568b6c('0x15')]({'plain':!![]});switch(_0x15158d[_0x568b6c('0x27')]){case _0x568b6c('0x23'):_0x3170c9(_0x15158d)[_0x568b6c('0x34')](_0xd5664());break;case _0x568b6c('0x14'):_0x27af6d(_0x15158d)[_0x568b6c('0x34')](_0xd5664());break;default:_0x48a2a3[_0x568b6c('0x3e')][_0x568b6c('0x4')]({'phone':_0x2d3de9[_0x568b6c('0x18')],'ContactId':_0x2d3de9['id'],'ListId':_0x2d3de9[_0x568b6c('0xf')],'scheduledat':_0x2d3de9[_0x568b6c('0x3a')]?_0x2d3de9[_0x568b6c('0x3a')]:moment()[_0x568b6c('0x0')](_0x568b6c('0x3c')),'priority':_0x2d3de9[_0x568b6c('0x1')]?_0x2d3de9[_0x568b6c('0x1')]:0x2,'callback':_0x2d3de9[_0x568b6c('0x35')]?!![]:![],'callbackuniqueid':_0x2d3de9[_0x568b6c('0x35')]?_0x2d3de9['callbackUniqueid']:undefined,'callbackat':_0x2d3de9[_0x568b6c('0x35')]?moment()[_0x568b6c('0x0')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x15158d['id']})[_0x568b6c('0x34')](_0xd5664());}}})[_0x54cfd2('0x1f')](function(){const _0xa8914c=_0x54cfd2;return _0x48a2a3['VoiceQueue'][_0xa8914c('0x30')]({'where':{'type':_0xa8914c('0x3b')},'attributes':['id'],'include':[{'model':_0x48a2a3[_0xa8914c('0x24')],'as':_0xa8914c('0x10'),'where':{'id':_0x2d3de9['ListId']}}]})[_0xa8914c('0x1f')](function(_0x5f1dc5){const _0x409028=_0xa8914c;if(_0x5f1dc5)for(let _0x5f144d=0x0,_0xc0e475;_0x5f144d<_0x5f1dc5[_0x409028('0x6')];_0x5f144d+=0x1){_0xc0e475=_0x5f1dc5[_0x5f144d]['get']({'plain':!![]}),_0x48a2a3[_0x409028('0x37')][_0x409028('0x4')]({'phone':_0x2d3de9[_0x409028('0x18')],'ContactId':_0x2d3de9['id'],'ListId':_0x2d3de9['ListId'],'VoiceQueueId':_0xc0e475['id']})['catch'](function(_0x1c9257){const _0x34e181=_0x409028;logger[_0x34e181('0x21')]('cmContact,\x20%s,\x20%s',_0x34e181('0x1e'),_0x1c9257[_0x34e181('0x39')]);});}});})[_0x54cfd2('0x1f')](function(){const _0x5db860=_0x54cfd2;return _0x48a2a3[_0x5db860('0xb')][_0x5db860('0x30')]({'attributes':['id',_0x5db860('0x27')],'include':[{'model':_0x48a2a3['CmList'],'as':_0x5db860('0xc'),'where':{'id':_0x2d3de9[_0x5db860('0xf')]}}]})[_0x5db860('0x1f')](function(_0x53fc63){const _0x48e495=_0x5db860;if(_0x53fc63)for(let _0x571459=0x0,_0x438d51;_0x571459<_0x53fc63['length'];_0x571459+=0x1){_0x438d51=_0x53fc63[_0x571459][_0x48e495('0x15')]({'plain':!![]});switch(_0x438d51['dialCheckDuplicateType']){case _0x48e495('0x23'):_0xb77ff5(_0x438d51)['catch'](_0x2366fc());break;case _0x48e495('0x14'):_0x2d8052(_0x438d51)[_0x48e495('0x34')](_0x2366fc());break;default:_0x48a2a3['CmHopper'][_0x48e495('0x4')]({'phone':_0x2d3de9[_0x48e495('0x18')],'ContactId':_0x2d3de9['id'],'ListId':_0x2d3de9[_0x48e495('0xf')],'scheduledat':_0x2d3de9['scheduledat']?_0x2d3de9[_0x48e495('0x3a')]:moment()[_0x48e495('0x0')](_0x48e495('0x3c')),'priority':_0x2d3de9['priority']?_0x2d3de9[_0x48e495('0x1')]:0x2,'callback':_0x2d3de9[_0x48e495('0x35')]?!![]:![],'callbackuniqueid':_0x2d3de9[_0x48e495('0x35')]?_0x2d3de9['callbackUniqueid']:undefined,'callbackat':_0x2d3de9[_0x48e495('0x35')]?moment()['format'](_0x48e495('0x3c')):undefined,'CampaignId':_0x438d51['id']})[_0x48e495('0x34')](_0x2366fc());}}});})[_0x54cfd2('0x1f')](function(){const _0xf34c81=_0x54cfd2;return _0x48a2a3[_0xf34c81('0xb')][_0xf34c81('0x30')]({'attributes':['id'],'include':[{'model':_0x48a2a3[_0xf34c81('0x24')],'as':_0xf34c81('0x10'),'where':{'id':_0x2d3de9[_0xf34c81('0xf')]}}]})[_0xf34c81('0x1f')](function(_0x251db5){const _0x31e9cc=_0xf34c81;if(_0x251db5)for(let _0x3dd1aa=0x0,_0x170345;_0x3dd1aa<_0x251db5[_0x31e9cc('0x6')];_0x3dd1aa+=0x1){_0x170345=_0x251db5[_0x3dd1aa][_0x31e9cc('0x15')]({'plain':!![]}),_0x48a2a3[_0x31e9cc('0x37')][_0x31e9cc('0x4')]({'phone':_0x2d3de9['phone'],'ContactId':_0x2d3de9['id'],'ListId':_0x2d3de9[_0x31e9cc('0xf')],'CampaignId':_0x170345['id']})[_0x31e9cc('0x34')](function(_0x5dd98f){const _0xc27d4e=_0x31e9cc;logger[_0xc27d4e('0x21')](_0xc27d4e('0x25'),_0xc27d4e('0x1e'),_0x5dd98f[_0xc27d4e('0x39')]);});}});})[_0x54cfd2('0x34')](function(_0x2f6067){const _0x1fba9f=_0x54cfd2;return logger[_0x1fba9f('0x21')]('cmContact,\x20%s,\x20%s',_0x1fba9f('0x1e'),_0x2f6067[_0x1fba9f('0x39')]),_0x2f6067;});else throw new Error('List\x20not\x20found');},'afterDestroy':function(_0x2a1b7b){const _0x3d3d46=_0x1725b4,_0x1ed445=_0x2a1b7b['get']({'plain':!![]});return _0x48a2a3[_0x3d3d46('0x3e')][_0x3d3d46('0x30')]({'raw':!![],'where':{'ListId':_0x1ed445[_0x3d3d46('0xf')],'ContactId':_0x1ed445['id']}})['then'](function(_0x2558ef){const _0x5c12a0=_0x3d3d46;if(!_[_0x5c12a0('0x36')](_0x2558ef)){const _0x296c8e=[];for(let _0x44872b=0x0;_0x44872b<_0x2558ef['length'];_0x44872b+=0x1){const _0x1868d9=_0x48a2a3['CmHopper']['destroy']({'where':{'ListId':_0x2558ef[_0x44872b][_0x5c12a0('0xf')],'ContactId':_0x2558ef[_0x44872b]['ContactId'],'VoiceQueueId':_0x2558ef[_0x44872b][_0x5c12a0('0x1d')],'CampaignId':_0x2558ef[_0x44872b]['CampaignId']}});_0x296c8e[_0x5c12a0('0xd')](_0x1868d9);}return Promise['all'](_0x296c8e);}})[_0x3d3d46('0x1f')](function(_0x385d1){const _0x1a8abe=_0x3d3d46;return logger[_0x1a8abe('0x9')](_0x1a8abe('0xa'),util[_0x1a8abe('0x19')](_0x385d1,{'showHidden':![],'depth':null})),null;})[_0x3d3d46('0x34')](function(_0xd90515){const _0x1bd36c=_0x3d3d46;return logger[_0x1bd36c('0x21')](_0x1bd36c('0x7'),util['inspect'](_0xd90515,{'showHidden':![],'depth':null})),_0xd90515;});}}});return _0x267871;};
\ No newline at end of file
+const a128_0xdf16=['firstName','models','onlyIfOpen','mobile','all','CmHopperBlack','format','fti_cm_contacts','YYYY-MM-DD\x20HH:mm:ss','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','findAll','exports','CampaignId','cm_contacts','dialCheckDuplicateType','isEmpty','util','Campaign','findOne','CmList','Lists','info','FULLTEXT','inspect','get','create','priority','List\x20not\x20found','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','email','CmHopper','catch','phone','ContactId','[CmContact][afterDestroy][Error]','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','[CmContact][afterDestroy][Succesfull]','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','message','./cmContact.attributes','push','cmContact,\x20%s,\x20%s','afterCreate','BlackLists','length','destroy','CmHopperFinal','lodash','isNil','ListId','always','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','VoiceQueueId','then','error','outbound','CmContact','fax','callbackUniqueid','cmContact,\x20afterCreate,\x20','scheduledat','cmContact,\x20afterCreate\x20'];(function(_0x1cae1c,_0xdf164c){const _0x4f246d=function(_0x5b3baa){while(--_0x5b3baa){_0x1cae1c['push'](_0x1cae1c['shift']());}};_0x4f246d(++_0xdf164c);}(a128_0xdf16,0x16d));const a128_0x4f24=function(_0x1cae1c,_0xdf164c){_0x1cae1c=_0x1cae1c-0x0;let _0x4f246d=a128_0xdf16[_0x1cae1c];return _0x4f246d;};const _0x47f5ba=a128_0x4f24;'use strict';const _=require(_0x47f5ba('0x36')),util=require(_0x47f5ba('0x17')),logger=require('../../config/logger')('api'),moment=require('moment'),attributes=require(_0x47f5ba('0x2e'));module[_0x47f5ba('0x12')]=function(_0x5b3baa){const _0x272c31=_0x47f5ba,_0x275ed9=_0x5b3baa[_0x272c31('0x8')],_0x3088=_0x5b3baa['define'](_0x272c31('0x1'),attributes,{'tableName':_0x272c31('0x14'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x272c31('0x27')]},{'name':_0x272c31('0xe'),'fields':[_0x272c31('0x7'),'lastName',_0x272c31('0x27'),_0x272c31('0xa'),_0x272c31('0x2'),_0x272c31('0x24')],'type':_0x272c31('0x1d')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b9060){const _0x27be52=_0x272c31,_0x5a7b91=_0x4b9060[_0x27be52('0x1f')]({'plain':!![]});function _0x10b0e0(){return function(_0x455e0d){const _0x1c9b37=a128_0x4f24;logger[_0x1c9b37('0x3d')]('cmContact',_0x1c9b37('0x31'),util[_0x1c9b37('0x1e')](_0x455e0d,{'showHidden':![],'depth':null}));};}const _0x5df9ae=function(_0x340c3c){return new Promise(function(_0x2f597b,_0x457b11){const _0x10c8c2=a128_0x4f24;_0x275ed9['CmHopper'][_0x10c8c2('0x19')]({'where':{'phone':_0x5a7b91[_0x10c8c2('0x27')],'VoiceQueueId':_0x340c3c['id']}})['then'](function(_0x4854c6){const _0x1d5c55=_0x10c8c2;if(!_[_0x1d5c55('0x37')](_0x4854c6))throw new Error(_0x1d5c55('0x6')+_0x5a7b91[_0x1d5c55('0x27')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x340c3c['id']);return _0x275ed9[_0x1d5c55('0x25')][_0x1d5c55('0x20')]({'phone':_0x5a7b91[_0x1d5c55('0x27')],'ContactId':_0x5a7b91['id'],'ListId':_0x5a7b91['ListId'],'priority':_0x5a7b91['priority']?_0x5a7b91[_0x1d5c55('0x21')]:0x2,'scheduledat':_0x5a7b91[_0x1d5c55('0x5')]?_0x5a7b91[_0x1d5c55('0x5')]:moment()[_0x1d5c55('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5a7b91[_0x1d5c55('0x3')]?!![]:![],'callbackuniqueid':_0x5a7b91['callbackUniqueid']?_0x5a7b91['callbackUniqueid']:undefined,'callbackat':_0x5a7b91[_0x1d5c55('0x3')]?moment()[_0x1d5c55('0xd')](_0x1d5c55('0xf')):undefined,'VoiceQueueId':_0x340c3c['id']});})[_0x10c8c2('0x26')](function(_0x53ae24){_0x457b11(_0x53ae24);});});},_0x5704fa=function(_0x3afa76){return new Promise(function(_0x290f49,_0x206470){const _0x24fc9e=a128_0x4f24;_0x275ed9[_0x24fc9e('0x25')][_0x24fc9e('0x19')]({'where':{'phone':_0x5a7b91[_0x24fc9e('0x27')],'VoiceQueueId':_0x3afa76['id']}})[_0x24fc9e('0x3c')](function(_0x184d4c){const _0x4ac8ed=_0x24fc9e;if(!_[_0x4ac8ed('0x37')](_0x184d4c))throw new Error('cmContact,\x20afterCreate\x20'+_0x5a7b91[_0x4ac8ed('0x27')]+_0x4ac8ed('0x3a')+_0x3afa76['id']);return _0x275ed9[_0x4ac8ed('0x35')][_0x4ac8ed('0x19')]({'where':{'calleridnum':_0x5a7b91[_0x4ac8ed('0x27')],'VoiceQueueId':_0x3afa76['id']}});})[_0x24fc9e('0x3c')](function(_0x3d41b0){const _0x4e13e0=_0x24fc9e;if(!_[_0x4e13e0('0x37')](_0x3d41b0))throw new Error(_0x4e13e0('0x4')+_0x5a7b91[_0x4e13e0('0x27')]+_0x4e13e0('0x10')+_0x3afa76['id']);return _0x275ed9[_0x4e13e0('0x25')][_0x4e13e0('0x20')]({'phone':_0x5a7b91[_0x4e13e0('0x27')],'ContactId':_0x5a7b91['id'],'ListId':_0x5a7b91[_0x4e13e0('0x38')],'priority':_0x5a7b91[_0x4e13e0('0x21')]?_0x5a7b91['priority']:0x2,'scheduledat':_0x5a7b91['scheduledat']?_0x5a7b91[_0x4e13e0('0x5')]:moment()[_0x4e13e0('0xd')](_0x4e13e0('0xf')),'callback':_0x5a7b91['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5a7b91[_0x4e13e0('0x3')]?_0x5a7b91[_0x4e13e0('0x3')]:undefined,'callbackat':_0x5a7b91[_0x4e13e0('0x3')]?moment()[_0x4e13e0('0xd')](_0x4e13e0('0xf')):undefined,'VoiceQueueId':_0x3afa76['id']});})['catch'](function(_0x199732){_0x206470(_0x199732);});});};function _0x523dda(){return function(_0xd300d0){const _0xac3977=a128_0x4f24;logger[_0xac3977('0x3d')]('cmContact','afterCreate',util[_0xac3977('0x1e')](_0xd300d0,{'showHidden':![],'depth':null}));};}const _0x7a0d=function(_0x178b1a){return new Promise(function(_0x5a68d9,_0x33fa83){const _0x401e90=a128_0x4f24;_0x275ed9[_0x401e90('0x25')][_0x401e90('0x19')]({'where':{'phone':_0x5a7b91[_0x401e90('0x27')],'CampaignId':_0x178b1a['id']}})['then'](function(_0x4bccfe){const _0x2404a2=_0x401e90;if(!_[_0x2404a2('0x37')](_0x4bccfe))throw new Error('cmContact,\x20afterCreate\x20'+_0x5a7b91[_0x2404a2('0x27')]+_0x2404a2('0x2a')+_0x178b1a['id']);return _0x275ed9[_0x2404a2('0x25')][_0x2404a2('0x20')]({'phone':_0x5a7b91[_0x2404a2('0x27')],'ContactId':_0x5a7b91['id'],'ListId':_0x5a7b91[_0x2404a2('0x38')],'priority':_0x5a7b91[_0x2404a2('0x21')]?_0x5a7b91[_0x2404a2('0x21')]:0x2,'scheduledat':_0x5a7b91[_0x2404a2('0x5')]?_0x5a7b91[_0x2404a2('0x5')]:moment()['format'](_0x2404a2('0xf')),'callback':_0x5a7b91[_0x2404a2('0x3')]?!![]:![],'callbackuniqueid':_0x5a7b91[_0x2404a2('0x3')]?_0x5a7b91[_0x2404a2('0x3')]:undefined,'callbackat':_0x5a7b91[_0x2404a2('0x3')]?moment()[_0x2404a2('0xd')](_0x2404a2('0xf')):undefined,'CampaignId':_0x178b1a['id']});})['catch'](function(_0x37513b){_0x33fa83(_0x37513b);});});},_0x15c6dc=function(_0x9fc941){return new Promise(function(_0x20bb26,_0x934d9e){const _0x4c8b5d=a128_0x4f24;_0x275ed9[_0x4c8b5d('0x25')][_0x4c8b5d('0x19')]({'where':{'phone':_0x5a7b91[_0x4c8b5d('0x27')],'CampaignId':_0x9fc941['id']}})[_0x4c8b5d('0x3c')](function(_0x35b417){const _0x208c1a=_0x4c8b5d;if(!_[_0x208c1a('0x37')](_0x35b417))throw new Error('cmContact,\x20afterCreate\x20'+_0x5a7b91['phone']+_0x208c1a('0x23')+_0x9fc941['id']);return _0x275ed9[_0x208c1a('0x35')][_0x208c1a('0x19')]({'where':{'calleridnum':_0x5a7b91[_0x208c1a('0x27')],'CampaignId':_0x9fc941['id']}});})[_0x4c8b5d('0x3c')](function(_0x15354d){const _0x97822d=_0x4c8b5d;if(!_['isNil'](_0x15354d))throw new Error(_0x97822d('0x4')+_0x5a7b91[_0x97822d('0x27')]+_0x97822d('0x2c')+_0x9fc941['id']);return _0x275ed9['CmHopper'][_0x97822d('0x20')]({'phone':_0x5a7b91['phone'],'ContactId':_0x5a7b91['id'],'ListId':_0x5a7b91[_0x97822d('0x38')],'priority':_0x5a7b91['priority']?_0x5a7b91[_0x97822d('0x21')]:0x2,'scheduledat':_0x5a7b91['scheduledat']?_0x5a7b91[_0x97822d('0x5')]:moment()[_0x97822d('0xd')](_0x97822d('0xf')),'callback':_0x5a7b91['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5a7b91[_0x97822d('0x3')]?_0x5a7b91[_0x97822d('0x3')]:undefined,'callbackat':_0x5a7b91[_0x97822d('0x3')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x9fc941['id']});})[_0x4c8b5d('0x26')](function(_0x1237d9){_0x934d9e(_0x1237d9);});});};if(_0x5a7b91[_0x27be52('0x38')])_0x275ed9['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x27be52('0x15')],'include':[{'model':_0x275ed9[_0x27be52('0x1a')],'as':'Lists','where':{'id':_0x5a7b91[_0x27be52('0x38')]}}]})[_0x27be52('0x3c')](function(_0x2254e5){const _0x57b24d=_0x27be52;if(_0x2254e5)for(let _0x6754df=0x0,_0x27030f;_0x6754df<_0x2254e5[_0x57b24d('0x33')];_0x6754df+=0x1){_0x27030f=_0x2254e5[_0x6754df][_0x57b24d('0x1f')]({'plain':!![]});switch(_0x27030f[_0x57b24d('0x15')]){case _0x57b24d('0x39'):_0x5704fa(_0x27030f)[_0x57b24d('0x26')](_0x10b0e0());break;case _0x57b24d('0x9'):_0x5df9ae(_0x27030f)[_0x57b24d('0x26')](_0x10b0e0());break;default:_0x275ed9['CmHopper'][_0x57b24d('0x20')]({'phone':_0x5a7b91[_0x57b24d('0x27')],'ContactId':_0x5a7b91['id'],'ListId':_0x5a7b91['ListId'],'scheduledat':_0x5a7b91[_0x57b24d('0x5')]?_0x5a7b91[_0x57b24d('0x5')]:moment()[_0x57b24d('0xd')](_0x57b24d('0xf')),'priority':_0x5a7b91[_0x57b24d('0x21')]?_0x5a7b91['priority']:0x2,'callback':_0x5a7b91[_0x57b24d('0x3')]?!![]:![],'callbackuniqueid':_0x5a7b91[_0x57b24d('0x3')]?_0x5a7b91[_0x57b24d('0x3')]:undefined,'callbackat':_0x5a7b91['callbackUniqueid']?moment()[_0x57b24d('0xd')](_0x57b24d('0xf')):undefined,'VoiceQueueId':_0x27030f['id']})[_0x57b24d('0x26')](_0x10b0e0());}}})['then'](function(){const _0x1e656a=_0x27be52;return _0x275ed9['VoiceQueue'][_0x1e656a('0x11')]({'where':{'type':_0x1e656a('0x0')},'attributes':['id'],'include':[{'model':_0x275ed9[_0x1e656a('0x1a')],'as':_0x1e656a('0x32'),'where':{'id':_0x5a7b91[_0x1e656a('0x38')]}}]})[_0x1e656a('0x3c')](function(_0x5d1a7d){const _0x42af34=_0x1e656a;if(_0x5d1a7d)for(let _0x4f1248=0x0,_0x1ecee8;_0x4f1248<_0x5d1a7d[_0x42af34('0x33')];_0x4f1248+=0x1){_0x1ecee8=_0x5d1a7d[_0x4f1248][_0x42af34('0x1f')]({'plain':!![]}),_0x275ed9[_0x42af34('0xc')][_0x42af34('0x20')]({'phone':_0x5a7b91[_0x42af34('0x27')],'ContactId':_0x5a7b91['id'],'ListId':_0x5a7b91[_0x42af34('0x38')],'VoiceQueueId':_0x1ecee8['id']})[_0x42af34('0x26')](function(_0x384bd8){const _0x50e69f=_0x42af34;logger['error'](_0x50e69f('0x30'),_0x50e69f('0x31'),_0x384bd8[_0x50e69f('0x2d')]);});}});})[_0x27be52('0x3c')](function(){const _0x1f7542=_0x27be52;return _0x275ed9[_0x1f7542('0x18')][_0x1f7542('0x11')]({'attributes':['id',_0x1f7542('0x15')],'include':[{'model':_0x275ed9[_0x1f7542('0x1a')],'as':_0x1f7542('0x1b'),'where':{'id':_0x5a7b91['ListId']}}]})[_0x1f7542('0x3c')](function(_0x1380a6){const _0xd39ee9=_0x1f7542;if(_0x1380a6)for(let _0x5e6654=0x0,_0x52f2a3;_0x5e6654<_0x1380a6[_0xd39ee9('0x33')];_0x5e6654+=0x1){_0x52f2a3=_0x1380a6[_0x5e6654][_0xd39ee9('0x1f')]({'plain':!![]});switch(_0x52f2a3[_0xd39ee9('0x15')]){case _0xd39ee9('0x39'):_0x15c6dc(_0x52f2a3)['catch'](_0x523dda());break;case _0xd39ee9('0x9'):_0x7a0d(_0x52f2a3)[_0xd39ee9('0x26')](_0x523dda());break;default:_0x275ed9[_0xd39ee9('0x25')]['create']({'phone':_0x5a7b91[_0xd39ee9('0x27')],'ContactId':_0x5a7b91['id'],'ListId':_0x5a7b91['ListId'],'scheduledat':_0x5a7b91['scheduledat']?_0x5a7b91['scheduledat']:moment()['format'](_0xd39ee9('0xf')),'priority':_0x5a7b91[_0xd39ee9('0x21')]?_0x5a7b91[_0xd39ee9('0x21')]:0x2,'callback':_0x5a7b91[_0xd39ee9('0x3')]?!![]:![],'callbackuniqueid':_0x5a7b91[_0xd39ee9('0x3')]?_0x5a7b91[_0xd39ee9('0x3')]:undefined,'callbackat':_0x5a7b91['callbackUniqueid']?moment()[_0xd39ee9('0xd')](_0xd39ee9('0xf')):undefined,'CampaignId':_0x52f2a3['id']})[_0xd39ee9('0x26')](_0x523dda());}}});})[_0x27be52('0x3c')](function(){const _0x4fdc6e=_0x27be52;return _0x275ed9[_0x4fdc6e('0x18')][_0x4fdc6e('0x11')]({'attributes':['id'],'include':[{'model':_0x275ed9['CmList'],'as':_0x4fdc6e('0x32'),'where':{'id':_0x5a7b91[_0x4fdc6e('0x38')]}}]})[_0x4fdc6e('0x3c')](function(_0x45434f){const _0x3917ec=_0x4fdc6e;if(_0x45434f)for(let _0x274c22=0x0,_0x4c62f7;_0x274c22<_0x45434f[_0x3917ec('0x33')];_0x274c22+=0x1){_0x4c62f7=_0x45434f[_0x274c22]['get']({'plain':!![]}),_0x275ed9[_0x3917ec('0xc')][_0x3917ec('0x20')]({'phone':_0x5a7b91['phone'],'ContactId':_0x5a7b91['id'],'ListId':_0x5a7b91[_0x3917ec('0x38')],'CampaignId':_0x4c62f7['id']})['catch'](function(_0x320ccc){const _0x292958=_0x3917ec;logger[_0x292958('0x3d')](_0x292958('0x30'),'afterCreate',_0x320ccc[_0x292958('0x2d')]);});}});})[_0x27be52('0x26')](function(_0x159bd9){const _0x4afbc4=_0x27be52;return logger[_0x4afbc4('0x3d')](_0x4afbc4('0x30'),_0x4afbc4('0x31'),_0x159bd9[_0x4afbc4('0x2d')]),_0x159bd9;});else throw new Error(_0x27be52('0x22'));},'afterDestroy':function(_0x4a33d7){const _0x42cf97=_0x272c31,_0x2c49d5=_0x4a33d7[_0x42cf97('0x1f')]({'plain':!![]});return _0x275ed9[_0x42cf97('0x25')][_0x42cf97('0x11')]({'raw':!![],'where':{'ListId':_0x2c49d5[_0x42cf97('0x38')],'ContactId':_0x2c49d5['id']}})[_0x42cf97('0x3c')](function(_0x476f05){const _0x487604=_0x42cf97;if(!_[_0x487604('0x16')](_0x476f05)){const _0x51c489=[];for(let _0x2289fd=0x0;_0x2289fd<_0x476f05[_0x487604('0x33')];_0x2289fd+=0x1){const _0x3e9bbd=_0x275ed9[_0x487604('0x25')][_0x487604('0x34')]({'where':{'ListId':_0x476f05[_0x2289fd][_0x487604('0x38')],'ContactId':_0x476f05[_0x2289fd][_0x487604('0x28')],'VoiceQueueId':_0x476f05[_0x2289fd][_0x487604('0x3b')],'CampaignId':_0x476f05[_0x2289fd][_0x487604('0x13')]}});_0x51c489[_0x487604('0x2f')](_0x3e9bbd);}return Promise[_0x487604('0xb')](_0x51c489);}})[_0x42cf97('0x3c')](function(_0x567caf){const _0x20888d=_0x42cf97;return logger[_0x20888d('0x1c')](_0x20888d('0x2b'),util[_0x20888d('0x1e')](_0x567caf,{'showHidden':![],'depth':null})),null;})['catch'](function(_0x8c884c){const _0x15f882=_0x42cf97;return logger[_0x15f882('0x3d')](_0x15f882('0x29'),util[_0x15f882('0x1e')](_0x8c884c,{'showHidden':![],'depth':null})),_0x8c884c;});}}});return _0x3088;};
\ No newline at end of file