Built motion from commit 6db1674d.|2.6.23
[motion2.git] / server / api / cmContact / cmContact.model.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 _0xf1f3=['cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','utcOffset','add','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','cmContact,\x20afterCreate\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','catch','inspect','Campaign','timezones','\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','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','message'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf1f3,0xe8));var _0x3f1f=function(_0x4ad62a,_0x1fa4ab){_0x4ad62a=_0x4ad62a-0x0;var _0x94f0cc=_0xf1f3[_0x4ad62a];return _0x94f0cc;};'use strict';var _=require(_0x3f1f('0x0'));var util=require(_0x3f1f('0x1'));var logger=require(_0x3f1f('0x2'))(_0x3f1f('0x3'));var moment=require(_0x3f1f('0x4'));var BPromise=require(_0x3f1f('0x5'));var rp=require(_0x3f1f('0x6'));var fs=require('fs');var path=require(_0x3f1f('0x7'));var rimraf=require(_0x3f1f('0x8'));var config=require(_0x3f1f('0x9'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module[_0x3f1f('0xa')]=function(_0x50ed7e,_0x38a9c1){return _0x50ed7e['define']('CmContact',attributes,{'tableName':_0x3f1f('0xb'),'paranoid':!![],'indexes':[{'name':_0x3f1f('0xc'),'fields':[_0x3f1f('0xc')]},{'name':_0x3f1f('0xd'),'fields':[_0x3f1f('0xe'),'lastName','phone',_0x3f1f('0xf'),_0x3f1f('0x10'),'email'],'type':_0x3f1f('0x11')}],'timestamps':!![],'charset':_0x3f1f('0x12'),'collate':_0x3f1f('0x13'),'hooks':{'afterCreate':function(_0x55cce1,_0x1e82ee,_0x57e13b){var _0x3083a0=_0x50ed7e[_0x3f1f('0x14')];var _0x3342ed=_0x55cce1[_0x3f1f('0x15')]({'plain':!![]});function _0x3e011c(){return function(_0x16910a){logger[_0x3f1f('0x16')](_0x3f1f('0x17'),_0x3f1f('0x18'),util['inspect'](_0x16910a,{'showHidden':![],'depth':null}));};}function _0x3677bb(_0x3d0a9e,_0xba582b){var _0x41751b=_0xba582b[_0x3f1f('0x19')]?_0xba582b[_0x3f1f('0x19')]:moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b'));return new BPromise(function(_0x354ccc,_0x443e1b){if(_[_0x3f1f('0x1c')](_0xba582b[_0x3f1f('0x1d')])){_0x354ccc({'ret':_0x41751b});}else{_0x3083a0[_0x3f1f('0x1e')][_0x3f1f('0x1f')]({'where':{'id':_0x3d0a9e['id']}})[_0x3f1f('0x20')](function(_0x46e9a0){if(!_['isNil'](_0x46e9a0)){var _0x2ce409=_0x46e9a0[_0x3f1f('0x1d')];if(!_[_0x3f1f('0x1c')](_0x2ce409)){var _0x5b86f0=shared['timezones'];var _0x4fcda3=_0x5b86f0[_0x2ce409];var _0x2266b7=_0x5b86f0[_0xba582b[_0x3f1f('0x1d')]];if(!_[_0x3f1f('0x1c')](_0x4fcda3)&&!_['isNil'](_0x2266b7)){var _0x533547=_0x4fcda3[_0x3f1f('0x21')]-_0x2266b7['utcOffset'];_0x41751b=_0xba582b[_0x3f1f('0x19')]?_0xba582b[_0x3f1f('0x19')]:moment();var _0x105bd7=moment(_0x41751b)[_0x3f1f('0x22')](_0x533547,'minutes');_0x354ccc({'ret':_0x105bd7['format'](_0x3f1f('0x1b'))});}else _0x354ccc({'ret':_0x41751b});}else _0x354ccc({'ret':_0x41751b});}else{_0x354ccc({'ret':_0x41751b});}});}});return 0xa;}var _0x134628=function(_0x149154){return new BPromise(function(_0x7ccb4c,_0x4f5b5b){_0x3677bb(_0x149154,_0x3342ed)[_0x3f1f('0x20')](function(_0x4ae5a9){_0x3342ed[_0x3f1f('0x19')]=_0x4ae5a9[_0x3f1f('0x23')];_0x3083a0['CmHopper'][_0x3f1f('0x1f')]({'where':{'phone':_0x3342ed[_0x3f1f('0xc')],'VoiceQueueId':_0x149154['id']}})['then'](function(_0x1ca45b){if(!_[_0x3f1f('0x1c')](_0x1ca45b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x3342ed[_0x3f1f('0xc')]+_0x3f1f('0x24')+_0x149154['id']);}return _0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x26')]({'phone':_0x3342ed[_0x3f1f('0xc')],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed['ListId'],'priority':_0x3342ed[_0x3f1f('0x27')]?_0x3342ed['priority']:0x2,'scheduledat':_0x3342ed[_0x3f1f('0x19')]?_0x3342ed[_0x3f1f('0x19')]:moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b')),'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed['callbackUniqueid']?_0x3342ed[_0x3f1f('0x28')]:undefined,'callbackat':_0x3342ed['callbackUniqueid']?moment()['format'](_0x3f1f('0x1b')):undefined,'VoiceQueueId':_0x149154['id']});})['catch'](function(_0x3d1c7a){_0x4f5b5b(_0x3d1c7a);});});});};var _0x446018=function(_0x420aee){return new BPromise(function(_0x344c1d,_0x24904c){_0x3677bb(_0x420aee,_0x3342ed)[_0x3f1f('0x20')](function(_0x20ad9e){_0x3342ed[_0x3f1f('0x19')]=_0x20ad9e[_0x3f1f('0x23')];_0x3083a0['CmHopper'][_0x3f1f('0x1f')]({'where':{'phone':_0x3342ed[_0x3f1f('0xc')],'VoiceQueueId':_0x420aee['id']}})[_0x3f1f('0x20')](function(_0x1a1182){if(!_[_0x3f1f('0x1c')](_0x1a1182)){throw new Error(_0x3f1f('0x29')+_0x3342ed['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x420aee['id']);}return _0x3083a0[_0x3f1f('0x2a')][_0x3f1f('0x1f')]({'where':{'calleridnum':_0x3342ed['phone'],'VoiceQueueId':_0x420aee['id']}});})[_0x3f1f('0x20')](function(_0x5ce66b){if(!_[_0x3f1f('0x1c')](_0x5ce66b)){throw new Error(_0x3f1f('0x2b')+_0x3342ed['phone']+_0x3f1f('0x2c')+_0x420aee['id']);}return _0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x26')]({'phone':_0x3342ed['phone'],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed[_0x3f1f('0x2d')],'priority':_0x3342ed[_0x3f1f('0x27')]?_0x3342ed['priority']:0x2,'scheduledat':_0x3342ed[_0x3f1f('0x19')]?_0x3342ed[_0x3f1f('0x19')]:moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b')),'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed['callbackUniqueid']?_0x3342ed[_0x3f1f('0x28')]:undefined,'callbackat':_0x3342ed[_0x3f1f('0x28')]?moment()[_0x3f1f('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x420aee['id']});})[_0x3f1f('0x2e')](function(_0x5968a4){_0x24904c(_0x5968a4);});});});};function _0x27826f(){return function(_0x20cb72){logger[_0x3f1f('0x16')](_0x3f1f('0x17'),_0x3f1f('0x18'),util[_0x3f1f('0x2f')](_0x20cb72,{'showHidden':![],'depth':null}));};}function _0x210f9d(_0x38b1f6,_0x5c4079){var _0x4e4aa7=_0x5c4079[_0x3f1f('0x19')]?_0x5c4079[_0x3f1f('0x19')]:moment()['format'](_0x3f1f('0x1b'));return new BPromise(function(_0x39540e,_0x61745d){if(_[_0x3f1f('0x1c')](_0x5c4079['dialTimezone'])){_0x39540e({'ret':_0x4e4aa7});}else{_0x3083a0[_0x3f1f('0x30')][_0x3f1f('0x1f')]({'where':{'id':_0x38b1f6['id']}})[_0x3f1f('0x20')](function(_0x5c0ca7){if(!_[_0x3f1f('0x1c')](_0x5c0ca7)){var _0x19a1f3=_0x5c0ca7[_0x3f1f('0x1d')];if(!_['isNil'](_0x19a1f3)){var _0x4e581c=shared[_0x3f1f('0x31')];var _0x60efeb=_0x4e581c[_0x19a1f3];var _0x59bf16=_0x4e581c[_0x5c4079[_0x3f1f('0x1d')]];if(!_[_0x3f1f('0x1c')](_0x60efeb)&&!_[_0x3f1f('0x1c')](_0x59bf16)){var _0x422bed=_0x60efeb[_0x3f1f('0x21')]-_0x59bf16['utcOffset'];_0x4e4aa7=_0x5c4079[_0x3f1f('0x19')]?_0x5c4079['scheduledat']:moment();var _0x539aa8=moment(_0x4e4aa7)[_0x3f1f('0x22')](_0x422bed,'minutes');_0x39540e({'ret':_0x539aa8[_0x3f1f('0x1a')](_0x3f1f('0x1b'))});}else _0x39540e({'ret':_0x4e4aa7});}else _0x39540e({'ret':_0x4e4aa7});}else{_0x39540e({'ret':_0x4e4aa7});}});}});return 0xa;}var _0x428f58=function(_0x4b3a23){return new BPromise(function(_0x4e494f,_0x3ade3a){_0x210f9d(_0x4b3a23,_0x3342ed)[_0x3f1f('0x20')](function(_0x132e15){_0x3342ed[_0x3f1f('0x19')]=_0x132e15['ret'];_0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x1f')]({'where':{'phone':_0x3342ed[_0x3f1f('0xc')],'CampaignId':_0x4b3a23['id']}})['then'](function(_0x1c9197){if(!_[_0x3f1f('0x1c')](_0x1c9197)){throw new Error(_0x3f1f('0x29')+_0x3342ed[_0x3f1f('0xc')]+_0x3f1f('0x32')+_0x4b3a23['id']);}return _0x3083a0['CmHopper'][_0x3f1f('0x26')]({'phone':_0x3342ed['phone'],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed['ListId'],'priority':_0x3342ed[_0x3f1f('0x27')]?_0x3342ed[_0x3f1f('0x27')]:0x2,'scheduledat':_0x3342ed['scheduledat']?_0x3342ed[_0x3f1f('0x19')]:moment()[_0x3f1f('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed['callbackUniqueid']?_0x3342ed[_0x3f1f('0x28')]:undefined,'callbackat':_0x3342ed[_0x3f1f('0x28')]?moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b')):undefined,'CampaignId':_0x4b3a23['id']});})['catch'](function(_0x47ebf6){_0x3ade3a(_0x47ebf6);});});});};var _0x359433=function(_0x559841){return new BPromise(function(_0xe19b7b,_0x41ef0b){_0x210f9d(_0x559841,_0x3342ed)[_0x3f1f('0x20')](function(_0x3b092f){_0x3342ed[_0x3f1f('0x19')]=_0x3b092f[_0x3f1f('0x23')];_0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x1f')]({'where':{'phone':_0x3342ed[_0x3f1f('0xc')],'CampaignId':_0x559841['id']}})[_0x3f1f('0x20')](function(_0x585e49){if(!_[_0x3f1f('0x1c')](_0x585e49)){throw new Error(_0x3f1f('0x29')+_0x3342ed[_0x3f1f('0xc')]+_0x3f1f('0x33')+_0x559841['id']);}return _0x3083a0[_0x3f1f('0x2a')][_0x3f1f('0x1f')]({'where':{'calleridnum':_0x3342ed[_0x3f1f('0xc')],'CampaignId':_0x559841['id']}});})[_0x3f1f('0x20')](function(_0x34a1d6){if(!_['isNil'](_0x34a1d6)){throw new Error(_0x3f1f('0x2b')+_0x3342ed['phone']+_0x3f1f('0x34')+_0x559841['id']);}return _0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x26')]({'phone':_0x3342ed[_0x3f1f('0xc')],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed[_0x3f1f('0x2d')],'priority':_0x3342ed[_0x3f1f('0x27')]?_0x3342ed[_0x3f1f('0x27')]:0x2,'scheduledat':_0x3342ed[_0x3f1f('0x19')]?_0x3342ed['scheduledat']:moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b')),'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed['callbackUniqueid']?_0x3342ed[_0x3f1f('0x28')]:undefined,'callbackat':_0x3342ed[_0x3f1f('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x559841['id']});})['catch'](function(_0x441405){_0x41ef0b(_0x441405);});});});};if(_0x3342ed['ListId']){_0x3083a0[_0x3f1f('0x1e')][_0x3f1f('0x35')]({'where':{'type':_0x3f1f('0x36')},'attributes':['id',_0x3f1f('0x37'),_0x3f1f('0x1d')],'include':[{'model':_0x3083a0[_0x3f1f('0x38')],'as':_0x3f1f('0x39'),'where':{'id':_0x3342ed[_0x3f1f('0x2d')]}}]})[_0x3f1f('0x20')](function(_0x302fdf){if(_0x302fdf){var _0x136877=[];for(var _0xe29b2a=0x0,_0xb23628;_0xe29b2a<_0x302fdf[_0x3f1f('0x3a')];_0xe29b2a+=0x1){_0xb23628=_0x302fdf[_0xe29b2a][_0x3f1f('0x15')]({'plain':!![]});switch(_0xb23628[_0x3f1f('0x37')]){case _0x3f1f('0x3b'):_0x446018(_0xb23628)[_0x3f1f('0x2e')](_0x3e011c());break;case _0x3f1f('0x3c'):_0x134628(_0xb23628)[_0x3f1f('0x2e')](_0x3e011c());break;default:_0x210f9d(_0xb23628,_0x3342ed)[_0x3f1f('0x20')](function(_0x20d83a){_0x3342ed['scheduledat']=_0x20d83a[_0x3f1f('0x23')];_0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x26')]({'phone':_0x3342ed[_0x3f1f('0xc')],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed[_0x3f1f('0x2d')],'scheduledat':_0x3342ed[_0x3f1f('0x19')]?_0x3342ed['scheduledat']:moment()[_0x3f1f('0x1a')](_0x3f1f('0x1b')),'priority':_0x3342ed['priority']?_0x3342ed[_0x3f1f('0x27')]:0x2,'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed[_0x3f1f('0x28')]?_0x3342ed['callbackUniqueid']:undefined,'callbackat':_0x3342ed[_0x3f1f('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xb23628['id']})['catch'](_0x3e011c());});}}}})[_0x3f1f('0x20')](function(){return _0x3083a0['VoiceQueue'][_0x3f1f('0x35')]({'where':{'type':_0x3f1f('0x36')},'attributes':['id'],'include':[{'model':_0x3083a0[_0x3f1f('0x38')],'as':_0x3f1f('0x3d'),'where':{'id':_0x3342ed[_0x3f1f('0x2d')]}}]})[_0x3f1f('0x20')](function(_0x342e53){if(_0x342e53){var _0x1f8cf5=[];for(var _0x518063=0x0,_0x3f7e88;_0x518063<_0x342e53[_0x3f1f('0x3a')];_0x518063+=0x1){_0x3f7e88=_0x342e53[_0x518063][_0x3f1f('0x15')]({'plain':!![]});_0x3083a0[_0x3f1f('0x3e')][_0x3f1f('0x26')]({'phone':_0x3342ed[_0x3f1f('0xc')],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed[_0x3f1f('0x2d')],'VoiceQueueId':_0x3f7e88['id']})[_0x3f1f('0x2e')](function(_0x522de7){logger[_0x3f1f('0x16')]('cmContact,\x20%s,\x20%s',_0x3f1f('0x18'),_0x522de7[_0x3f1f('0x3f')]);});}}});})['then'](function(){return _0x3083a0['Campaign'][_0x3f1f('0x35')]({'attributes':['id','dialCheckDuplicateType',_0x3f1f('0x1d')],'include':[{'model':_0x3083a0['CmList'],'as':'Lists','where':{'id':_0x3342ed[_0x3f1f('0x2d')]}}]})[_0x3f1f('0x20')](function(_0x5cc556){if(_0x5cc556){var _0x594adf=[];for(var _0x373bf5=0x0,_0x4f9ef7;_0x373bf5<_0x5cc556[_0x3f1f('0x3a')];_0x373bf5+=0x1){_0x4f9ef7=_0x5cc556[_0x373bf5][_0x3f1f('0x15')]({'plain':!![]});switch(_0x4f9ef7[_0x3f1f('0x37')]){case _0x3f1f('0x3b'):_0x359433(_0x4f9ef7)[_0x3f1f('0x2e')](_0x27826f());break;case _0x3f1f('0x3c'):_0x428f58(_0x4f9ef7)[_0x3f1f('0x2e')](_0x27826f());break;default:_0x3083a0[_0x3f1f('0x25')][_0x3f1f('0x26')]({'phone':_0x3342ed['phone'],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed['ListId'],'scheduledat':_0x3342ed[_0x3f1f('0x19')]?_0x3342ed['scheduledat']:moment()[_0x3f1f('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x3342ed['priority']?_0x3342ed[_0x3f1f('0x27')]:0x2,'callback':_0x3342ed[_0x3f1f('0x28')]?!![]:![],'callbackuniqueid':_0x3342ed[_0x3f1f('0x28')]?_0x3342ed[_0x3f1f('0x28')]:undefined,'callbackat':_0x3342ed['callbackUniqueid']?moment()['format'](_0x3f1f('0x1b')):undefined,'CampaignId':_0x4f9ef7['id']})[_0x3f1f('0x2e')](_0x27826f());}}}});})['then'](function(){return _0x3083a0[_0x3f1f('0x30')]['findAll']({'attributes':['id'],'include':[{'model':_0x3083a0[_0x3f1f('0x38')],'as':_0x3f1f('0x3d'),'where':{'id':_0x3342ed[_0x3f1f('0x2d')]}}]})[_0x3f1f('0x20')](function(_0x53b2bf){if(_0x53b2bf){var _0x2548d3=[];for(var _0x445ccd=0x0,_0x3d0e26;_0x445ccd<_0x53b2bf[_0x3f1f('0x3a')];_0x445ccd+=0x1){_0x3d0e26=_0x53b2bf[_0x445ccd][_0x3f1f('0x15')]({'plain':!![]});_0x3083a0['CmHopperBlack'][_0x3f1f('0x26')]({'phone':_0x3342ed[_0x3f1f('0xc')],'ContactId':_0x3342ed['id'],'ListId':_0x3342ed['ListId'],'CampaignId':_0x3d0e26['id']})['catch'](function(_0x86f19c){logger[_0x3f1f('0x16')](_0x3f1f('0x40'),_0x3f1f('0x18'),_0x86f19c['message']);});}}});})[_0x3f1f('0x20')](function(){_0x57e13b();})['catch'](function(_0x3d80a1){logger['error'](_0x3f1f('0x40'),_0x3f1f('0x18'),_0x3d80a1['message']);_0x57e13b(_0x3d80a1);});}else{_0x57e13b(new Error(_0x3f1f('0x41')));}},'afterDestroy':function(_0x5aa267,_0x2845c1,_0x354f5f){var _0x3781de=_0x50ed7e[_0x3f1f('0x14')];var _0xd71360=_0x5aa267[_0x3f1f('0x15')]({'plain':!![]});return _0x3781de[_0x3f1f('0x25')]['findAll']({'raw':!![],'where':{'ListId':_0xd71360[_0x3f1f('0x2d')],'ContactId':_0xd71360['id']}})[_0x3f1f('0x20')](function(_0x45ff03){if(!_[_0x3f1f('0x42')](_0x45ff03)){var _0x5aa81e=[];for(var _0xb9f9df=0x0;_0xb9f9df<_0x45ff03[_0x3f1f('0x3a')];_0xb9f9df+=0x1){var _0xda45ce=_0x3781de[_0x3f1f('0x25')][_0x3f1f('0x43')]({'where':{'ListId':_0x45ff03[_0xb9f9df][_0x3f1f('0x2d')],'ContactId':_0x45ff03[_0xb9f9df][_0x3f1f('0x44')],'VoiceQueueId':_0x45ff03[_0xb9f9df][_0x3f1f('0x45')],'CampaignId':_0x45ff03[_0xb9f9df][_0x3f1f('0x46')]}});_0x5aa81e[_0x3f1f('0x47')](_0xda45ce);}return BPromise['all'](_0x5aa81e);}})[_0x3f1f('0x20')](function(_0x26adc8){logger[_0x3f1f('0x48')](_0x3f1f('0x49'),util[_0x3f1f('0x2f')](_0x26adc8,{'showHidden':![],'depth':null}));_0x354f5f();})[_0x3f1f('0x2e')](function(_0x3bfde8){logger['error']('[CmContact][afterDestroy][Error]',util[_0x3f1f('0x2f')](_0x3bfde8,{'showHidden':![],'depth':null}));_0x354f5f(_0x3bfde8);});}}});};