Built motion from commit (unavailable).|2.5.1
[motion2.git] / server / api / cmHopper / cmHopper.rpc.js
index e7b8891..206647b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xad2e=['name','voicePause','length','includes','UserId','push','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','all','GetContactRecallMe','GetCmHopperPreview','Contact','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','attributes','map','model','debug','find','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','keys','User','Agent'];(function(_0x145fc7,_0x3907f4){var _0x241a7d=function(_0x49c355){while(--_0x49c355){_0x145fc7['push'](_0x145fc7['shift']());}};_0x241a7d(++_0x3907f4);}(_0xad2e,0xa4));var _0xead2=function(_0xed80dc,_0x1fa8dc){_0xed80dc=_0xed80dc-0x0;var _0x124c4d=_0xad2e[_0xed80dc];return _0x124c4d;};'use strict';var _=require('lodash');var util=require(_0xead2('0x0'));var moment=require(_0xead2('0x1'));var BPromise=require(_0xead2('0x2'));var rs=require(_0xead2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xead2('0x4'))['db'];var utils=require(_0xead2('0x5'));var logger=require(_0xead2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xead2('0x7'));var client=jayson[_0xead2('0x8')][_0xead2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116dc8,_0xe506e8,_0x5dee3e){return new BPromise(function(_0x4a9845,_0x16e36c){return client[_0xead2('0xa')](_0x116dc8,_0x5dee3e)[_0xead2('0xb')](function(_0x534b1d){logger[_0xead2('0xc')](_0xead2('0xd'),_0xe506e8,_0xead2('0xe'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0xe506e8,_0xead2('0xe'),JSON[_0xead2('0xf')](_0x534b1d));if(_0x534b1d[_0xead2('0x10')]){if(_0x534b1d[_0xead2('0x10')][_0xead2('0x11')]===0x1f4){logger[_0xead2('0x10')](_0xead2('0xd'),_0xe506e8,_0x534b1d[_0xead2('0x10')][_0xead2('0x12')]);return _0x16e36c(_0x534b1d[_0xead2('0x10')]['message']);}logger[_0xead2('0x10')](_0xead2('0xd'),_0xe506e8,_0x534b1d[_0xead2('0x10')]['message']);return _0x4a9845(_0x534b1d[_0xead2('0x10')][_0xead2('0x12')]);}else{logger['info'](_0xead2('0xd'),_0xe506e8,_0xead2('0xe'));_0x4a9845(_0x534b1d[_0xead2('0x13')][_0xead2('0x12')]);}})[_0xead2('0x14')](function(_0x5f33bb){logger['error']('CmHopper,\x20%s,\x20%s',_0xe506e8,_0x5f33bb);_0x16e36c(_0x5f33bb);});});}exports[_0xead2('0x15')]=function(_0x5c6d69){var _0x5d2483=this;return new Promise(function(_0xdbbd6b,_0x19a24a){return db[_0xead2('0x16')][_0xead2('0x17')]({'raw':_0x5c6d69['options']?_0x5c6d69[_0xead2('0x18')][_0xead2('0x19')]===undefined?!![]:![]:!![],'where':_0x5c6d69[_0xead2('0x18')]?_0x5c6d69['options'][_0xead2('0x1a')]||null:null,'attributes':_0x5c6d69[_0xead2('0x18')]?_0x5c6d69[_0xead2('0x18')]['attributes']||null:null,'limit':_0x5c6d69[_0xead2('0x18')]?_0x5c6d69[_0xead2('0x18')][_0xead2('0x1b')]||null:null,'include':_0x5c6d69['options']?_0x5c6d69[_0xead2('0x18')][_0xead2('0x1c')]?_['map'](_0x5c6d69[_0xead2('0x18')][_0xead2('0x1c')],function(_0xf9e726){return{'model':db[_0xf9e726['model']],'as':_0xf9e726['as'],'attributes':_0xf9e726[_0xead2('0x1d')],'include':_0xf9e726[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0xf9e726['include'],function(_0x4388df){return{'model':db[_0x4388df[_0xead2('0x1f')]],'as':_0x4388df['as'],'attributes':_0x4388df['attributes'],'include':_0x4388df['include']?_[_0xead2('0x1e')](_0x4388df[_0xead2('0x1c')],function(_0xfbf38d){return{'model':db[_0xfbf38d[_0xead2('0x1f')]],'as':_0xfbf38d['as'],'attributes':_0xfbf38d[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x2cd202){logger[_0xead2('0xc')]('GetCmHopper',_0x5c6d69);logger[_0xead2('0x20')](_0xead2('0x15'),_0x5c6d69,JSON[_0xead2('0xf')](_0x2cd202));_0xdbbd6b(_0x2cd202);})['catch'](function(_0x399201){logger[_0xead2('0x10')]('GetCmHopper',_0x399201[_0xead2('0x12')],_0x5c6d69);_0x19a24a(_0x5d2483[_0xead2('0x10')](0x1f4,_0x399201['message']));});});};exports['ShowCmHopper']=function(_0x3c9948){var _0x12a28e=this;return new Promise(function(_0x4afa7e,_0x3819ea){return db[_0xead2('0x16')][_0xead2('0x21')]({'raw':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')]['where']||null:null,'attributes':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')][_0xead2('0x1d')]||null:null,'include':_0x3c9948[_0xead2('0x18')]?_0x3c9948[_0xead2('0x18')][_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x3c9948[_0xead2('0x18')]['include'],function(_0x49b385){return{'model':db[_0x49b385[_0xead2('0x1f')]],'as':_0x49b385['as'],'attributes':_0x49b385[_0xead2('0x1d')],'include':_0x49b385[_0xead2('0x1c')]?_['map'](_0x49b385[_0xead2('0x1c')],function(_0x5e4517){return{'model':db[_0x5e4517[_0xead2('0x1f')]],'as':_0x5e4517['as'],'attributes':_0x5e4517['attributes'],'include':_0x5e4517[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x5e4517[_0xead2('0x1c')],function(_0xaf2f97){return{'model':db[_0xaf2f97[_0xead2('0x1f')]],'as':_0xaf2f97['as'],'attributes':_0xaf2f97[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x283b23){logger[_0xead2('0xc')]('ShowCmHopper',_0x3c9948);logger['debug'](_0xead2('0x22'),_0x3c9948,JSON['stringify'](_0x283b23));_0x4afa7e(_0x283b23);})[_0xead2('0x14')](function(_0x21a113){logger[_0xead2('0x10')](_0xead2('0x22'),_0x21a113[_0xead2('0x12')],_0x3c9948);_0x3819ea(_0x12a28e[_0xead2('0x10')](0x1f4,_0x21a113['message']));});});};exports['CreateCmHopper']=function(_0x1070f6){var _0x3c9884=this;return new Promise(function(_0x526f5a,_0x1d9278){return db[_0xead2('0x16')][_0xead2('0x23')](_0x1070f6[_0xead2('0x24')],{'raw':_0x1070f6[_0xead2('0x18')]?_0x1070f6['options'][_0xead2('0x19')]===undefined?!![]:![]:!![]})[_0xead2('0xb')](function(_0x4aefb1){logger[_0xead2('0xc')](_0xead2('0x25'),_0x1070f6);logger[_0xead2('0x20')](_0xead2('0x25'),_0x1070f6,JSON[_0xead2('0xf')](_0x4aefb1));_0x526f5a(_0x4aefb1);})[_0xead2('0x14')](function(_0x70a52d){logger[_0xead2('0x10')](_0xead2('0x25'),_0x70a52d['message'],_0x1070f6);_0x1d9278(_0x3c9884[_0xead2('0x10')](0x1f4,_0x70a52d[_0xead2('0x12')]));});});};exports[_0xead2('0x26')]=function(_0x1c4ee2){var _0xeed8b6=this;return new Promise(function(_0x526156,_0x2dcc2d){return db[_0xead2('0x16')][_0xead2('0x27')](_0x1c4ee2[_0xead2('0x24')],{'raw':_0x1c4ee2['options']?_0x1c4ee2[_0xead2('0x18')][_0xead2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c4ee2[_0xead2('0x18')]?_0x1c4ee2[_0xead2('0x18')]['where']||null:null,'attributes':_0x1c4ee2[_0xead2('0x18')]?_0x1c4ee2['options'][_0xead2('0x1d')]||null:null,'limit':_0x1c4ee2['options']?_0x1c4ee2['options']['limit']||null:null})['then'](function(_0x55193a){logger[_0xead2('0xc')](_0xead2('0x26'),_0x1c4ee2);logger[_0xead2('0x20')](_0xead2('0x26'),_0x1c4ee2,JSON['stringify'](_0x55193a));_0x526156(_0x55193a);})[_0xead2('0x14')](function(_0x4b4af6){logger[_0xead2('0x10')]('UpdateCmHopper',_0x4b4af6['message'],_0x1c4ee2);_0x2dcc2d(_0xeed8b6['error'](0x1f4,_0x4b4af6[_0xead2('0x12')]));});});};exports[_0xead2('0x28')]=function(_0x278b63){var _0x198226=this;return new Promise(function(_0x226a47,_0xa86640){return db[_0xead2('0x16')][_0xead2('0x29')]({'where':_0x278b63[_0xead2('0x18')]?_0x278b63[_0xead2('0x18')][_0xead2('0x1a')]||null:null})[_0xead2('0xb')](function(_0x33f614){logger[_0xead2('0xc')]('DestroyCmHopper',_0x278b63);logger[_0xead2('0x20')]('DestroyCmHopper',_0x278b63,JSON[_0xead2('0xf')](_0x33f614));_0x226a47(_0x33f614);})[_0xead2('0x14')](function(_0x15aec1){logger[_0xead2('0x10')](_0xead2('0x28'),_0x15aec1['message'],_0x278b63);_0xa86640(_0x198226[_0xead2('0x10')](0x1f4,_0x15aec1[_0xead2('0x12')]));});});};exports[_0xead2('0x2a')]=function(_0x6bbfca){var _0x1fb53e=this;return new Promise(function(_0x1c86c1,_0x227e94){return db[_0xead2('0x2b')][_0xead2('0x2c')]()[_0xead2('0xb')](function(_0x24c0a1){return db['sequelize'][_0xead2('0x2d')](function(_0x373881){return db[_0xead2('0x16')]['findAll']({'where':_0x6bbfca['options']?_0x6bbfca[_0xead2('0x18')][_0xead2('0x1a')]||null:null,'attributes':_0x6bbfca[_0xead2('0x18')]?_0x6bbfca['options'][_0xead2('0x1d')]||null:null,'limit':_0x6bbfca[_0xead2('0x18')]?_0x6bbfca['options']['limit']||null:null,'order':_0x6bbfca['options']?_0x6bbfca[_0xead2('0x18')][_0xead2('0x2e')]||null:null,'transaction':_0x373881,'lock':_0x373881[_0xead2('0x2f')][_0xead2('0x30')],'include':[{'model':db[_0xead2('0x2b')],'as':'Contact','attributes':_[_0xead2('0x31')](_0x24c0a1)},{'model':db[_0xead2('0x32')],'as':_0xead2('0x33'),'attributes':['id',_0xead2('0x34'),_0xead2('0x35')]}]})['then'](function(_0x53f37a){var _0x44c0e9=[];var _0x5cb5ea=[];for(var _0x3ca0b1=0x0;_0x3ca0b1<_0x53f37a[_0xead2('0x36')];_0x3ca0b1+=0x1){if(!_0x5cb5ea[_0xead2('0x37')](_0x53f37a[_0x3ca0b1][_0xead2('0x38')])){_0x5cb5ea[_0xead2('0x39')](_0x53f37a[_0x3ca0b1][_0xead2('0x38')]);_0x44c0e9[_0xead2('0x39')](_0x53f37a[_0x3ca0b1][_0xead2('0x27')](_0x6bbfca[_0xead2('0x24')],{'transaction':_0x373881}));}}return BPromise['all'](_0x44c0e9);});})['then'](function(_0x4152d2){logger[_0xead2('0xc')](_0xead2('0x2a'),_0x6bbfca);logger[_0xead2('0x20')](_0xead2('0x2a'),_0x6bbfca,JSON[_0xead2('0xf')](_0x4152d2));_0x1c86c1(_0x4152d2);})[_0xead2('0x14')](function(_0x25661a){logger[_0xead2('0x10')](_0xead2('0x2a'),_0x25661a[_0xead2('0x12')],_0x6bbfca);_0x227e94(_0x1fb53e[_0xead2('0x10')](0x1f4,_0x25661a[_0xead2('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x46bc8f){var _0xda1dfe=this;return new Promise(function(_0x2085e1,_0x240b84){return db[_0xead2('0x3a')][_0xead2('0x2d')](function(_0x31d2b8){return db[_0xead2('0x3b')]['create'](_0x46bc8f[_0xead2('0x24')],{'raw':_0x46bc8f[_0xead2('0x18')]?_0x46bc8f['options'][_0xead2('0x19')]===undefined?!![]:![]:!![],'transaction':_0x31d2b8})[_0xead2('0xb')](function(){return db[_0xead2('0x16')][_0xead2('0x29')]({'where':_0x46bc8f[_0xead2('0x18')]?_0x46bc8f[_0xead2('0x18')][_0xead2('0x1a')]||null:null,'transaction':_0x31d2b8});});})[_0xead2('0xb')](function(_0x48927a){logger[_0xead2('0xc')]('MoveContactManagedDialer',_0x46bc8f);logger[_0xead2('0x20')]('MoveContactManagedDialer',_0x46bc8f,JSON[_0xead2('0xf')](_0x48927a));_0x2085e1(_0x48927a);})[_0xead2('0x14')](function(_0x50f960){logger[_0xead2('0x10')]('MoveContactManagedDialer',_0x50f960['message'],_0x46bc8f);_0x240b84(_0xda1dfe[_0xead2('0x10')](0x1f4,_0x50f960[_0xead2('0x12')]));});});};exports[_0xead2('0x3c')]=function(_0x45ac0e){var _0x1f00b8=this;return new Promise(function(_0x3e9e4f,_0x5e85e4){return db['CmHopper']['findAll']({'raw':_0x45ac0e[_0xead2('0x18')]?_0x45ac0e[_0xead2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x45ac0e[_0xead2('0x18')]?_0x45ac0e['options'][_0xead2('0x1a')]||null:null,'attributes':[[db['sequelize']['fn'](_0xead2('0x3d'),db[_0xead2('0x3a')]['fn']('IF',db[_0xead2('0x3a')][_0xead2('0x3e')](_0xead2('0x3f')+util[_0xead2('0x40')]('\x22%s\x22',moment()[_0xead2('0x40')](_0xead2('0x41')))+_0xead2('0x42')))),_0xead2('0x43')]]})['then'](function(_0x217484){logger[_0xead2('0xc')](_0xead2('0x3c'),_0x45ac0e);logger[_0xead2('0x20')]('CountReScheduled',_0x45ac0e,JSON['stringify'](_0x217484));_0x3e9e4f(_0x217484);})['catch'](function(_0x5bbc61){logger[_0xead2('0x10')](_0xead2('0x3c'),_0x5bbc61[_0xead2('0x12')],_0x45ac0e);_0x5e85e4(_0x1f00b8['error'](0x1f4,_0x5bbc61[_0xead2('0x12')]));});});};exports['GetContactRecallMe']=function(_0x45616a){var _0x2ddb2d=this;return new Promise(function(_0x3760d4,_0x1e140d){return db[_0xead2('0x2b')][_0xead2('0x2c')]()['then'](function(_0x3e1d0d){return db[_0xead2('0x3a')][_0xead2('0x2d')](function(_0x5cd59c){return db[_0xead2('0x16')][_0xead2('0x17')]({'where':_0x45616a[_0xead2('0x18')]?_0x45616a[_0xead2('0x18')]['where']||null:null,'attributes':_0x45616a[_0xead2('0x18')]?_0x45616a[_0xead2('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x45616a['options']?_0x45616a[_0xead2('0x18')]['order']||null:null,'group':db[_0xead2('0x16')][_0xead2('0x38')],'transaction':_0x5cd59c,'lock':_0x5cd59c[_0xead2('0x2f')][_0xead2('0x30')],'include':_0x45616a[_0xead2('0x18')]?_0x45616a[_0xead2('0x18')]['include']?_[_0xead2('0x1e')](_0x45616a['options'][_0xead2('0x1c')],function(_0x52a5a6){return{'model':db[_0x52a5a6[_0xead2('0x1f')]],'as':_0x52a5a6['as'],'attributes':_0x52a5a6[_0xead2('0x1d')],'include':_0x52a5a6['include']?_[_0xead2('0x1e')](_0x52a5a6['include'],function(_0x3ff043){return{'model':db[_0x3ff043[_0xead2('0x1f')]],'as':_0x3ff043['as'],'attributes':_0x3ff043['attributes'],'include':_0x3ff043[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x3ff043[_0xead2('0x1c')],function(_0x303f15){return{'model':db[_0x303f15[_0xead2('0x1f')]],'as':_0x303f15['as'],'attributes':_0x303f15[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x50a6cf){var _0x51b7df=[];for(var _0x3c0ea5=0x0;_0x3c0ea5<_0x50a6cf[_0xead2('0x36')];_0x3c0ea5+=0x1){_0x51b7df[_0xead2('0x39')](_0x50a6cf[_0x3c0ea5]['update'](_0x45616a[_0xead2('0x24')],{'transaction':_0x5cd59c}));}return BPromise[_0xead2('0x44')](_0x51b7df);});})[_0xead2('0xb')](function(_0x4320c6){logger[_0xead2('0xc')]('GetContactRecallMe',_0x45616a);logger['debug'](_0xead2('0x45'),_0x45616a,JSON[_0xead2('0xf')](_0x4320c6));_0x3760d4(_0x4320c6);})['catch'](function(_0x35b15c){logger[_0xead2('0x10')]('GetContactRecallMe',_0x35b15c['message'],_0x45616a);_0x1e140d(_0x2ddb2d[_0xead2('0x10')](0x1f4,_0x35b15c['message']));});});});};exports[_0xead2('0x46')]=function(_0x40871e){var _0x10a903=this;return new Promise(function(_0x81f95b,_0x3b25d7){db['CmContact'][_0xead2('0x2c')]()[_0xead2('0xb')](function(_0x389d3f){return db[_0xead2('0x16')][_0xead2('0x17')]({'raw':_0x40871e[_0xead2('0x18')]?_0x40871e['options'][_0xead2('0x19')]===undefined?!![]:![]:!![],'where':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1a')]||null:null,'attributes':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1d')]||null:null,'limit':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1b')]||null:null,'include':_0x40871e[_0xead2('0x18')]?_0x40871e[_0xead2('0x18')][_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x40871e[_0xead2('0x18')][_0xead2('0x1c')],function(_0x2ec1a2){return{'model':db[_0x2ec1a2[_0xead2('0x1f')]],'as':_0x2ec1a2['as'],'attributes':_0x2ec1a2['as']===_0xead2('0x47')?_['keys'](_0x389d3f):_0x2ec1a2['attributes'],'include':_0x2ec1a2[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x2ec1a2[_0xead2('0x1c')],function(_0x10ed29){return{'model':db[_0x10ed29[_0xead2('0x1f')]],'as':_0x10ed29['as'],'attributes':_0x10ed29[_0xead2('0x1d')],'include':_0x10ed29[_0xead2('0x1c')]?_[_0xead2('0x1e')](_0x10ed29[_0xead2('0x1c')],function(_0x4857bf){return{'model':db[_0x4857bf['model']],'as':_0x4857bf['as'],'attributes':_0x4857bf[_0xead2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xead2('0xb')](function(_0x518665){logger[_0xead2('0xc')](_0xead2('0x15'),_0x40871e);logger[_0xead2('0x20')]('GetCmHopper',_0x40871e,JSON[_0xead2('0xf')](_0x518665));_0x81f95b(_0x518665);})[_0xead2('0x14')](function(_0x5cdc28){logger['error']('GetCmHopper',_0x5cdc28[_0xead2('0x12')],_0x40871e);_0x3b25d7(_0x10a903[_0xead2('0x10')](0x1f4,_0x5cdc28[_0xead2('0x12')]));});});});};
\ No newline at end of file
+var _0xf7d5=['CmHopperFinal','destroy','CountReScheduled','sequelize','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','length','all','GetCmHopperPreview','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetCmHopper','findAll','options','where','attributes','limit','map','include','model','debug','CmHopper','find','raw','ShowCmHopper','stringify','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','CmContact','describe','order','LOCK','UPDATE','keys','User','Agent','name','includes','UserId','push','update','GetContactDialer','MoveContactManagedDialer','transaction'];(function(_0x1df27c,_0x36189f){var _0x10b2d8=function(_0xf8b519){while(--_0xf8b519){_0x1df27c['push'](_0x1df27c['shift']());}};_0x10b2d8(++_0x36189f);}(_0xf7d5,0xe2));var _0x5f7d=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0xf7d5[_0x4702ee];return _0x62ca7d;};'use strict';var _=require('lodash');var util=require(_0x5f7d('0x0'));var moment=require(_0x5f7d('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f7d('0x2'));var fs=require('fs');var Redis=require(_0x5f7d('0x3'));var db=require(_0x5f7d('0x4'))['db'];var utils=require(_0x5f7d('0x5'));var logger=require(_0x5f7d('0x6'))(_0x5f7d('0x7'));var config=require(_0x5f7d('0x8'));var jayson=require(_0x5f7d('0x9'));var client=jayson[_0x5f7d('0xa')][_0x5f7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x364801,_0x5b6b0c,_0x3d322b){return new BPromise(function(_0x53e56b,_0x3bb5e9){return client[_0x5f7d('0xc')](_0x364801,_0x3d322b)[_0x5f7d('0xd')](function(_0x332bc4){logger['info'](_0x5f7d('0xe'),_0x5b6b0c,_0x5f7d('0xf'));logger['debug'](_0x5f7d('0x10'),_0x5b6b0c,_0x5f7d('0xf'),JSON['stringify'](_0x332bc4));if(_0x332bc4['error']){if(_0x332bc4[_0x5f7d('0x11')]['code']===0x1f4){logger[_0x5f7d('0x11')](_0x5f7d('0xe'),_0x5b6b0c,_0x332bc4[_0x5f7d('0x11')]['message']);return _0x3bb5e9(_0x332bc4[_0x5f7d('0x11')][_0x5f7d('0x12')]);}logger[_0x5f7d('0x11')]('CmHopper,\x20%s,\x20%s',_0x5b6b0c,_0x332bc4[_0x5f7d('0x11')][_0x5f7d('0x12')]);return _0x53e56b(_0x332bc4[_0x5f7d('0x11')][_0x5f7d('0x12')]);}else{logger[_0x5f7d('0x13')](_0x5f7d('0xe'),_0x5b6b0c,_0x5f7d('0xf'));_0x53e56b(_0x332bc4[_0x5f7d('0x14')][_0x5f7d('0x12')]);}})[_0x5f7d('0x15')](function(_0x3ea5d7){logger['error']('CmHopper,\x20%s,\x20%s',_0x5b6b0c,_0x3ea5d7);_0x3bb5e9(_0x3ea5d7);});});}exports[_0x5f7d('0x16')]=function(_0x20ff92){var _0x3b01df=this;return new Promise(function(_0x24ef83,_0x5b3783){return db['CmHopper'][_0x5f7d('0x17')]({'raw':_0x20ff92['options']?_0x20ff92['options']['raw']===undefined?!![]:![]:!![],'where':_0x20ff92[_0x5f7d('0x18')]?_0x20ff92[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':_0x20ff92[_0x5f7d('0x18')]?_0x20ff92['options'][_0x5f7d('0x1a')]||null:null,'limit':_0x20ff92['options']?_0x20ff92[_0x5f7d('0x18')][_0x5f7d('0x1b')]||null:null,'include':_0x20ff92['options']?_0x20ff92[_0x5f7d('0x18')]['include']?_[_0x5f7d('0x1c')](_0x20ff92[_0x5f7d('0x18')][_0x5f7d('0x1d')],function(_0x36ef22){return{'model':db[_0x36ef22[_0x5f7d('0x1e')]],'as':_0x36ef22['as'],'attributes':_0x36ef22[_0x5f7d('0x1a')],'include':_0x36ef22[_0x5f7d('0x1d')]?_[_0x5f7d('0x1c')](_0x36ef22['include'],function(_0x21cd02){return{'model':db[_0x21cd02[_0x5f7d('0x1e')]],'as':_0x21cd02['as'],'attributes':_0x21cd02[_0x5f7d('0x1a')],'include':_0x21cd02[_0x5f7d('0x1d')]?_['map'](_0x21cd02[_0x5f7d('0x1d')],function(_0xfcee37){return{'model':db[_0xfcee37[_0x5f7d('0x1e')]],'as':_0xfcee37['as'],'attributes':_0xfcee37[_0x5f7d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5f7d('0xd')](function(_0x5ddc8a){logger[_0x5f7d('0x13')](_0x5f7d('0x16'),_0x20ff92);logger[_0x5f7d('0x1f')](_0x5f7d('0x16'),_0x20ff92,JSON['stringify'](_0x5ddc8a));_0x24ef83(_0x5ddc8a);})[_0x5f7d('0x15')](function(_0x256c0e){logger[_0x5f7d('0x11')]('GetCmHopper',_0x256c0e['message'],_0x20ff92);_0x5b3783(_0x3b01df['error'](0x1f4,_0x256c0e[_0x5f7d('0x12')]));});});};exports['ShowCmHopper']=function(_0x48cd55){var _0x4c47dd=this;return new Promise(function(_0x43db57,_0x3fd734){return db[_0x5f7d('0x20')][_0x5f7d('0x21')]({'raw':_0x48cd55['options']?_0x48cd55[_0x5f7d('0x18')][_0x5f7d('0x22')]===undefined?!![]:![]:!![],'where':_0x48cd55[_0x5f7d('0x18')]?_0x48cd55[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':_0x48cd55['options']?_0x48cd55[_0x5f7d('0x18')][_0x5f7d('0x1a')]||null:null,'include':_0x48cd55[_0x5f7d('0x18')]?_0x48cd55['options'][_0x5f7d('0x1d')]?_['map'](_0x48cd55[_0x5f7d('0x18')][_0x5f7d('0x1d')],function(_0x332acd){return{'model':db[_0x332acd['model']],'as':_0x332acd['as'],'attributes':_0x332acd[_0x5f7d('0x1a')],'include':_0x332acd[_0x5f7d('0x1d')]?_['map'](_0x332acd['include'],function(_0x185f93){return{'model':db[_0x185f93[_0x5f7d('0x1e')]],'as':_0x185f93['as'],'attributes':_0x185f93[_0x5f7d('0x1a')],'include':_0x185f93['include']?_[_0x5f7d('0x1c')](_0x185f93['include'],function(_0x731f2){return{'model':db[_0x731f2[_0x5f7d('0x1e')]],'as':_0x731f2['as'],'attributes':_0x731f2[_0x5f7d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2107bc){logger[_0x5f7d('0x13')](_0x5f7d('0x23'),_0x48cd55);logger[_0x5f7d('0x1f')](_0x5f7d('0x23'),_0x48cd55,JSON[_0x5f7d('0x24')](_0x2107bc));_0x43db57(_0x2107bc);})[_0x5f7d('0x15')](function(_0x1b5e1b){logger[_0x5f7d('0x11')](_0x5f7d('0x23'),_0x1b5e1b['message'],_0x48cd55);_0x3fd734(_0x4c47dd['error'](0x1f4,_0x1b5e1b['message']));});});};exports[_0x5f7d('0x25')]=function(_0x237855){var _0x53f664=this;return new Promise(function(_0x4f4474,_0x33ed84){return db[_0x5f7d('0x20')][_0x5f7d('0x26')](_0x237855[_0x5f7d('0x27')],{'raw':_0x237855['options']?_0x237855[_0x5f7d('0x18')][_0x5f7d('0x22')]===undefined?!![]:![]:!![]})[_0x5f7d('0xd')](function(_0x5b2504){logger['info']('CreateCmHopper',_0x237855);logger['debug'](_0x5f7d('0x25'),_0x237855,JSON[_0x5f7d('0x24')](_0x5b2504));_0x4f4474(_0x5b2504);})['catch'](function(_0x4bdc78){logger[_0x5f7d('0x11')](_0x5f7d('0x25'),_0x4bdc78[_0x5f7d('0x12')],_0x237855);_0x33ed84(_0x53f664[_0x5f7d('0x11')](0x1f4,_0x4bdc78[_0x5f7d('0x12')]));});});};exports[_0x5f7d('0x28')]=function(_0x167022){var _0x4f8065=this;return new Promise(function(_0x48cd8a,_0x38e70a){return db[_0x5f7d('0x20')]['update'](_0x167022['body'],{'raw':_0x167022[_0x5f7d('0x18')]?_0x167022[_0x5f7d('0x18')][_0x5f7d('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x167022[_0x5f7d('0x18')]?_0x167022[_0x5f7d('0x18')]['where']||null:null,'attributes':_0x167022[_0x5f7d('0x18')]?_0x167022[_0x5f7d('0x18')][_0x5f7d('0x1a')]||null:null,'limit':_0x167022[_0x5f7d('0x18')]?_0x167022[_0x5f7d('0x18')][_0x5f7d('0x1b')]||null:null})[_0x5f7d('0xd')](function(_0xc36ccb){logger[_0x5f7d('0x13')](_0x5f7d('0x28'),_0x167022);logger[_0x5f7d('0x1f')]('UpdateCmHopper',_0x167022,JSON[_0x5f7d('0x24')](_0xc36ccb));_0x48cd8a(_0xc36ccb);})['catch'](function(_0x3adfc6){logger[_0x5f7d('0x11')](_0x5f7d('0x28'),_0x3adfc6[_0x5f7d('0x12')],_0x167022);_0x38e70a(_0x4f8065[_0x5f7d('0x11')](0x1f4,_0x3adfc6[_0x5f7d('0x12')]));});});};exports[_0x5f7d('0x29')]=function(_0x23d619){var _0x397289=this;return new Promise(function(_0x2c34b9,_0x29208f){return db[_0x5f7d('0x20')]['destroy']({'where':_0x23d619[_0x5f7d('0x18')]?_0x23d619[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null})['then'](function(_0x3cc10c){logger['info']('DestroyCmHopper',_0x23d619);logger['debug']('DestroyCmHopper',_0x23d619,JSON[_0x5f7d('0x24')](_0x3cc10c));_0x2c34b9(_0x3cc10c);})[_0x5f7d('0x15')](function(_0x4f162d){logger[_0x5f7d('0x11')]('DestroyCmHopper',_0x4f162d[_0x5f7d('0x12')],_0x23d619);_0x29208f(_0x397289['error'](0x1f4,_0x4f162d[_0x5f7d('0x12')]));});});};exports['GetContactDialer']=function(_0x44eb0c){var _0x431974=this;return new Promise(function(_0x4a1b4d,_0x25567e){return db[_0x5f7d('0x2a')][_0x5f7d('0x2b')]()['then'](function(_0x54d974){return db['sequelize']['transaction'](function(_0x59b3b4){return db[_0x5f7d('0x20')][_0x5f7d('0x17')]({'where':_0x44eb0c[_0x5f7d('0x18')]?_0x44eb0c[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':_0x44eb0c[_0x5f7d('0x18')]?_0x44eb0c[_0x5f7d('0x18')]['attributes']||null:null,'limit':_0x44eb0c[_0x5f7d('0x18')]?_0x44eb0c[_0x5f7d('0x18')][_0x5f7d('0x1b')]||null:null,'order':_0x44eb0c[_0x5f7d('0x18')]?_0x44eb0c[_0x5f7d('0x18')][_0x5f7d('0x2c')]||null:null,'transaction':_0x59b3b4,'lock':_0x59b3b4[_0x5f7d('0x2d')][_0x5f7d('0x2e')],'include':[{'model':db[_0x5f7d('0x2a')],'as':'Contact','attributes':_[_0x5f7d('0x2f')](_0x54d974)},{'model':db[_0x5f7d('0x30')],'as':_0x5f7d('0x31'),'attributes':['id',_0x5f7d('0x32'),'voicePause']}]})[_0x5f7d('0xd')](function(_0x5943ec){var _0x3e9c4c=[];var _0x386e03=[];for(var _0x17b779=0x0;_0x17b779<_0x5943ec['length'];_0x17b779+=0x1){if(!_0x386e03[_0x5f7d('0x33')](_0x5943ec[_0x17b779][_0x5f7d('0x34')])){_0x386e03[_0x5f7d('0x35')](_0x5943ec[_0x17b779][_0x5f7d('0x34')]);_0x3e9c4c[_0x5f7d('0x35')](_0x5943ec[_0x17b779][_0x5f7d('0x36')](_0x44eb0c[_0x5f7d('0x27')],{'transaction':_0x59b3b4}));}}return BPromise['all'](_0x3e9c4c);});})[_0x5f7d('0xd')](function(_0x2271f0){logger[_0x5f7d('0x13')](_0x5f7d('0x37'),_0x44eb0c);logger[_0x5f7d('0x1f')](_0x5f7d('0x37'),_0x44eb0c,JSON['stringify'](_0x2271f0));_0x4a1b4d(_0x2271f0);})[_0x5f7d('0x15')](function(_0x12de2c){logger[_0x5f7d('0x11')](_0x5f7d('0x37'),_0x12de2c[_0x5f7d('0x12')],_0x44eb0c);_0x25567e(_0x431974['error'](0x1f4,_0x12de2c['message']));});});});};exports[_0x5f7d('0x38')]=function(_0x591580){var _0x280592=this;return new Promise(function(_0x45c4d1,_0x35b966){return db['sequelize'][_0x5f7d('0x39')](function(_0x37b1f6){return db[_0x5f7d('0x3a')][_0x5f7d('0x26')](_0x591580['body'],{'raw':_0x591580['options']?_0x591580[_0x5f7d('0x18')][_0x5f7d('0x22')]===undefined?!![]:![]:!![],'transaction':_0x37b1f6})['then'](function(){return db[_0x5f7d('0x20')][_0x5f7d('0x3b')]({'where':_0x591580['options']?_0x591580['options'][_0x5f7d('0x19')]||null:null,'transaction':_0x37b1f6});});})[_0x5f7d('0xd')](function(_0x4a2180){logger[_0x5f7d('0x13')](_0x5f7d('0x38'),_0x591580);logger[_0x5f7d('0x1f')](_0x5f7d('0x38'),_0x591580,JSON['stringify'](_0x4a2180));_0x45c4d1(_0x4a2180);})['catch'](function(_0x1264bf){logger[_0x5f7d('0x11')](_0x5f7d('0x38'),_0x1264bf[_0x5f7d('0x12')],_0x591580);_0x35b966(_0x280592[_0x5f7d('0x11')](0x1f4,_0x1264bf[_0x5f7d('0x12')]));});});};exports[_0x5f7d('0x3c')]=function(_0x18d00e){var _0xa40529=this;return new Promise(function(_0x3af81d,_0x2e86f8){return db[_0x5f7d('0x20')][_0x5f7d('0x17')]({'raw':_0x18d00e[_0x5f7d('0x18')]?_0x18d00e[_0x5f7d('0x18')][_0x5f7d('0x22')]===undefined?!![]:![]:!![],'where':_0x18d00e[_0x5f7d('0x18')]?_0x18d00e[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':[[db[_0x5f7d('0x3d')]['fn']('COUNT',db[_0x5f7d('0x3d')]['fn']('IF',db[_0x5f7d('0x3d')][_0x5f7d('0x3e')](_0x5f7d('0x3f')+util[_0x5f7d('0x40')](_0x5f7d('0x41'),moment()[_0x5f7d('0x40')](_0x5f7d('0x42')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x5f7d('0xd')](function(_0x278eb9){logger[_0x5f7d('0x13')](_0x5f7d('0x3c'),_0x18d00e);logger[_0x5f7d('0x1f')](_0x5f7d('0x3c'),_0x18d00e,JSON['stringify'](_0x278eb9));_0x3af81d(_0x278eb9);})[_0x5f7d('0x15')](function(_0x54fd95){logger['error']('CountReScheduled',_0x54fd95[_0x5f7d('0x12')],_0x18d00e);_0x2e86f8(_0xa40529['error'](0x1f4,_0x54fd95[_0x5f7d('0x12')]));});});};exports[_0x5f7d('0x43')]=function(_0x248c33){var _0x2ab780=this;return new Promise(function(_0x296361,_0x24d78d){return db['CmContact']['describe']()[_0x5f7d('0xd')](function(_0x476d81){return db[_0x5f7d('0x3d')][_0x5f7d('0x39')](function(_0x477294){return db[_0x5f7d('0x20')][_0x5f7d('0x17')]({'where':_0x248c33[_0x5f7d('0x18')]?_0x248c33[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':_0x248c33[_0x5f7d('0x18')]?_0x248c33['options'][_0x5f7d('0x1a')]||null:null,'limit':0x1,'order':_0x248c33[_0x5f7d('0x18')]?_0x248c33['options']['order']||null:null,'group':db[_0x5f7d('0x20')]['UserId'],'transaction':_0x477294,'lock':_0x477294[_0x5f7d('0x2d')][_0x5f7d('0x2e')],'include':_0x248c33[_0x5f7d('0x18')]?_0x248c33[_0x5f7d('0x18')]['include']?_[_0x5f7d('0x1c')](_0x248c33[_0x5f7d('0x18')][_0x5f7d('0x1d')],function(_0x52141a){return{'model':db[_0x52141a[_0x5f7d('0x1e')]],'as':_0x52141a['as'],'attributes':_0x52141a[_0x5f7d('0x1a')],'include':_0x52141a[_0x5f7d('0x1d')]?_[_0x5f7d('0x1c')](_0x52141a['include'],function(_0x50fc75){return{'model':db[_0x50fc75[_0x5f7d('0x1e')]],'as':_0x50fc75['as'],'attributes':_0x50fc75[_0x5f7d('0x1a')],'include':_0x50fc75[_0x5f7d('0x1d')]?_['map'](_0x50fc75[_0x5f7d('0x1d')],function(_0x21790b){return{'model':db[_0x21790b['model']],'as':_0x21790b['as'],'attributes':_0x21790b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x559bf6){var _0x4ad365=[];for(var _0x25c1aa=0x0;_0x25c1aa<_0x559bf6[_0x5f7d('0x44')];_0x25c1aa+=0x1){_0x4ad365[_0x5f7d('0x35')](_0x559bf6[_0x25c1aa][_0x5f7d('0x36')](_0x248c33[_0x5f7d('0x27')],{'transaction':_0x477294}));}return BPromise[_0x5f7d('0x45')](_0x4ad365);});})[_0x5f7d('0xd')](function(_0x33ab8b){logger[_0x5f7d('0x13')](_0x5f7d('0x43'),_0x248c33);logger[_0x5f7d('0x1f')](_0x5f7d('0x43'),_0x248c33,JSON[_0x5f7d('0x24')](_0x33ab8b));_0x296361(_0x33ab8b);})[_0x5f7d('0x15')](function(_0x3c6993){logger[_0x5f7d('0x11')](_0x5f7d('0x43'),_0x3c6993[_0x5f7d('0x12')],_0x248c33);_0x24d78d(_0x2ab780[_0x5f7d('0x11')](0x1f4,_0x3c6993[_0x5f7d('0x12')]));});});});};exports[_0x5f7d('0x46')]=function(_0x80be4e){var _0x8a591c=this;return new Promise(function(_0x2551d0,_0x294e5b){db[_0x5f7d('0x2a')]['describe']()[_0x5f7d('0xd')](function(_0x350153){return db['CmHopper'][_0x5f7d('0x17')]({'raw':_0x80be4e[_0x5f7d('0x18')]?_0x80be4e['options'][_0x5f7d('0x22')]===undefined?!![]:![]:!![],'where':_0x80be4e[_0x5f7d('0x18')]?_0x80be4e[_0x5f7d('0x18')][_0x5f7d('0x19')]||null:null,'attributes':_0x80be4e[_0x5f7d('0x18')]?_0x80be4e[_0x5f7d('0x18')][_0x5f7d('0x1a')]||null:null,'limit':_0x80be4e[_0x5f7d('0x18')]?_0x80be4e['options'][_0x5f7d('0x1b')]||null:null,'include':_0x80be4e[_0x5f7d('0x18')]?_0x80be4e[_0x5f7d('0x18')][_0x5f7d('0x1d')]?_[_0x5f7d('0x1c')](_0x80be4e[_0x5f7d('0x18')][_0x5f7d('0x1d')],function(_0x44aaad){return{'model':db[_0x44aaad[_0x5f7d('0x1e')]],'as':_0x44aaad['as'],'attributes':_0x44aaad['as']==='Contact'?_[_0x5f7d('0x2f')](_0x350153):_0x44aaad[_0x5f7d('0x1a')],'include':_0x44aaad[_0x5f7d('0x1d')]?_[_0x5f7d('0x1c')](_0x44aaad[_0x5f7d('0x1d')],function(_0x3b305c){return{'model':db[_0x3b305c[_0x5f7d('0x1e')]],'as':_0x3b305c['as'],'attributes':_0x3b305c[_0x5f7d('0x1a')],'include':_0x3b305c[_0x5f7d('0x1d')]?_['map'](_0x3b305c[_0x5f7d('0x1d')],function(_0x32bc56){return{'model':db[_0x32bc56[_0x5f7d('0x1e')]],'as':_0x32bc56['as'],'attributes':_0x32bc56[_0x5f7d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5f7d('0xd')](function(_0x3b2152){logger['info'](_0x5f7d('0x16'),_0x80be4e);logger[_0x5f7d('0x1f')](_0x5f7d('0x16'),_0x80be4e,JSON[_0x5f7d('0x24')](_0x3b2152));_0x2551d0(_0x3b2152);})[_0x5f7d('0x15')](function(_0x407034){logger[_0x5f7d('0x11')]('GetCmHopper',_0x407034['message'],_0x80be4e);_0x294e5b(_0x8a591c['error'](0x1f4,_0x407034[_0x5f7d('0x12')]));});});});};
\ No newline at end of file