Built motion from commit 953226e6.|2.6.32
[motion2.git] / server / api / cmHopperAdditionalPhone / cmHopperAdditionalPhone.rpc.js
index fb50c55..94b3704 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc155=['countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','OrderBy','ASC','countdropretry','VerifyAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','debug','stringify','code','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','info','request\x20sent','catch','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry'];(function(_0x48e28a,_0x58ccbb){var _0x2a2cfa=function(_0x2aa7ae){while(--_0x2aa7ae){_0x48e28a['push'](_0x48e28a['shift']());}};_0x2a2cfa(++_0x58ccbb);}(_0xc155,0x88));var _0x5c15=function(_0x45fc83,_0x1679a8){_0x45fc83=_0x45fc83-0x0;var _0x8006f7=_0xc155[_0x45fc83];return _0x8006f7;};'use strict';var _=require('lodash');var util=require(_0x5c15('0x0'));var moment=require(_0x5c15('0x1'));var BPromise=require(_0x5c15('0x2'));var rs=require(_0x5c15('0x3'));var fs=require('fs');var Redis=require(_0x5c15('0x4'));var db=require(_0x5c15('0x5'))['db'];var utils=require(_0x5c15('0x6'));var logger=require('../../config/logger')(_0x5c15('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c15('0x8'));var client=jayson[_0x5c15('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e1c78,_0x2b24c3,_0x58f8c1){return new BPromise(function(_0x33b933,_0x51da68){return client[_0x5c15('0xa')](_0x3e1c78,_0x58f8c1)[_0x5c15('0xb')](function(_0x3b14cf){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2b24c3,'request\x20sent');logger[_0x5c15('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x2b24c3,'request\x20sent',JSON[_0x5c15('0xd')](_0x3b14cf));if(_0x3b14cf['error']){if(_0x3b14cf['error'][_0x5c15('0xe')]===0x1f4){logger[_0x5c15('0xf')](_0x5c15('0x10'),_0x2b24c3,_0x3b14cf[_0x5c15('0xf')][_0x5c15('0x11')]);return _0x51da68(_0x3b14cf[_0x5c15('0xf')]['message']);}logger['error'](_0x5c15('0x10'),_0x2b24c3,_0x3b14cf[_0x5c15('0xf')][_0x5c15('0x11')]);return _0x33b933(_0x3b14cf[_0x5c15('0xf')]['message']);}else{logger[_0x5c15('0x12')](_0x5c15('0x10'),_0x2b24c3,_0x5c15('0x13'));_0x33b933(_0x3b14cf['result'][_0x5c15('0x11')]);}})[_0x5c15('0x14')](function(_0x2de4f9){logger[_0x5c15('0xf')](_0x5c15('0x10'),_0x2b24c3,_0x2de4f9);_0x51da68(_0x2de4f9);});});}exports['VerifyAdditionalPhones']=function(_0xfcea41){var _0x5b5a5b=this;return new Promise(function(_0x3f6c91,_0x4f3e35){return db[_0x5c15('0x15')][_0x5c15('0x16')]({'raw':!![],'where':{'ContactId':_0xfcea41[_0x5c15('0x17')]['ContactId'],'ListId':_0xfcea41['body'][_0x5c15('0x18')],'VoiceQueueId':_0xfcea41[_0x5c15('0x17')][_0x5c15('0x19')]===undefined?null:_0xfcea41[_0x5c15('0x17')][_0x5c15('0x19')],'CampaignId':_0xfcea41[_0x5c15('0x17')][_0x5c15('0x1a')]===undefined?null:_0xfcea41['body'][_0x5c15('0x1a')]}})[_0x5c15('0xb')](function(_0x4d0547){if(_0x4d0547!=null){return db['CmHopperAdditionalPhone'][_0x5c15('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4d0547['id'],'OrderBy':{'$gt':_0x4d0547['OrderBy']}},'order':[['OrderBy','ASC']]})[_0x5c15('0xb')](function(_0x29e308){var _0x64e122=0x0;if(_0x29e308){if(_0x29e308[_0x5c15('0x1b')]+_0x29e308[_0x5c15('0x1c')]+_0x29e308[_0x5c15('0x1d')]+_0x29e308[_0x5c15('0x1e')]+_0x29e308['countdropretry']+_0x29e308[_0x5c15('0x1f')]+_0x29e308[_0x5c15('0x20')]+_0x29e308[_0x5c15('0x21')]<_0xfcea41[_0x5c15('0x22')][_0x5c15('0x23')])_0x64e122=0x1;_0x3f6c91({'additional':_0x64e122});}else{return db[_0x5c15('0x24')][_0x5c15('0x16')]({'raw':!![],'where':{'CmHopperId':_0x4d0547['id']},'order':[[_0x5c15('0x25'),_0x5c15('0x26')]]})['then'](function(_0x1f4737){var _0x11a940=0x0;if(_0x1f4737){if(_0x1f4737[_0x5c15('0x1b')]+_0x1f4737[_0x5c15('0x1c')]+_0x1f4737[_0x5c15('0x1d')]+_0x1f4737[_0x5c15('0x1e')]+_0x1f4737[_0x5c15('0x27')]+_0x1f4737[_0x5c15('0x1f')]+_0x1f4737[_0x5c15('0x20')]+_0x1f4737[_0x5c15('0x21')]<_0xfcea41[_0x5c15('0x22')][_0x5c15('0x23')])_0x11a940=0x1;_0x3f6c91({'additional':_0x11a940});}else{_0x3f6c91({'additional':0x0});}})[_0x5c15('0x14')](function(_0x53f70f){logger[_0x5c15('0xf')](_0x5c15('0x28'),_0x53f70f['message']);_0x4f3e35(_0x5b5a5b[_0x5c15('0xf')](0x1f4,_0x53f70f[_0x5c15('0x11')]));});}})[_0x5c15('0x14')](function(_0x32b2fb){logger[_0x5c15('0xf')](_0x5c15('0x28'),_0x32b2fb[_0x5c15('0x11')]);_0x4f3e35(_0x5b5a5b['error'](0x1f4,_0x32b2fb[_0x5c15('0x11')]));});}else _0x3f6c91({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x2079ba){var _0x1a4a32=this;return new Promise(function(_0x3ed31e,_0x27a752){return db[_0x5c15('0x15')][_0x5c15('0x16')]({'raw':!![],'where':{'ContactId':_0x2079ba[_0x5c15('0x17')][_0x5c15('0x29')],'ListId':_0x2079ba[_0x5c15('0x17')]['ListId'],'VoiceQueueId':_0x2079ba[_0x5c15('0x17')][_0x5c15('0x19')]===undefined?null:_0x2079ba[_0x5c15('0x17')][_0x5c15('0x19')],'CampaignId':_0x2079ba[_0x5c15('0x17')][_0x5c15('0x1a')]===undefined?null:_0x2079ba[_0x5c15('0x17')][_0x5c15('0x1a')]}})[_0x5c15('0xb')](function(_0x1ffaaa){if(_0x1ffaaa!=null){return db[_0x5c15('0x24')][_0x5c15('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1ffaaa['id'],'OrderBy':{'$gte':_0x1ffaaa['OrderBy']}},'order':[[_0x5c15('0x25'),_0x5c15('0x26')]]})[_0x5c15('0xb')](function(_0x4e05a2){if(_0x4e05a2)return activateAdditionalPhone(_0x1ffaaa,_0x2079ba[_0x5c15('0x17')],_0x4e05a2,_0x2079ba[_0x5c15('0x2a')],_0x2079ba['waitTime'])[_0x5c15('0xb')](function(_0x4b22be){_0x3ed31e(_0x4b22be);});else{return db[_0x5c15('0x24')][_0x5c15('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1ffaaa['id']},'order':[[_0x5c15('0x25'),'ASC']]})['then'](function(_0xea9660){if(_0xea9660)return activateAdditionalPhone(_0x1ffaaa,_0x2079ba[_0x5c15('0x17')],_0xea9660,_0x2079ba['duration'],_0x2079ba[_0x5c15('0x2b')])['then'](function(_0x279099){_0x3ed31e(_0x279099);});else{_0x3ed31e({'id':_0x1ffaaa['id'],'phone':''});}})[_0x5c15('0x14')](function(_0x2d61dc){logger[_0x5c15('0xf')](_0x5c15('0x28'),_0x2d61dc[_0x5c15('0x11')]);_0x27a752(_0x1a4a32[_0x5c15('0xf')](0x1f4,_0x2d61dc['message']));});}})[_0x5c15('0x14')](function(_0x4d7659){logger[_0x5c15('0xf')](_0x5c15('0x28'),_0x4d7659[_0x5c15('0x11')]);_0x27a752(_0x1a4a32[_0x5c15('0xf')](0x1f4,_0x4d7659[_0x5c15('0x11')]));});}else _0x3ed31e(0x1);});});};function activateAdditionalPhone(_0x477535,_0x20063e,_0x3eb973,_0x3ca701,_0x1e9397){return new Promise(function(_0x4e729f,_0x395738){var _0x239538;if(_[_0x5c15('0x2c')](_0x3eb973[_0x5c15('0x2d')])){_0x3eb973[_0x5c15('0x2d')]=moment();}if(moment()>moment(_0x3eb973[_0x5c15('0x2d')])){_0x239538=moment()[_0x5c15('0x2e')](_0x1e9397||0x3,_0x5c15('0x2f'));}else{if(_0x3eb973[_0x5c15('0x25')]==0x0){_0x239538=moment(_0x3eb973[_0x5c15('0x2d')]);}else{_0x239538=moment()[_0x5c15('0x2e')](_0x1e9397||0x3,_0x5c15('0x2f'));}}if(_[_0x5c15('0x2c')](_0x239538)){_0x239538=moment()['add'](_0x1e9397||0x3,'minutes');}var _0x435809={'phone':_0x477535['phone'],'active':0x0,'OrderBy':_[_0x5c15('0x2c')](_0x477535[_0x5c15('0x25')])?0x0:_0x477535[_0x5c15('0x25')],'scheduledat':moment()['add'](_0x3ca701||0x1,'minutes'),'countbusyretry':_0x20063e[_0x5c15('0x1b')],'countcongestionretry':_0x20063e['countcongestionretry'],'countnoanswerretry':_0x20063e[_0x5c15('0x1d')],'countnosuchnumberretry':_0x20063e['countnosuchnumberretry'],'countdropretry':_0x20063e[_0x5c15('0x27')],'countabandonedretry':_0x20063e[_0x5c15('0x1f')],'countmachineretry':_0x20063e[_0x5c15('0x20')],'countagentrejectretry':_0x20063e[_0x5c15('0x21')],'createdAt':_0x20063e[_0x5c15('0x30')],'updatedAt':_0x20063e[_0x5c15('0x31')]};var _0x2aa7e5={'CmHopperId':_0x477535['id'],'phone':_0x3eb973[_0x5c15('0x32')],'active':0x0,'OrderBy':_[_0x5c15('0x2c')](_0x3eb973['OrderBy'])?0x0:_0x3eb973['OrderBy'],'scheduledat':_0x239538,'countbusyretry':_0x3eb973[_0x5c15('0x1b')],'countcongestionretry':_0x3eb973[_0x5c15('0x1c')],'countnoanswerretry':_0x3eb973['countnoanswerretry'],'countnosuchnumberretry':_0x3eb973[_0x5c15('0x1e')],'countdropretry':_0x3eb973['countdropretry'],'countabandonedretry':_0x3eb973[_0x5c15('0x1f')],'countmachineretry':_0x3eb973['countmachineretry'],'countagentrejectretry':_0x3eb973[_0x5c15('0x21')],'createdAt':_0x3eb973[_0x5c15('0x30')],'updatedAt':_0x3eb973[_0x5c15('0x31')]};return db['sequelize'][_0x5c15('0x33')](function(_0x5bf0ec){return db[_0x5c15('0x24')]['update'](_0x435809,{'where':{'id':_0x3eb973['id']}},{'transaction':_0x5bf0ec})[_0x5c15('0xb')](function(){return db[_0x5c15('0x15')][_0x5c15('0x34')](_0x2aa7e5,{'where':{'id':_0x477535['id']}},{'transaction':_0x5bf0ec});});})[_0x5c15('0xb')](function(_0x37fc7b){_0x4e729f({'id':_0x477535['id'],'phone':_0x3eb973[_0x5c15('0x32')]});})['catch'](function(_0x2aa60f){logger['error'](_0x5c15('0x35'),_0x2aa60f['message']);_0x395738({'error':_0x2aa60f[_0x5c15('0x11')]});});});}exports['IncrementPreviewCounters']=function(_0x59de8d){var _0x342b4c=this;return new Promise(function(_0x21b379,_0x2c50b3){return db[_0x5c15('0x15')][_0x5c15('0x34')](_0x59de8d['body'][_0x5c15('0x36')],{'where':{'id':_0x59de8d['body']['id']}})[_0x5c15('0xb')](function(_0x565a64){_0x21b379(_0x565a64);})['catch'](function(_0x242fd9){logger[_0x5c15('0xf')](_0x5c15('0x37'),_0x242fd9[_0x5c15('0x11')]);_0x2c50b3(_0x342b4c[_0x5c15('0xf')](0x1f4,_0x242fd9[_0x5c15('0x11')]));});});};
\ No newline at end of file
+var _0x02f4=['ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countabandonedretry','SwapAdditionalPhones','CmHopper','duration','waitTime','scheduledat','minutes','isNil','add','updatedAt','phone','createdAt','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0x02f4,0x142));var _0x402f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x02f4[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x402f('0x0'));var util=require(_0x402f('0x1'));var moment=require('moment');var BPromise=require(_0x402f('0x2'));var rs=require(_0x402f('0x3'));var fs=require('fs');var Redis=require(_0x402f('0x4'));var db=require(_0x402f('0x5'))['db'];var utils=require(_0x402f('0x6'));var logger=require(_0x402f('0x7'))(_0x402f('0x8'));var config=require(_0x402f('0x9'));var jayson=require(_0x402f('0xa'));var client=jayson[_0x402f('0xb')][_0x402f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x392904,_0x28ee78,_0x3bc4f1){return new BPromise(function(_0x12bad8,_0x5ca55d){return client['request'](_0x392904,_0x3bc4f1)[_0x402f('0xd')](function(_0x34711d){logger[_0x402f('0xe')](_0x402f('0xf'),_0x28ee78,_0x402f('0x10'));logger['debug'](_0x402f('0x11'),_0x28ee78,_0x402f('0x10'),JSON['stringify'](_0x34711d));if(_0x34711d[_0x402f('0x12')]){if(_0x34711d[_0x402f('0x12')][_0x402f('0x13')]===0x1f4){logger[_0x402f('0x12')](_0x402f('0xf'),_0x28ee78,_0x34711d[_0x402f('0x12')][_0x402f('0x14')]);return _0x5ca55d(_0x34711d[_0x402f('0x12')]['message']);}logger[_0x402f('0x12')](_0x402f('0xf'),_0x28ee78,_0x34711d['error'][_0x402f('0x14')]);return _0x12bad8(_0x34711d[_0x402f('0x12')][_0x402f('0x14')]);}else{logger[_0x402f('0xe')](_0x402f('0xf'),_0x28ee78,_0x402f('0x10'));_0x12bad8(_0x34711d[_0x402f('0x15')][_0x402f('0x14')]);}})[_0x402f('0x16')](function(_0xa71478){logger[_0x402f('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x28ee78,_0xa71478);_0x5ca55d(_0xa71478);});});}exports[_0x402f('0x17')]=function(_0x3a1a29){var _0x2bcd2a=this;return new Promise(function(_0x3066a8,_0x24d650){return db['CmHopper'][_0x402f('0x18')]({'raw':!![],'where':{'ContactId':_0x3a1a29[_0x402f('0x19')][_0x402f('0x1a')],'ListId':_0x3a1a29[_0x402f('0x19')][_0x402f('0x1b')],'VoiceQueueId':_0x3a1a29[_0x402f('0x19')][_0x402f('0x1c')]===undefined?null:_0x3a1a29[_0x402f('0x19')]['VoiceQueueId'],'CampaignId':_0x3a1a29[_0x402f('0x19')][_0x402f('0x1d')]===undefined?null:_0x3a1a29[_0x402f('0x19')][_0x402f('0x1d')]}})['then'](function(_0x4bca0e){if(_0x4bca0e!=null){return db[_0x402f('0x1e')][_0x402f('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4bca0e['id'],'OrderBy':{'$gt':_0x4bca0e[_0x402f('0x1f')]}},'order':[[_0x402f('0x1f'),_0x402f('0x20')]]})[_0x402f('0xd')](function(_0x28a1e4){var _0x48b554=0x0;if(_0x28a1e4){if(_0x28a1e4[_0x402f('0x21')]+_0x28a1e4[_0x402f('0x22')]+_0x28a1e4['countnoanswerretry']+_0x28a1e4[_0x402f('0x23')]+_0x28a1e4[_0x402f('0x24')]+_0x28a1e4['countabandonedretry']+_0x28a1e4[_0x402f('0x25')]+_0x28a1e4[_0x402f('0x26')]<_0x3a1a29[_0x402f('0x27')][_0x402f('0x28')])_0x48b554=0x1;_0x3066a8({'additional':_0x48b554});}else{return db[_0x402f('0x1e')][_0x402f('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4bca0e['id']},'order':[[_0x402f('0x1f'),'ASC']]})[_0x402f('0xd')](function(_0x1d001e){var _0x456564=0x0;if(_0x1d001e){if(_0x1d001e['countbusyretry']+_0x1d001e['countcongestionretry']+_0x1d001e[_0x402f('0x29')]+_0x1d001e['countnosuchnumberretry']+_0x1d001e['countdropretry']+_0x1d001e[_0x402f('0x2a')]+_0x1d001e[_0x402f('0x25')]+_0x1d001e['countagentrejectretry']<_0x3a1a29[_0x402f('0x27')][_0x402f('0x28')])_0x456564=0x1;_0x3066a8({'additional':_0x456564});}else{_0x3066a8({'additional':0x0});}})['catch'](function(_0xaf6cf8){logger[_0x402f('0x12')](_0x402f('0x17'),_0xaf6cf8[_0x402f('0x14')]);_0x24d650(_0x2bcd2a[_0x402f('0x12')](0x1f4,_0xaf6cf8[_0x402f('0x14')]));});}})['catch'](function(_0x205038){logger[_0x402f('0x12')](_0x402f('0x17'),_0x205038['message']);_0x24d650(_0x2bcd2a[_0x402f('0x12')](0x1f4,_0x205038[_0x402f('0x14')]));});}else _0x3066a8({'additional':0x0});});});};exports[_0x402f('0x2b')]=function(_0x4f50f2){var _0x1ca7f3=this;return new Promise(function(_0x3b1398,_0x4c9880){return db[_0x402f('0x2c')][_0x402f('0x18')]({'raw':!![],'where':{'ContactId':_0x4f50f2['body'][_0x402f('0x1a')],'ListId':_0x4f50f2['body'][_0x402f('0x1b')],'VoiceQueueId':_0x4f50f2[_0x402f('0x19')][_0x402f('0x1c')]===undefined?null:_0x4f50f2[_0x402f('0x19')]['VoiceQueueId'],'CampaignId':_0x4f50f2[_0x402f('0x19')][_0x402f('0x1d')]===undefined?null:_0x4f50f2[_0x402f('0x19')]['CampaignId']}})[_0x402f('0xd')](function(_0x587503){if(_0x587503!=null){return db[_0x402f('0x1e')][_0x402f('0x18')]({'raw':!![],'where':{'CmHopperId':_0x587503['id'],'OrderBy':{'$gte':_0x587503[_0x402f('0x1f')]}},'order':[[_0x402f('0x1f'),_0x402f('0x20')]]})[_0x402f('0xd')](function(_0x2589c9){if(_0x2589c9)return activateAdditionalPhone(_0x587503,_0x4f50f2[_0x402f('0x19')],_0x2589c9,_0x4f50f2[_0x402f('0x2d')],_0x4f50f2['waitTime'])[_0x402f('0xd')](function(_0x55ecce){_0x3b1398(_0x55ecce);});else{return db[_0x402f('0x1e')][_0x402f('0x18')]({'raw':!![],'where':{'CmHopperId':_0x587503['id']},'order':[[_0x402f('0x1f'),_0x402f('0x20')]]})[_0x402f('0xd')](function(_0x4a3b8c){if(_0x4a3b8c)return activateAdditionalPhone(_0x587503,_0x4f50f2[_0x402f('0x19')],_0x4a3b8c,_0x4f50f2[_0x402f('0x2d')],_0x4f50f2[_0x402f('0x2e')])[_0x402f('0xd')](function(_0x406041){_0x3b1398(_0x406041);});else{_0x3b1398({'id':_0x587503['id'],'phone':''});}})[_0x402f('0x16')](function(_0x68d0aa){logger[_0x402f('0x12')](_0x402f('0x17'),_0x68d0aa[_0x402f('0x14')]);_0x4c9880(_0x1ca7f3['error'](0x1f4,_0x68d0aa[_0x402f('0x14')]));});}})[_0x402f('0x16')](function(_0x2c7e00){logger[_0x402f('0x12')](_0x402f('0x17'),_0x2c7e00[_0x402f('0x14')]);_0x4c9880(_0x1ca7f3[_0x402f('0x12')](0x1f4,_0x2c7e00[_0x402f('0x14')]));});}else _0x3b1398(0x1);});});};function activateAdditionalPhone(_0x29c591,_0xbc0d4c,_0x204e47,_0x453553,_0x1a330e){return new Promise(function(_0x1d2f0b,_0x542fa0){var _0x4bd246;if(_['isNil'](_0x204e47[_0x402f('0x2f')])){_0x204e47[_0x402f('0x2f')]=moment();}if(moment()>moment(_0x204e47['scheduledat'])){_0x4bd246=moment()['add'](_0x1a330e||0x3,_0x402f('0x30'));}else{if(_0x204e47[_0x402f('0x1f')]==0x0){_0x4bd246=moment(_0x204e47[_0x402f('0x2f')]);}else{_0x4bd246=moment()['add'](_0x1a330e||0x3,_0x402f('0x30'));}}if(_[_0x402f('0x31')](_0x4bd246)){_0x4bd246=moment()[_0x402f('0x32')](_0x1a330e||0x3,_0x402f('0x30'));}var _0x5cfa47={'phone':_0x29c591['phone'],'active':0x0,'OrderBy':_[_0x402f('0x31')](_0x29c591[_0x402f('0x1f')])?0x0:_0x29c591[_0x402f('0x1f')],'scheduledat':moment()[_0x402f('0x32')](_0x453553||0x1,_0x402f('0x30')),'countbusyretry':_0xbc0d4c[_0x402f('0x21')],'countcongestionretry':_0xbc0d4c[_0x402f('0x22')],'countnoanswerretry':_0xbc0d4c['countnoanswerretry'],'countnosuchnumberretry':_0xbc0d4c[_0x402f('0x23')],'countdropretry':_0xbc0d4c['countdropretry'],'countabandonedretry':_0xbc0d4c[_0x402f('0x2a')],'countmachineretry':_0xbc0d4c[_0x402f('0x25')],'countagentrejectretry':_0xbc0d4c[_0x402f('0x26')],'createdAt':_0xbc0d4c['createdAt'],'updatedAt':_0xbc0d4c[_0x402f('0x33')]};var _0x36b963={'CmHopperId':_0x29c591['id'],'phone':_0x204e47[_0x402f('0x34')],'active':0x0,'OrderBy':_[_0x402f('0x31')](_0x204e47[_0x402f('0x1f')])?0x0:_0x204e47[_0x402f('0x1f')],'scheduledat':_0x4bd246,'countbusyretry':_0x204e47[_0x402f('0x21')],'countcongestionretry':_0x204e47[_0x402f('0x22')],'countnoanswerretry':_0x204e47['countnoanswerretry'],'countnosuchnumberretry':_0x204e47[_0x402f('0x23')],'countdropretry':_0x204e47[_0x402f('0x24')],'countabandonedretry':_0x204e47[_0x402f('0x2a')],'countmachineretry':_0x204e47['countmachineretry'],'countagentrejectretry':_0x204e47[_0x402f('0x26')],'createdAt':_0x204e47[_0x402f('0x35')],'updatedAt':_0x204e47[_0x402f('0x33')]};return db[_0x402f('0x36')][_0x402f('0x37')](function(_0xe08d56){return db['CmHopperAdditionalPhone'][_0x402f('0x38')](_0x5cfa47,{'where':{'id':_0x204e47['id']}},{'transaction':_0xe08d56})[_0x402f('0xd')](function(){return db[_0x402f('0x2c')]['update'](_0x36b963,{'where':{'id':_0x29c591['id']}},{'transaction':_0xe08d56});});})['then'](function(_0x5eb9b1){_0x1d2f0b({'id':_0x29c591['id'],'phone':_0x204e47['phone']});})['catch'](function(_0x16b659){logger[_0x402f('0x12')]('activateAdditionalPhone',_0x16b659[_0x402f('0x14')]);_0x542fa0({'error':_0x16b659['message']});});});}exports[_0x402f('0x39')]=function(_0x3e6148){var _0x2f05d0=this;return new Promise(function(_0x3d6d15,_0x471125){return db[_0x402f('0x2c')][_0x402f('0x38')](_0x3e6148[_0x402f('0x19')][_0x402f('0x3a')],{'where':{'id':_0x3e6148[_0x402f('0x19')]['id']}})[_0x402f('0xd')](function(_0x3c5afc){_0x3d6d15(_0x3c5afc);})[_0x402f('0x16')](function(_0x43214d){logger['error'](_0x402f('0x39'),_0x43214d[_0x402f('0x14')]);_0x471125(_0x2f05d0['error'](0x1f4,_0x43214d[_0x402f('0x14')]));});});};
\ No newline at end of file