Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / cmHopperAdditionalPhone / cmHopperAdditionalPhone.rpc.js
index ae1441d..e70b04d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ec0=['VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countcongestionretry','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId'];(function(_0x32b249,_0x143c63){var _0x49a8fc=function(_0x21eb6e){while(--_0x21eb6e){_0x32b249['push'](_0x32b249['shift']());}};_0x49a8fc(++_0x143c63);}(_0x9ec0,0x14b));var _0x09ec=function(_0x35f3c9,_0x1aaafe){_0x35f3c9=_0x35f3c9-0x0;var _0x483f61=_0x9ec0[_0x35f3c9];return _0x483f61;};'use strict';var _=require(_0x09ec('0x0'));var util=require(_0x09ec('0x1'));var moment=require(_0x09ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x09ec('0x3'));var fs=require('fs');var Redis=require(_0x09ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x09ec('0x5'));var logger=require(_0x09ec('0x6'))(_0x09ec('0x7'));var config=require(_0x09ec('0x8'));var jayson=require(_0x09ec('0x9'));var client=jayson['client'][_0x09ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b6801,_0x2dcd39,_0x468664){return new BPromise(function(_0x1b23d0,_0x15abc0){return client[_0x09ec('0xb')](_0x1b6801,_0x468664)[_0x09ec('0xc')](function(_0xf81385){logger[_0x09ec('0xd')](_0x09ec('0xe'),_0x2dcd39,_0x09ec('0xf'));logger[_0x09ec('0x10')](_0x09ec('0x11'),_0x2dcd39,'request\x20sent',JSON[_0x09ec('0x12')](_0xf81385));if(_0xf81385[_0x09ec('0x13')]){if(_0xf81385[_0x09ec('0x13')][_0x09ec('0x14')]===0x1f4){logger[_0x09ec('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2dcd39,_0xf81385[_0x09ec('0x13')][_0x09ec('0x15')]);return _0x15abc0(_0xf81385[_0x09ec('0x13')][_0x09ec('0x15')]);}logger[_0x09ec('0x13')](_0x09ec('0xe'),_0x2dcd39,_0xf81385[_0x09ec('0x13')][_0x09ec('0x15')]);return _0x1b23d0(_0xf81385[_0x09ec('0x13')][_0x09ec('0x15')]);}else{logger[_0x09ec('0xd')](_0x09ec('0xe'),_0x2dcd39,_0x09ec('0xf'));_0x1b23d0(_0xf81385[_0x09ec('0x16')][_0x09ec('0x15')]);}})[_0x09ec('0x17')](function(_0x731c9f){logger[_0x09ec('0x13')](_0x09ec('0xe'),_0x2dcd39,_0x731c9f);_0x15abc0(_0x731c9f);});});}exports[_0x09ec('0x18')]=function(_0x3e51b7){var _0xbb520a=this;return new Promise(function(_0x19e71d,_0xf8ef9d){return db[_0x09ec('0x19')][_0x09ec('0x1a')]({'raw':!![],'where':{'ContactId':_0x3e51b7[_0x09ec('0x1b')]['ContactId'],'ListId':_0x3e51b7[_0x09ec('0x1b')][_0x09ec('0x1c')],'VoiceQueueId':_0x3e51b7[_0x09ec('0x1b')][_0x09ec('0x1d')]===undefined?null:_0x3e51b7[_0x09ec('0x1b')]['VoiceQueueId'],'CampaignId':_0x3e51b7['body'][_0x09ec('0x1e')]===undefined?null:_0x3e51b7['body'][_0x09ec('0x1e')]}})[_0x09ec('0xc')](function(_0x3f2acc){if(_0x3f2acc!=null){return db[_0x09ec('0x1f')][_0x09ec('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x3f2acc['id'],'OrderBy':{'$gt':_0x3f2acc[_0x09ec('0x20')]}},'order':[[_0x09ec('0x20'),_0x09ec('0x21')]]})[_0x09ec('0xc')](function(_0x4afcf1){var _0x3e845c=0x0;if(_0x4afcf1){if(_0x4afcf1[_0x09ec('0x22')]+_0x4afcf1['countcongestionretry']+_0x4afcf1[_0x09ec('0x23')]+_0x4afcf1[_0x09ec('0x24')]+_0x4afcf1[_0x09ec('0x25')]+_0x4afcf1[_0x09ec('0x26')]+_0x4afcf1[_0x09ec('0x27')]+_0x4afcf1[_0x09ec('0x28')]<_0x3e51b7[_0x09ec('0x29')][_0x09ec('0x2a')])_0x3e845c=0x1;_0x19e71d({'additional':_0x3e845c});}else{return db[_0x09ec('0x1f')][_0x09ec('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x3f2acc['id']},'order':[[_0x09ec('0x20'),_0x09ec('0x21')]]})[_0x09ec('0xc')](function(_0xdc079e){var _0x16fd28=0x0;if(_0xdc079e){if(_0xdc079e[_0x09ec('0x22')]+_0xdc079e[_0x09ec('0x2b')]+_0xdc079e[_0x09ec('0x23')]+_0xdc079e[_0x09ec('0x24')]+_0xdc079e[_0x09ec('0x25')]+_0xdc079e['countabandonedretry']+_0xdc079e[_0x09ec('0x27')]+_0xdc079e[_0x09ec('0x28')]<_0x3e51b7[_0x09ec('0x29')][_0x09ec('0x2a')])_0x16fd28=0x1;_0x19e71d({'additional':_0x16fd28});}else{_0x19e71d({'additional':0x0});}})[_0x09ec('0x17')](function(_0x3a50a5){logger[_0x09ec('0x13')](_0x09ec('0x18'),_0x3a50a5[_0x09ec('0x15')]);_0xf8ef9d(_0xbb520a[_0x09ec('0x13')](0x1f4,_0x3a50a5[_0x09ec('0x15')]));});}})[_0x09ec('0x17')](function(_0x2cc7aa){logger[_0x09ec('0x13')]('VerifyAdditionalPhones',_0x2cc7aa['message']);_0xf8ef9d(_0xbb520a[_0x09ec('0x13')](0x1f4,_0x2cc7aa[_0x09ec('0x15')]));});}else _0x19e71d({'additional':0x0});});});};exports[_0x09ec('0x2c')]=function(_0x11ec8d){var _0x3e3d12=this;return new Promise(function(_0x354993,_0x13ecbd){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x11ec8d['body'][_0x09ec('0x2d')],'ListId':_0x11ec8d[_0x09ec('0x1b')]['ListId'],'VoiceQueueId':_0x11ec8d[_0x09ec('0x1b')][_0x09ec('0x1d')]===undefined?null:_0x11ec8d['body'][_0x09ec('0x1d')],'CampaignId':_0x11ec8d[_0x09ec('0x1b')][_0x09ec('0x1e')]===undefined?null:_0x11ec8d[_0x09ec('0x1b')][_0x09ec('0x1e')]}})['then'](function(_0x4a7b74){if(_0x4a7b74!=null){return db['CmHopperAdditionalPhone'][_0x09ec('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x4a7b74['id'],'OrderBy':{'$gte':_0x4a7b74[_0x09ec('0x20')]}},'order':[[_0x09ec('0x20'),_0x09ec('0x21')]]})['then'](function(_0x4b75a0){if(_0x4b75a0)return activateAdditionalPhone(_0x4a7b74,_0x11ec8d[_0x09ec('0x1b')],_0x4b75a0,_0x11ec8d[_0x09ec('0x2e')],_0x11ec8d['waitTime'])['then'](function(_0x1afff4){_0x354993(_0x1afff4);});else{return db[_0x09ec('0x1f')][_0x09ec('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x4a7b74['id']},'order':[[_0x09ec('0x20'),_0x09ec('0x21')]]})[_0x09ec('0xc')](function(_0x29d7a1){if(_0x29d7a1)return activateAdditionalPhone(_0x4a7b74,_0x11ec8d['body'],_0x29d7a1,_0x11ec8d['duration'],_0x11ec8d[_0x09ec('0x2f')])[_0x09ec('0xc')](function(_0x595af2){_0x354993(_0x595af2);});else{_0x354993({'id':_0x4a7b74['id'],'phone':''});}})[_0x09ec('0x17')](function(_0x3f9532){logger[_0x09ec('0x13')](_0x09ec('0x18'),_0x3f9532[_0x09ec('0x15')]);_0x13ecbd(_0x3e3d12[_0x09ec('0x13')](0x1f4,_0x3f9532[_0x09ec('0x15')]));});}})[_0x09ec('0x17')](function(_0x4807a3){logger[_0x09ec('0x13')](_0x09ec('0x18'),_0x4807a3[_0x09ec('0x15')]);_0x13ecbd(_0x3e3d12[_0x09ec('0x13')](0x1f4,_0x4807a3['message']));});}else _0x354993(0x1);});});};function activateAdditionalPhone(_0xabe585,_0x379421,_0x1f4d93,_0x10ac03,_0x550bbf){return new Promise(function(_0x26545a,_0x257e80){var _0xf46d2;if(_[_0x09ec('0x30')](_0x1f4d93['scheduledat'])){_0x1f4d93[_0x09ec('0x31')]=moment();}if(moment()>moment(_0x1f4d93['scheduledat'])){_0xf46d2=moment()[_0x09ec('0x32')](_0x550bbf||0x3,'minutes');}else{if(_0x1f4d93[_0x09ec('0x20')]==0x0){_0xf46d2=moment(_0x1f4d93['scheduledat']);}else{_0xf46d2=moment()[_0x09ec('0x32')](_0x550bbf||0x3,_0x09ec('0x33'));}}if(_[_0x09ec('0x30')](_0xf46d2)){_0xf46d2=moment()[_0x09ec('0x32')](_0x550bbf||0x3,_0x09ec('0x33'));}var _0x4bb5d6={'phone':_0xabe585[_0x09ec('0x34')],'active':0x0,'OrderBy':_[_0x09ec('0x30')](_0xabe585[_0x09ec('0x20')])?0x0:_0xabe585['OrderBy'],'scheduledat':moment()[_0x09ec('0x32')](_0x10ac03||0x1,'minutes'),'countbusyretry':_0x379421[_0x09ec('0x22')],'countcongestionretry':_0x379421[_0x09ec('0x2b')],'countnoanswerretry':_0x379421[_0x09ec('0x23')],'countnosuchnumberretry':_0x379421[_0x09ec('0x24')],'countdropretry':_0x379421[_0x09ec('0x25')],'countabandonedretry':_0x379421['countabandonedretry'],'countmachineretry':_0x379421[_0x09ec('0x27')],'countagentrejectretry':_0x379421[_0x09ec('0x28')],'createdAt':_0x379421[_0x09ec('0x35')],'updatedAt':_0x379421[_0x09ec('0x36')]};var _0x4ee26b={'CmHopperId':_0xabe585['id'],'phone':_0x1f4d93[_0x09ec('0x34')],'active':0x0,'OrderBy':_[_0x09ec('0x30')](_0x1f4d93[_0x09ec('0x20')])?0x0:_0x1f4d93[_0x09ec('0x20')],'scheduledat':_0xf46d2,'countbusyretry':_0x1f4d93[_0x09ec('0x22')],'countcongestionretry':_0x1f4d93[_0x09ec('0x2b')],'countnoanswerretry':_0x1f4d93[_0x09ec('0x23')],'countnosuchnumberretry':_0x1f4d93[_0x09ec('0x24')],'countdropretry':_0x1f4d93['countdropretry'],'countabandonedretry':_0x1f4d93['countabandonedretry'],'countmachineretry':_0x1f4d93[_0x09ec('0x27')],'countagentrejectretry':_0x1f4d93['countagentrejectretry'],'createdAt':_0x1f4d93[_0x09ec('0x35')],'updatedAt':_0x1f4d93[_0x09ec('0x36')]};return db['sequelize'][_0x09ec('0x37')](function(_0x5ed28e){return db[_0x09ec('0x1f')][_0x09ec('0x38')](_0x4bb5d6,{'where':{'id':_0x1f4d93['id']}},{'transaction':_0x5ed28e})[_0x09ec('0xc')](function(){return db[_0x09ec('0x19')]['update'](_0x4ee26b,{'where':{'id':_0xabe585['id']}},{'transaction':_0x5ed28e});});})['then'](function(_0x2383fe){_0x26545a({'id':_0xabe585['id'],'phone':_0x1f4d93[_0x09ec('0x34')]});})[_0x09ec('0x17')](function(_0x473ee4){logger[_0x09ec('0x13')](_0x09ec('0x39'),_0x473ee4[_0x09ec('0x15')]);_0x257e80({'error':_0x473ee4[_0x09ec('0x15')]});});});}exports['IncrementPreviewCounters']=function(_0x37ef6e){var _0x492293=this;return new Promise(function(_0x266ad0,_0x3c9512){return db[_0x09ec('0x19')][_0x09ec('0x38')](_0x37ef6e['body'][_0x09ec('0x3a')],{'where':{'id':_0x37ef6e[_0x09ec('0x1b')]['id']}})[_0x09ec('0xc')](function(_0x2d905b){_0x266ad0(_0x2d905b);})[_0x09ec('0x17')](function(_0x49f696){logger[_0x09ec('0x13')](_0x09ec('0x3b'),_0x49f696[_0x09ec('0x15')]);_0x3c9512(_0x492293[_0x09ec('0x13')](0x1f4,_0x49f696[_0x09ec('0x15')]));});});};
\ No newline at end of file
+var _0x5d4e=['CmHopperAdditionalPhone,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','OrderBy','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','then','countcongestionretry','countabandonedretry','ListId','CmHopperAdditionalPhone','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x44d62d,_0x128717){var _0xd4383f=function(_0x288653){while(--_0x288653){_0x44d62d['push'](_0x44d62d['shift']());}};_0xd4383f(++_0x128717);}(_0x5d4e,0x112));var _0xe5d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5d4e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe5d4('0x0'));var util=require(_0xe5d4('0x1'));var moment=require(_0xe5d4('0x2'));var BPromise=require(_0xe5d4('0x3'));var rs=require(_0xe5d4('0x4'));var fs=require('fs');var Redis=require(_0xe5d4('0x5'));var db=require(_0xe5d4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5d4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe5d4('0x8'));var client=jayson[_0xe5d4('0x9')][_0xe5d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c4d97,_0x506e30,_0x4fc31c){return new BPromise(function(_0x91d5af,_0x5ac95b){return client['request'](_0x5c4d97,_0x4fc31c)['then'](function(_0x43b064){logger['info'](_0xe5d4('0xb'),_0x506e30,'request\x20sent');logger[_0xe5d4('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x506e30,_0xe5d4('0xd'),JSON[_0xe5d4('0xe')](_0x43b064));if(_0x43b064[_0xe5d4('0xf')]){if(_0x43b064[_0xe5d4('0xf')][_0xe5d4('0x10')]===0x1f4){logger[_0xe5d4('0xf')](_0xe5d4('0xb'),_0x506e30,_0x43b064[_0xe5d4('0xf')][_0xe5d4('0x11')]);return _0x5ac95b(_0x43b064[_0xe5d4('0xf')][_0xe5d4('0x11')]);}logger[_0xe5d4('0xf')](_0xe5d4('0xb'),_0x506e30,_0x43b064[_0xe5d4('0xf')][_0xe5d4('0x11')]);return _0x91d5af(_0x43b064[_0xe5d4('0xf')][_0xe5d4('0x11')]);}else{logger[_0xe5d4('0x12')](_0xe5d4('0xb'),_0x506e30,'request\x20sent');_0x91d5af(_0x43b064[_0xe5d4('0x13')][_0xe5d4('0x11')]);}})[_0xe5d4('0x14')](function(_0x5afebe){logger[_0xe5d4('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x506e30,_0x5afebe);_0x5ac95b(_0x5afebe);});});}exports[_0xe5d4('0x15')]=function(_0x25ba26){var _0x2a853e=this;return new Promise(function(_0x376ebf,_0x5031ae){return db[_0xe5d4('0x16')][_0xe5d4('0x17')]({'raw':!![],'where':{'ContactId':_0x25ba26[_0xe5d4('0x18')][_0xe5d4('0x19')],'ListId':_0x25ba26[_0xe5d4('0x18')]['ListId'],'VoiceQueueId':_0x25ba26[_0xe5d4('0x18')][_0xe5d4('0x1a')]===undefined?null:_0x25ba26['body'][_0xe5d4('0x1a')],'CampaignId':_0x25ba26[_0xe5d4('0x18')][_0xe5d4('0x1b')]===undefined?null:_0x25ba26[_0xe5d4('0x18')][_0xe5d4('0x1b')]}})['then'](function(_0x1959ff){if(_0x1959ff!=null){return db['CmHopperAdditionalPhone'][_0xe5d4('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1959ff['id'],'OrderBy':{'$gt':_0x1959ff[_0xe5d4('0x1c')]}},'order':[[_0xe5d4('0x1c'),'ASC']]})['then'](function(_0x4361e8){var _0x5c1f9d=0x0;if(_0x4361e8){if(_0x4361e8[_0xe5d4('0x1d')]+_0x4361e8['countcongestionretry']+_0x4361e8[_0xe5d4('0x1e')]+_0x4361e8[_0xe5d4('0x1f')]+_0x4361e8[_0xe5d4('0x20')]+_0x4361e8['countabandonedretry']+_0x4361e8[_0xe5d4('0x21')]+_0x4361e8[_0xe5d4('0x22')]<_0x25ba26[_0xe5d4('0x23')][_0xe5d4('0x24')])_0x5c1f9d=0x1;_0x376ebf({'additional':_0x5c1f9d});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1959ff['id']},'order':[[_0xe5d4('0x1c'),_0xe5d4('0x25')]]})[_0xe5d4('0x26')](function(_0x4f48e5){var _0xaaea67=0x0;if(_0x4f48e5){if(_0x4f48e5[_0xe5d4('0x1d')]+_0x4f48e5[_0xe5d4('0x27')]+_0x4f48e5[_0xe5d4('0x1e')]+_0x4f48e5['countnosuchnumberretry']+_0x4f48e5[_0xe5d4('0x20')]+_0x4f48e5[_0xe5d4('0x28')]+_0x4f48e5[_0xe5d4('0x21')]+_0x4f48e5[_0xe5d4('0x22')]<_0x25ba26['entity'][_0xe5d4('0x24')])_0xaaea67=0x1;_0x376ebf({'additional':_0xaaea67});}else{_0x376ebf({'additional':0x0});}})['catch'](function(_0x1859ef){logger[_0xe5d4('0xf')](_0xe5d4('0x15'),_0x1859ef['message']);_0x5031ae(_0x2a853e[_0xe5d4('0xf')](0x1f4,_0x1859ef['message']));});}})[_0xe5d4('0x14')](function(_0x1ebcb){logger[_0xe5d4('0xf')](_0xe5d4('0x15'),_0x1ebcb[_0xe5d4('0x11')]);_0x5031ae(_0x2a853e[_0xe5d4('0xf')](0x1f4,_0x1ebcb['message']));});}else _0x376ebf({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x5e4d36){var _0x396a2c=this;return new Promise(function(_0x47f4b1,_0x4c0829){return db[_0xe5d4('0x16')][_0xe5d4('0x17')]({'raw':!![],'where':{'ContactId':_0x5e4d36[_0xe5d4('0x18')][_0xe5d4('0x19')],'ListId':_0x5e4d36[_0xe5d4('0x18')][_0xe5d4('0x29')],'VoiceQueueId':_0x5e4d36[_0xe5d4('0x18')][_0xe5d4('0x1a')]===undefined?null:_0x5e4d36[_0xe5d4('0x18')]['VoiceQueueId'],'CampaignId':_0x5e4d36[_0xe5d4('0x18')]['CampaignId']===undefined?null:_0x5e4d36[_0xe5d4('0x18')]['CampaignId']}})[_0xe5d4('0x26')](function(_0x583ba4){if(_0x583ba4!=null){return db[_0xe5d4('0x2a')][_0xe5d4('0x17')]({'raw':!![],'where':{'CmHopperId':_0x583ba4['id'],'OrderBy':{'$gte':_0x583ba4[_0xe5d4('0x1c')]}},'order':[[_0xe5d4('0x1c'),_0xe5d4('0x25')]]})[_0xe5d4('0x26')](function(_0x35c93e){if(_0x35c93e)return activateAdditionalPhone(_0x583ba4,_0x5e4d36[_0xe5d4('0x18')],_0x35c93e,_0x5e4d36[_0xe5d4('0x2b')],_0x5e4d36[_0xe5d4('0x2c')])[_0xe5d4('0x26')](function(_0x57d461){_0x47f4b1(_0x57d461);});else{return db[_0xe5d4('0x2a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x583ba4['id']},'order':[['OrderBy','ASC']]})[_0xe5d4('0x26')](function(_0x8018ce){if(_0x8018ce)return activateAdditionalPhone(_0x583ba4,_0x5e4d36['body'],_0x8018ce,_0x5e4d36[_0xe5d4('0x2b')],_0x5e4d36['waitTime'])[_0xe5d4('0x26')](function(_0x2944a5){_0x47f4b1(_0x2944a5);});else{_0x47f4b1({'id':_0x583ba4['id'],'phone':''});}})[_0xe5d4('0x14')](function(_0x537aa8){logger[_0xe5d4('0xf')](_0xe5d4('0x15'),_0x537aa8[_0xe5d4('0x11')]);_0x4c0829(_0x396a2c['error'](0x1f4,_0x537aa8['message']));});}})['catch'](function(_0x395898){logger[_0xe5d4('0xf')](_0xe5d4('0x15'),_0x395898[_0xe5d4('0x11')]);_0x4c0829(_0x396a2c[_0xe5d4('0xf')](0x1f4,_0x395898['message']));});}else _0x47f4b1(0x1);});});};function activateAdditionalPhone(_0x319471,_0x3936ec,_0x571704,_0x3888c6,_0x32d1eb){return new Promise(function(_0x52d856,_0x1c1005){var _0x20bf90;if(_['isNil'](_0x571704['scheduledat'])){_0x571704[_0xe5d4('0x2d')]=moment();}if(moment()>moment(_0x571704[_0xe5d4('0x2d')])){_0x20bf90=moment()[_0xe5d4('0x2e')](_0x32d1eb||0x3,_0xe5d4('0x2f'));}else{if(_0x571704[_0xe5d4('0x1c')]==0x0){_0x20bf90=moment(_0x571704[_0xe5d4('0x2d')]);}else{_0x20bf90=moment()[_0xe5d4('0x2e')](_0x32d1eb||0x3,_0xe5d4('0x2f'));}}if(_[_0xe5d4('0x30')](_0x20bf90)){_0x20bf90=moment()[_0xe5d4('0x2e')](_0x32d1eb||0x3,_0xe5d4('0x2f'));}var _0xedfc4c={'phone':_0x319471[_0xe5d4('0x31')],'active':0x0,'OrderBy':_[_0xe5d4('0x30')](_0x319471[_0xe5d4('0x1c')])?0x0:_0x319471[_0xe5d4('0x1c')],'scheduledat':moment()[_0xe5d4('0x2e')](_0x3888c6||0x1,_0xe5d4('0x2f')),'countbusyretry':_0x3936ec[_0xe5d4('0x1d')],'countcongestionretry':_0x3936ec[_0xe5d4('0x27')],'countnoanswerretry':_0x3936ec['countnoanswerretry'],'countnosuchnumberretry':_0x3936ec[_0xe5d4('0x1f')],'countdropretry':_0x3936ec[_0xe5d4('0x20')],'countabandonedretry':_0x3936ec['countabandonedretry'],'countmachineretry':_0x3936ec['countmachineretry'],'countagentrejectretry':_0x3936ec[_0xe5d4('0x22')],'createdAt':_0x3936ec[_0xe5d4('0x32')],'updatedAt':_0x3936ec[_0xe5d4('0x33')]};var _0x410688={'CmHopperId':_0x319471['id'],'phone':_0x571704['phone'],'active':0x0,'OrderBy':_[_0xe5d4('0x30')](_0x571704[_0xe5d4('0x1c')])?0x0:_0x571704[_0xe5d4('0x1c')],'scheduledat':_0x20bf90,'countbusyretry':_0x571704['countbusyretry'],'countcongestionretry':_0x571704['countcongestionretry'],'countnoanswerretry':_0x571704[_0xe5d4('0x1e')],'countnosuchnumberretry':_0x571704['countnosuchnumberretry'],'countdropretry':_0x571704[_0xe5d4('0x20')],'countabandonedretry':_0x571704[_0xe5d4('0x28')],'countmachineretry':_0x571704['countmachineretry'],'countagentrejectretry':_0x571704['countagentrejectretry'],'createdAt':_0x571704[_0xe5d4('0x32')],'updatedAt':_0x571704['updatedAt']};return db[_0xe5d4('0x34')][_0xe5d4('0x35')](function(_0xbd7edf){return db['CmHopperAdditionalPhone'][_0xe5d4('0x36')](_0xedfc4c,{'where':{'id':_0x571704['id']}},{'transaction':_0xbd7edf})[_0xe5d4('0x26')](function(){return db[_0xe5d4('0x16')][_0xe5d4('0x36')](_0x410688,{'where':{'id':_0x319471['id']}},{'transaction':_0xbd7edf});});})[_0xe5d4('0x26')](function(_0x39d21a){_0x52d856({'id':_0x319471['id'],'phone':_0x571704[_0xe5d4('0x31')]});})[_0xe5d4('0x14')](function(_0x13049a){logger['error'](_0xe5d4('0x37'),_0x13049a[_0xe5d4('0x11')]);_0x1c1005({'error':_0x13049a[_0xe5d4('0x11')]});});});}exports[_0xe5d4('0x38')]=function(_0x2091ac){var _0x43792d=this;return new Promise(function(_0x14b161,_0x27f4cb){return db['CmHopper'][_0xe5d4('0x36')](_0x2091ac['body']['field'],{'where':{'id':_0x2091ac[_0xe5d4('0x18')]['id']}})[_0xe5d4('0x26')](function(_0x56b8eb){_0x14b161(_0x56b8eb);})[_0xe5d4('0x14')](function(_0x3d4faa){logger[_0xe5d4('0xf')](_0xe5d4('0x38'),_0x3d4faa[_0xe5d4('0x11')]);_0x27f4cb(_0x43792d[_0xe5d4('0xf')](0x1f4,_0x3d4faa['message']));});});};
\ No newline at end of file