Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / api / cmHopperAdditionalPhone / cmHopperAdditionalPhone.rpc.js
index a488564..c50d49d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2f3=['isNil','scheduledat','add','minutes','countbusyretry','createdAt','updatedAt','phone','sequelize','transaction','update','IncrementPreviewCounters','field','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','OrderBy','ASC','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','entity','countnosuchnumberretry','countagentrejectretry','catch','ContactId','ListId','CmHopperAdditionalPhone','duration','waitTime'];(function(_0x2fd02e,_0x8ebcc5){var _0x4d7f54=function(_0x1437c0){while(--_0x1437c0){_0x2fd02e['push'](_0x2fd02e['shift']());}};_0x4d7f54(++_0x8ebcc5);}(_0xf2f3,0x15d));var _0x3f2f=function(_0x519ae0,_0x3db706){_0x519ae0=_0x519ae0-0x0;var _0x3c6c25=_0xf2f3[_0x519ae0];return _0x3c6c25;};'use strict';var _=require('lodash');var util=require(_0x3f2f('0x0'));var moment=require(_0x3f2f('0x1'));var BPromise=require(_0x3f2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f2f('0x3'));var db=require(_0x3f2f('0x4'))['db'];var utils=require(_0x3f2f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3f2f('0x6'));var jayson=require(_0x3f2f('0x7'));var client=jayson[_0x3f2f('0x8')][_0x3f2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbcd687,_0x4650c5,_0x401c52){return new BPromise(function(_0x19fe4a,_0xc83ca3){return client[_0x3f2f('0xa')](_0xbcd687,_0x401c52)[_0x3f2f('0xb')](function(_0x438f59){logger[_0x3f2f('0xc')](_0x3f2f('0xd'),_0x4650c5,_0x3f2f('0xe'));logger['debug'](_0x3f2f('0xf'),_0x4650c5,_0x3f2f('0xe'),JSON[_0x3f2f('0x10')](_0x438f59));if(_0x438f59['error']){if(_0x438f59[_0x3f2f('0x11')][_0x3f2f('0x12')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4650c5,_0x438f59[_0x3f2f('0x11')]['message']);return _0xc83ca3(_0x438f59['error'][_0x3f2f('0x13')]);}logger[_0x3f2f('0x11')](_0x3f2f('0xd'),_0x4650c5,_0x438f59['error']['message']);return _0x19fe4a(_0x438f59[_0x3f2f('0x11')][_0x3f2f('0x13')]);}else{logger[_0x3f2f('0xc')](_0x3f2f('0xd'),_0x4650c5,_0x3f2f('0xe'));_0x19fe4a(_0x438f59[_0x3f2f('0x14')][_0x3f2f('0x13')]);}})['catch'](function(_0x474ed2){logger[_0x3f2f('0x11')](_0x3f2f('0xd'),_0x4650c5,_0x474ed2);_0xc83ca3(_0x474ed2);});});}exports[_0x3f2f('0x15')]=function(_0x34813b){var _0x88470f=this;return new Promise(function(_0xb1602f,_0x4be3f7){return db[_0x3f2f('0x16')][_0x3f2f('0x17')]({'raw':!![],'where':{'ContactId':_0x34813b[_0x3f2f('0x18')]['ContactId'],'ListId':_0x34813b[_0x3f2f('0x18')]['ListId'],'VoiceQueueId':_0x34813b[_0x3f2f('0x18')][_0x3f2f('0x19')]===undefined?null:_0x34813b[_0x3f2f('0x18')][_0x3f2f('0x19')],'CampaignId':_0x34813b[_0x3f2f('0x18')][_0x3f2f('0x1a')]===undefined?null:_0x34813b[_0x3f2f('0x18')]['CampaignId']}})[_0x3f2f('0xb')](function(_0x38abf5){if(_0x38abf5!=null){return db['CmHopperAdditionalPhone'][_0x3f2f('0x17')]({'raw':!![],'where':{'CmHopperId':_0x38abf5['id'],'OrderBy':{'$gt':_0x38abf5[_0x3f2f('0x1b')]}},'order':[[_0x3f2f('0x1b'),_0x3f2f('0x1c')]]})[_0x3f2f('0xb')](function(_0x397395){var _0x33f2a5=0x0;if(_0x397395){if(_0x397395['countbusyretry']+_0x397395[_0x3f2f('0x1d')]+_0x397395[_0x3f2f('0x1e')]+_0x397395['countnosuchnumberretry']+_0x397395[_0x3f2f('0x1f')]+_0x397395[_0x3f2f('0x20')]+_0x397395[_0x3f2f('0x21')]+_0x397395['countagentrejectretry']<_0x34813b[_0x3f2f('0x22')]['dialGlobalMaxRetry'])_0x33f2a5=0x1;_0xb1602f({'additional':_0x33f2a5});}else{return db['CmHopperAdditionalPhone'][_0x3f2f('0x17')]({'raw':!![],'where':{'CmHopperId':_0x38abf5['id']},'order':[[_0x3f2f('0x1b'),_0x3f2f('0x1c')]]})[_0x3f2f('0xb')](function(_0x304cce){var _0x57d989=0x0;if(_0x304cce){if(_0x304cce['countbusyretry']+_0x304cce[_0x3f2f('0x1d')]+_0x304cce[_0x3f2f('0x1e')]+_0x304cce[_0x3f2f('0x23')]+_0x304cce[_0x3f2f('0x1f')]+_0x304cce[_0x3f2f('0x20')]+_0x304cce[_0x3f2f('0x21')]+_0x304cce[_0x3f2f('0x24')]<_0x34813b[_0x3f2f('0x22')]['dialGlobalMaxRetry'])_0x57d989=0x1;_0xb1602f({'additional':_0x57d989});}else{_0xb1602f({'additional':0x0});}})['catch'](function(_0x2696d6){logger[_0x3f2f('0x11')](_0x3f2f('0x15'),_0x2696d6['message']);_0x4be3f7(_0x88470f[_0x3f2f('0x11')](0x1f4,_0x2696d6[_0x3f2f('0x13')]));});}})[_0x3f2f('0x25')](function(_0x3cf14b){logger[_0x3f2f('0x11')]('VerifyAdditionalPhones',_0x3cf14b[_0x3f2f('0x13')]);_0x4be3f7(_0x88470f[_0x3f2f('0x11')](0x1f4,_0x3cf14b['message']));});}else _0xb1602f({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x114260){var _0x1bc226=this;return new Promise(function(_0x386705,_0x3a3c63){return db[_0x3f2f('0x16')][_0x3f2f('0x17')]({'raw':!![],'where':{'ContactId':_0x114260['body'][_0x3f2f('0x26')],'ListId':_0x114260[_0x3f2f('0x18')][_0x3f2f('0x27')],'VoiceQueueId':_0x114260[_0x3f2f('0x18')]['VoiceQueueId']===undefined?null:_0x114260[_0x3f2f('0x18')]['VoiceQueueId'],'CampaignId':_0x114260['body'][_0x3f2f('0x1a')]===undefined?null:_0x114260[_0x3f2f('0x18')][_0x3f2f('0x1a')]}})[_0x3f2f('0xb')](function(_0x4b97c6){if(_0x4b97c6!=null){return db[_0x3f2f('0x28')][_0x3f2f('0x17')]({'raw':!![],'where':{'CmHopperId':_0x4b97c6['id'],'OrderBy':{'$gte':_0x4b97c6[_0x3f2f('0x1b')]}},'order':[[_0x3f2f('0x1b'),_0x3f2f('0x1c')]]})[_0x3f2f('0xb')](function(_0x2c18db){if(_0x2c18db)return activateAdditionalPhone(_0x4b97c6,_0x114260[_0x3f2f('0x18')],_0x2c18db,_0x114260[_0x3f2f('0x29')],_0x114260[_0x3f2f('0x2a')])[_0x3f2f('0xb')](function(_0x46dc1){_0x386705(_0x46dc1);});else{return db[_0x3f2f('0x28')][_0x3f2f('0x17')]({'raw':!![],'where':{'CmHopperId':_0x4b97c6['id']},'order':[[_0x3f2f('0x1b'),_0x3f2f('0x1c')]]})[_0x3f2f('0xb')](function(_0x59a4d9){if(_0x59a4d9)return activateAdditionalPhone(_0x4b97c6,_0x114260[_0x3f2f('0x18')],_0x59a4d9,_0x114260[_0x3f2f('0x29')],_0x114260[_0x3f2f('0x2a')])[_0x3f2f('0xb')](function(_0x3d6344){_0x386705(_0x3d6344);});else{_0x386705({'id':_0x4b97c6['id'],'phone':''});}})['catch'](function(_0x4d6e1f){logger[_0x3f2f('0x11')]('VerifyAdditionalPhones',_0x4d6e1f[_0x3f2f('0x13')]);_0x3a3c63(_0x1bc226[_0x3f2f('0x11')](0x1f4,_0x4d6e1f[_0x3f2f('0x13')]));});}})[_0x3f2f('0x25')](function(_0x1ee64d){logger[_0x3f2f('0x11')](_0x3f2f('0x15'),_0x1ee64d[_0x3f2f('0x13')]);_0x3a3c63(_0x1bc226[_0x3f2f('0x11')](0x1f4,_0x1ee64d['message']));});}else _0x386705(0x1);});});};function activateAdditionalPhone(_0x999b2,_0x4569cc,_0x577665,_0x16b2c5,_0x455c33){return new Promise(function(_0x1d2555,_0x5b26fc){var _0x37e273;if(_[_0x3f2f('0x2b')](_0x577665[_0x3f2f('0x2c')])){_0x577665['scheduledat']=moment();}if(moment()>moment(_0x577665['scheduledat'])){_0x37e273=moment()[_0x3f2f('0x2d')](_0x455c33||0x3,_0x3f2f('0x2e'));}else{if(_0x577665[_0x3f2f('0x1b')]==0x0){_0x37e273=moment(_0x577665[_0x3f2f('0x2c')]);}else{_0x37e273=moment()['add'](_0x455c33||0x3,'minutes');}}if(_[_0x3f2f('0x2b')](_0x37e273)){_0x37e273=moment()[_0x3f2f('0x2d')](_0x455c33||0x3,_0x3f2f('0x2e'));}var _0x30c32a={'phone':_0x999b2['phone'],'active':0x0,'OrderBy':_[_0x3f2f('0x2b')](_0x999b2[_0x3f2f('0x1b')])?0x0:_0x999b2[_0x3f2f('0x1b')],'scheduledat':moment()[_0x3f2f('0x2d')](_0x16b2c5||0x1,_0x3f2f('0x2e')),'countbusyretry':_0x4569cc[_0x3f2f('0x2f')],'countcongestionretry':_0x4569cc[_0x3f2f('0x1d')],'countnoanswerretry':_0x4569cc['countnoanswerretry'],'countnosuchnumberretry':_0x4569cc['countnosuchnumberretry'],'countdropretry':_0x4569cc[_0x3f2f('0x1f')],'countabandonedretry':_0x4569cc[_0x3f2f('0x20')],'countmachineretry':_0x4569cc[_0x3f2f('0x21')],'countagentrejectretry':_0x4569cc['countagentrejectretry'],'createdAt':_0x4569cc[_0x3f2f('0x30')],'updatedAt':_0x4569cc[_0x3f2f('0x31')]};var _0x3eebea={'CmHopperId':_0x999b2['id'],'phone':_0x577665[_0x3f2f('0x32')],'active':0x0,'OrderBy':_[_0x3f2f('0x2b')](_0x577665[_0x3f2f('0x1b')])?0x0:_0x577665[_0x3f2f('0x1b')],'scheduledat':_0x37e273,'countbusyretry':_0x577665[_0x3f2f('0x2f')],'countcongestionretry':_0x577665[_0x3f2f('0x1d')],'countnoanswerretry':_0x577665[_0x3f2f('0x1e')],'countnosuchnumberretry':_0x577665['countnosuchnumberretry'],'countdropretry':_0x577665[_0x3f2f('0x1f')],'countabandonedretry':_0x577665[_0x3f2f('0x20')],'countmachineretry':_0x577665[_0x3f2f('0x21')],'countagentrejectretry':_0x577665[_0x3f2f('0x24')],'createdAt':_0x577665[_0x3f2f('0x30')],'updatedAt':_0x577665['updatedAt']};return db[_0x3f2f('0x33')][_0x3f2f('0x34')](function(_0x2777cb){return db[_0x3f2f('0x28')][_0x3f2f('0x35')](_0x30c32a,{'where':{'id':_0x577665['id']}},{'transaction':_0x2777cb})['then'](function(){return db[_0x3f2f('0x16')]['update'](_0x3eebea,{'where':{'id':_0x999b2['id']}},{'transaction':_0x2777cb});});})[_0x3f2f('0xb')](function(_0x32f7e8){_0x1d2555({'id':_0x999b2['id'],'phone':_0x577665['phone']});})[_0x3f2f('0x25')](function(_0x21fa2c){logger[_0x3f2f('0x11')]('activateAdditionalPhone',_0x21fa2c[_0x3f2f('0x13')]);_0x5b26fc({'error':_0x21fa2c[_0x3f2f('0x13')]});});});}exports[_0x3f2f('0x36')]=function(_0x2724b7){var _0x3fdd1b=this;return new Promise(function(_0xc99d58,_0x137eab){return db['CmHopper'][_0x3f2f('0x35')](_0x2724b7[_0x3f2f('0x18')][_0x3f2f('0x37')],{'where':{'id':_0x2724b7[_0x3f2f('0x18')]['id']}})['then'](function(_0x4d8f78){_0xc99d58(_0x4d8f78);})[_0x3f2f('0x25')](function(_0x18ce6b){logger['error'](_0x3f2f('0x36'),_0x18ce6b[_0x3f2f('0x13')]);_0x137eab(_0x3fdd1b[_0x3f2f('0x11')](0x1f4,_0x18ce6b[_0x3f2f('0x13')]));});});};
\ No newline at end of file
+var _0x649d=['VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','CmHopperAdditionalPhone','waitTime','duration','scheduledat','add','isNil','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','catch'];(function(_0x2aac37,_0x8bbcf6){var _0x27ac09=function(_0x16bb57){while(--_0x16bb57){_0x2aac37['push'](_0x2aac37['shift']());}};_0x27ac09(++_0x8bbcf6);}(_0x649d,0xc7));var _0xd649=function(_0x1c1bf2,_0x270319){_0x1c1bf2=_0x1c1bf2-0x0;var _0x21b809=_0x649d[_0x1c1bf2];return _0x21b809;};'use strict';var _=require(_0xd649('0x0'));var util=require('util');var moment=require(_0xd649('0x1'));var BPromise=require(_0xd649('0x2'));var rs=require(_0xd649('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd649('0x4'))['db'];var utils=require(_0xd649('0x5'));var logger=require(_0xd649('0x6'))(_0xd649('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd649('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45c5e1,_0x85dda7,_0x97380){return new BPromise(function(_0x1b81e7,_0x2cd1fd){return client[_0xd649('0x9')](_0x45c5e1,_0x97380)[_0xd649('0xa')](function(_0x35441b){logger[_0xd649('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x85dda7,_0xd649('0xc'));logger[_0xd649('0xd')](_0xd649('0xe'),_0x85dda7,'request\x20sent',JSON[_0xd649('0xf')](_0x35441b));if(_0x35441b[_0xd649('0x10')]){if(_0x35441b[_0xd649('0x10')][_0xd649('0x11')]===0x1f4){logger[_0xd649('0x10')](_0xd649('0x12'),_0x85dda7,_0x35441b[_0xd649('0x10')][_0xd649('0x13')]);return _0x2cd1fd(_0x35441b[_0xd649('0x10')]['message']);}logger['error'](_0xd649('0x12'),_0x85dda7,_0x35441b[_0xd649('0x10')][_0xd649('0x13')]);return _0x1b81e7(_0x35441b[_0xd649('0x10')]['message']);}else{logger[_0xd649('0xb')](_0xd649('0x12'),_0x85dda7,_0xd649('0xc'));_0x1b81e7(_0x35441b['result'][_0xd649('0x13')]);}})[_0xd649('0x14')](function(_0xbfc9b6){logger[_0xd649('0x10')](_0xd649('0x12'),_0x85dda7,_0xbfc9b6);_0x2cd1fd(_0xbfc9b6);});});}exports[_0xd649('0x15')]=function(_0x1e67aa){var _0x4f9993=this;return new Promise(function(_0x529c79,_0x3cf75c){return db[_0xd649('0x16')][_0xd649('0x17')]({'raw':!![],'where':{'ContactId':_0x1e67aa[_0xd649('0x18')][_0xd649('0x19')],'ListId':_0x1e67aa[_0xd649('0x18')][_0xd649('0x1a')],'VoiceQueueId':_0x1e67aa[_0xd649('0x18')][_0xd649('0x1b')]===undefined?null:_0x1e67aa[_0xd649('0x18')]['VoiceQueueId'],'CampaignId':_0x1e67aa[_0xd649('0x18')][_0xd649('0x1c')]===undefined?null:_0x1e67aa['body'][_0xd649('0x1c')]}})['then'](function(_0x30d98c){if(_0x30d98c!=null){return db['CmHopperAdditionalPhone'][_0xd649('0x17')]({'raw':!![],'where':{'CmHopperId':_0x30d98c['id'],'OrderBy':{'$gt':_0x30d98c[_0xd649('0x1d')]}},'order':[['OrderBy',_0xd649('0x1e')]]})[_0xd649('0xa')](function(_0x21a856){var _0xfc61ca=0x0;if(_0x21a856){if(_0x21a856[_0xd649('0x1f')]+_0x21a856[_0xd649('0x20')]+_0x21a856[_0xd649('0x21')]+_0x21a856[_0xd649('0x22')]+_0x21a856[_0xd649('0x23')]+_0x21a856[_0xd649('0x24')]+_0x21a856[_0xd649('0x25')]+_0x21a856[_0xd649('0x26')]<_0x1e67aa[_0xd649('0x27')]['dialGlobalMaxRetry'])_0xfc61ca=0x1;_0x529c79({'additional':_0xfc61ca});}else{return db[_0xd649('0x28')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x30d98c['id']},'order':[['OrderBy','ASC']]})[_0xd649('0xa')](function(_0x19fd76){var _0xeba77b=0x0;if(_0x19fd76){if(_0x19fd76['countbusyretry']+_0x19fd76[_0xd649('0x20')]+_0x19fd76[_0xd649('0x21')]+_0x19fd76[_0xd649('0x22')]+_0x19fd76['countdropretry']+_0x19fd76[_0xd649('0x24')]+_0x19fd76[_0xd649('0x25')]+_0x19fd76[_0xd649('0x26')]<_0x1e67aa[_0xd649('0x27')]['dialGlobalMaxRetry'])_0xeba77b=0x1;_0x529c79({'additional':_0xeba77b});}else{_0x529c79({'additional':0x0});}})[_0xd649('0x14')](function(_0x561a06){logger[_0xd649('0x10')]('VerifyAdditionalPhones',_0x561a06[_0xd649('0x13')]);_0x3cf75c(_0x4f9993[_0xd649('0x10')](0x1f4,_0x561a06[_0xd649('0x13')]));});}})[_0xd649('0x14')](function(_0x32f26e){logger[_0xd649('0x10')]('VerifyAdditionalPhones',_0x32f26e[_0xd649('0x13')]);_0x3cf75c(_0x4f9993[_0xd649('0x10')](0x1f4,_0x32f26e[_0xd649('0x13')]));});}else _0x529c79({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x20b4a9){var _0x359733=this;return new Promise(function(_0x599db8,_0x51c866){return db[_0xd649('0x16')][_0xd649('0x17')]({'raw':!![],'where':{'ContactId':_0x20b4a9[_0xd649('0x18')][_0xd649('0x19')],'ListId':_0x20b4a9[_0xd649('0x18')]['ListId'],'VoiceQueueId':_0x20b4a9[_0xd649('0x18')]['VoiceQueueId']===undefined?null:_0x20b4a9[_0xd649('0x18')][_0xd649('0x1b')],'CampaignId':_0x20b4a9['body'][_0xd649('0x1c')]===undefined?null:_0x20b4a9[_0xd649('0x18')][_0xd649('0x1c')]}})[_0xd649('0xa')](function(_0x297910){if(_0x297910!=null){return db['CmHopperAdditionalPhone'][_0xd649('0x17')]({'raw':!![],'where':{'CmHopperId':_0x297910['id'],'OrderBy':{'$gte':_0x297910['OrderBy']}},'order':[['OrderBy',_0xd649('0x1e')]]})[_0xd649('0xa')](function(_0x3f8dd3){if(_0x3f8dd3)return activateAdditionalPhone(_0x297910,_0x20b4a9[_0xd649('0x18')],_0x3f8dd3,_0x20b4a9['duration'],_0x20b4a9[_0xd649('0x29')])[_0xd649('0xa')](function(_0x5b4530){_0x599db8(_0x5b4530);});else{return db[_0xd649('0x28')][_0xd649('0x17')]({'raw':!![],'where':{'CmHopperId':_0x297910['id']},'order':[['OrderBy',_0xd649('0x1e')]]})[_0xd649('0xa')](function(_0x118cce){if(_0x118cce)return activateAdditionalPhone(_0x297910,_0x20b4a9[_0xd649('0x18')],_0x118cce,_0x20b4a9[_0xd649('0x2a')],_0x20b4a9[_0xd649('0x29')])['then'](function(_0x4a9cbf){_0x599db8(_0x4a9cbf);});else{_0x599db8({'id':_0x297910['id'],'phone':''});}})[_0xd649('0x14')](function(_0x195358){logger[_0xd649('0x10')]('VerifyAdditionalPhones',_0x195358[_0xd649('0x13')]);_0x51c866(_0x359733[_0xd649('0x10')](0x1f4,_0x195358[_0xd649('0x13')]));});}})[_0xd649('0x14')](function(_0x100ac5){logger[_0xd649('0x10')](_0xd649('0x15'),_0x100ac5[_0xd649('0x13')]);_0x51c866(_0x359733[_0xd649('0x10')](0x1f4,_0x100ac5[_0xd649('0x13')]));});}else _0x599db8(0x1);});});};function activateAdditionalPhone(_0x237135,_0x145b61,_0x20a63d,_0x3f6d92,_0xec4487){return new Promise(function(_0x344153,_0x3d2adc){var _0x8e2c4f;if(_['isNil'](_0x20a63d[_0xd649('0x2b')])){_0x20a63d[_0xd649('0x2b')]=moment();}if(moment()>moment(_0x20a63d['scheduledat'])){_0x8e2c4f=moment()[_0xd649('0x2c')](_0xec4487||0x3,'minutes');}else{if(_0x20a63d['OrderBy']==0x0){_0x8e2c4f=moment(_0x20a63d[_0xd649('0x2b')]);}else{_0x8e2c4f=moment()[_0xd649('0x2c')](_0xec4487||0x3,'minutes');}}if(_[_0xd649('0x2d')](_0x8e2c4f)){_0x8e2c4f=moment()[_0xd649('0x2c')](_0xec4487||0x3,_0xd649('0x2e'));}var _0xf91a18={'phone':_0x237135[_0xd649('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x237135[_0xd649('0x1d')])?0x0:_0x237135[_0xd649('0x1d')],'scheduledat':moment()[_0xd649('0x2c')](_0x3f6d92||0x1,_0xd649('0x2e')),'countbusyretry':_0x145b61['countbusyretry'],'countcongestionretry':_0x145b61[_0xd649('0x20')],'countnoanswerretry':_0x145b61['countnoanswerretry'],'countnosuchnumberretry':_0x145b61[_0xd649('0x22')],'countdropretry':_0x145b61['countdropretry'],'countabandonedretry':_0x145b61[_0xd649('0x24')],'countmachineretry':_0x145b61[_0xd649('0x25')],'countagentrejectretry':_0x145b61['countagentrejectretry'],'createdAt':_0x145b61[_0xd649('0x30')],'updatedAt':_0x145b61[_0xd649('0x31')]};var _0x70d7e4={'CmHopperId':_0x237135['id'],'phone':_0x20a63d['phone'],'active':0x0,'OrderBy':_[_0xd649('0x2d')](_0x20a63d[_0xd649('0x1d')])?0x0:_0x20a63d[_0xd649('0x1d')],'scheduledat':_0x8e2c4f,'countbusyretry':_0x20a63d[_0xd649('0x1f')],'countcongestionretry':_0x20a63d[_0xd649('0x20')],'countnoanswerretry':_0x20a63d[_0xd649('0x21')],'countnosuchnumberretry':_0x20a63d[_0xd649('0x22')],'countdropretry':_0x20a63d['countdropretry'],'countabandonedretry':_0x20a63d[_0xd649('0x24')],'countmachineretry':_0x20a63d[_0xd649('0x25')],'countagentrejectretry':_0x20a63d[_0xd649('0x26')],'createdAt':_0x20a63d[_0xd649('0x30')],'updatedAt':_0x20a63d[_0xd649('0x31')]};return db[_0xd649('0x32')][_0xd649('0x33')](function(_0x583106){return db[_0xd649('0x28')][_0xd649('0x34')](_0xf91a18,{'where':{'id':_0x20a63d['id']}},{'transaction':_0x583106})['then'](function(){return db['CmHopper'][_0xd649('0x34')](_0x70d7e4,{'where':{'id':_0x237135['id']}},{'transaction':_0x583106});});})[_0xd649('0xa')](function(_0x121ce6){_0x344153({'id':_0x237135['id'],'phone':_0x20a63d[_0xd649('0x2f')]});})[_0xd649('0x14')](function(_0x4ebae7){logger[_0xd649('0x10')]('activateAdditionalPhone',_0x4ebae7[_0xd649('0x13')]);_0x3d2adc({'error':_0x4ebae7[_0xd649('0x13')]});});});}exports[_0xd649('0x35')]=function(_0x34cbde){var _0x19e894=this;return new Promise(function(_0x3510a7,_0x3f1b67){return db[_0xd649('0x16')][_0xd649('0x34')](_0x34cbde[_0xd649('0x18')][_0xd649('0x36')],{'where':{'id':_0x34cbde[_0xd649('0x18')]['id']}})[_0xd649('0xa')](function(_0x35849a){_0x3510a7(_0x35849a);})['catch'](function(_0xea4ed9){logger[_0xd649('0x10')](_0xd649('0x35'),_0xea4ed9[_0xd649('0x13')]);_0x3f1b67(_0x19e894[_0xd649('0x10')](0x1f4,_0xea4ed9[_0xd649('0x13')]));});});};
\ No newline at end of file