Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / cmHopperFinal / cmHopperFinal.controller.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 _0xbbf2=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','save','then','destroy','error','stack','name','status','send','merge','body','contact','agent','account','map','CmHopperFinal','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','rows','show','params','includeAll','find','catch','describe','update','uniqueid','findAll','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','insert','into','cm_hopper','fromQuery','phone','ListId','createdAt','updatedAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','Campaign','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','state\x20=\x204','checkContactHopper','findOne'];(function(_0x5dc18f,_0x2f6e87){var _0x3e7d87=function(_0x223a86){while(--_0x223a86){_0x5dc18f['push'](_0x5dc18f['shift']());}};_0x3e7d87(++_0x2f6e87);}(_0xbbf2,0x186));var _0x2bbf=function(_0x1a0c59,_0x3b4dcc){_0x1a0c59=_0x1a0c59-0x0;var _0xed67c9=_0xbbf2[_0x1a0c59];return _0xed67c9;};'use strict';var emlformat=require(_0x2bbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2bbf('0x1'));var jsonpatch=require(_0x2bbf('0x2'));var rp=require(_0x2bbf('0x3'));var moment=require(_0x2bbf('0x4'));var BPromise=require(_0x2bbf('0x5'));var Mustache=require(_0x2bbf('0x6'));var util=require(_0x2bbf('0x7'));var path=require(_0x2bbf('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2bbf('0x9'));var fs=require('fs');var fs_extra=require(_0x2bbf('0xa'));var _=require(_0x2bbf('0xb'));var squel=require(_0x2bbf('0xc'));var crypto=require('crypto');var jsforce=require(_0x2bbf('0xd'));var deskjs=require(_0x2bbf('0xe'));var toCsv=require(_0x2bbf('0xf'));var querystring=require('querystring');var Papa=require(_0x2bbf('0x10'));var Redis=require(_0x2bbf('0x11'));var authService=require(_0x2bbf('0x12'));var qs=require(_0x2bbf('0x13'));var as=require(_0x2bbf('0x14'));var hardwareService=require(_0x2bbf('0x15'));var logger=require('../../config/logger')(_0x2bbf('0x16'));var utils=require('../../config/utils');var config=require(_0x2bbf('0x17'));var licenseUtil=require(_0x2bbf('0x18'));var db=require(_0x2bbf('0x19'))['db'];function respondWithStatusCode(_0xc90c60,_0x220438){_0x220438=_0x220438||0xcc;return function(_0x17a638){if(_0x17a638){return _0xc90c60[_0x2bbf('0x1a')](_0x220438);}return _0xc90c60['status'](_0x220438)[_0x2bbf('0x1b')]();};}function respondWithResult(_0x3c93a6,_0x562bf8){_0x562bf8=_0x562bf8||0xc8;return function(_0x1f5730){if(_0x1f5730){return _0x3c93a6['status'](_0x562bf8)[_0x2bbf('0x1c')](_0x1f5730);}};}function respondWithFilteredResult(_0x28e773,_0x522c0b){return function(_0x17b41e){if(_0x17b41e){var _0x3ae6ee=typeof _0x522c0b[_0x2bbf('0x1d')]===_0x2bbf('0x1e')&&typeof _0x522c0b[_0x2bbf('0x1f')]===_0x2bbf('0x1e');var _0x3ff3ed=_0x17b41e[_0x2bbf('0x20')];var _0x2290ae=_0x3ae6ee?0x0:_0x522c0b[_0x2bbf('0x1d')];var _0x534341=_0x3ae6ee?_0x17b41e[_0x2bbf('0x20')]:_0x522c0b[_0x2bbf('0x1d')]+_0x522c0b[_0x2bbf('0x1f')];var _0x341baf;if(_0x534341>=_0x3ff3ed){_0x534341=_0x3ff3ed;_0x341baf=0xc8;}else{_0x341baf=0xce;}_0x28e773['status'](_0x341baf);return _0x28e773['set']('Content-Range',_0x2290ae+'-'+_0x534341+'/'+_0x3ff3ed)[_0x2bbf('0x1c')](_0x17b41e);}return null;};}function patchUpdates(_0x4abb84){return function(_0x5be870){try{jsonpatch['apply'](_0x5be870,_0x4abb84,!![]);}catch(_0xfcb3ba){return BPromise['reject'](_0xfcb3ba);}return _0x5be870[_0x2bbf('0x21')]();};}function saveUpdates(_0x578c03,_0x2667cf){return function(_0x5ae529){if(_0x5ae529){return _0x5ae529['update'](_0x578c03)[_0x2bbf('0x22')](function(_0x31f7){return _0x31f7;});}return null;};}function removeEntity(_0x81c0ac,_0x1f5d66){return function(_0x21bbd9){if(_0x21bbd9){return _0x21bbd9[_0x2bbf('0x23')]()[_0x2bbf('0x22')](function(){_0x81c0ac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x130e4a,_0x2d7c56){return function(_0x448661){if(!_0x448661){_0x130e4a[_0x2bbf('0x1a')](0x194);}return _0x448661;};}function handleError(_0x539221,_0x30befe){_0x30befe=_0x30befe||0x1f4;return function(_0x5352b3){logger[_0x2bbf('0x24')](_0x5352b3[_0x2bbf('0x25')]);if(_0x5352b3[_0x2bbf('0x26')]){delete _0x5352b3['name'];}_0x539221[_0x2bbf('0x27')](_0x30befe)[_0x2bbf('0x28')](_0x5352b3);};}function getMustacheRender(_0x3da335,_0x16f425){return Mustache['render'](_0x3da335,_[_0x2bbf('0x29')](_0x16f425[_0x2bbf('0x2a')],{'contact':_0x16f425[_0x2bbf('0x2b')],'message':_0x16f425['message'],'agent':_0x16f425[_0x2bbf('0x2c')],'interaction':_0x16f425['interaction'],'account':_0x16f425[_0x2bbf('0x2d')]}))||'';}exports['index']=function(_0x36d9ed,_0x34cf37){var _0xa7e9c2={},_0x43e678={},_0x5dfb29={'count':0x0,'rows':[]};var _0x2cb40a=_[_0x2bbf('0x2e')](db[_0x2bbf('0x2f')][_0x2bbf('0x30')],function(_0x57e806){return{'name':_0x57e806['fieldName'],'type':_0x57e806[_0x2bbf('0x31')][_0x2bbf('0x32')]};});_0x43e678['model']=_['map'](_0x2cb40a,_0x2bbf('0x26'));_0x43e678[_0x2bbf('0x33')]=_[_0x2bbf('0x34')](_0x36d9ed[_0x2bbf('0x33')]);_0x43e678[_0x2bbf('0x35')]=_['intersection'](_0x43e678['model'],_0x43e678['query']);_0xa7e9c2[_0x2bbf('0x36')]=_[_0x2bbf('0x37')](_0x43e678[_0x2bbf('0x38')],qs[_0x2bbf('0x39')](_0x36d9ed[_0x2bbf('0x33')][_0x2bbf('0x39')]));_0xa7e9c2[_0x2bbf('0x36')]=_0xa7e9c2[_0x2bbf('0x36')][_0x2bbf('0x3a')]?_0xa7e9c2[_0x2bbf('0x36')]:_0x43e678[_0x2bbf('0x38')];if(!_0x36d9ed['query'][_0x2bbf('0x3b')](_0x2bbf('0x3c'))){_0xa7e9c2[_0x2bbf('0x1f')]=qs['limit'](_0x36d9ed[_0x2bbf('0x33')][_0x2bbf('0x1f')]);_0xa7e9c2[_0x2bbf('0x1d')]=qs[_0x2bbf('0x1d')](_0x36d9ed[_0x2bbf('0x33')][_0x2bbf('0x1d')]);}_0xa7e9c2[_0x2bbf('0x3d')]=qs[_0x2bbf('0x3e')](_0x36d9ed[_0x2bbf('0x33')][_0x2bbf('0x3e')]);_0xa7e9c2[_0x2bbf('0x3f')]=qs[_0x2bbf('0x35')](_[_0x2bbf('0x40')](_0x36d9ed['query'],_0x43e678[_0x2bbf('0x35')]),_0x2cb40a);if(_0x36d9ed[_0x2bbf('0x33')][_0x2bbf('0x41')]){_0xa7e9c2[_0x2bbf('0x3f')]=_['merge'](_0xa7e9c2[_0x2bbf('0x3f')],{'$or':_['map'](_0x2cb40a,function(_0x4ba3dc){if(_0x4ba3dc[_0x2bbf('0x31')]!==_0x2bbf('0x42')){var _0xc49ca6={};_0xc49ca6[_0x4ba3dc[_0x2bbf('0x26')]]={'$like':'%'+_0x36d9ed[_0x2bbf('0x33')][_0x2bbf('0x41')]+'%'};return _0xc49ca6;}})});}_0xa7e9c2=_[_0x2bbf('0x29')]({},_0xa7e9c2,_0x36d9ed[_0x2bbf('0x43')]);var _0x4bcfff={'where':_0xa7e9c2[_0x2bbf('0x3f')]};return db[_0x2bbf('0x2f')][_0x2bbf('0x20')](_0x4bcfff)[_0x2bbf('0x22')](function(_0x18e292){_0x5dfb29[_0x2bbf('0x20')]=_0x18e292;if(_0x36d9ed['query']['includeAll']){_0xa7e9c2['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0xa7e9c2);})['then'](function(_0x357bec){_0x5dfb29[_0x2bbf('0x44')]=_0x357bec;return _0x5dfb29;})['then'](respondWithFilteredResult(_0x34cf37,_0xa7e9c2))['catch'](handleError(_0x34cf37,null));};exports[_0x2bbf('0x45')]=function(_0x14513b,_0x21579b){var _0x4e0be8={'raw':!![],'where':{'id':_0x14513b[_0x2bbf('0x46')]['id']}},_0x518938={};_0x518938[_0x2bbf('0x38')]=_['keys'](db[_0x2bbf('0x2f')]['rawAttributes']);_0x518938['query']=_[_0x2bbf('0x34')](_0x14513b['query']);_0x518938['filters']=_['intersection'](_0x518938[_0x2bbf('0x38')],_0x518938[_0x2bbf('0x33')]);_0x4e0be8[_0x2bbf('0x36')]=_[_0x2bbf('0x37')](_0x518938['model'],qs[_0x2bbf('0x39')](_0x14513b[_0x2bbf('0x33')][_0x2bbf('0x39')]));_0x4e0be8[_0x2bbf('0x36')]=_0x4e0be8[_0x2bbf('0x36')][_0x2bbf('0x3a')]?_0x4e0be8['attributes']:_0x518938[_0x2bbf('0x38')];if(_0x14513b[_0x2bbf('0x33')][_0x2bbf('0x47')]){_0x4e0be8['include']=[{'all':!![]}];}_0x4e0be8=_['merge']({},_0x4e0be8,_0x14513b[_0x2bbf('0x43')]);return db[_0x2bbf('0x2f')][_0x2bbf('0x48')](_0x4e0be8)[_0x2bbf('0x22')](handleEntityNotFound(_0x21579b,null))[_0x2bbf('0x22')](respondWithResult(_0x21579b,null))[_0x2bbf('0x49')](handleError(_0x21579b,null));};exports[_0x2bbf('0x4a')]=function(_0x300d2c,_0x32e3f0){return db['CmHopperFinal'][_0x2bbf('0x4a')]()[_0x2bbf('0x22')](respondWithResult(_0x32e3f0,null))[_0x2bbf('0x49')](handleError(_0x32e3f0,null));};exports[_0x2bbf('0x4b')]=function(_0x392131,_0x4594f2){if(_0x392131['body'][_0x2bbf('0x4c')]){delete _0x392131[_0x2bbf('0x2a')][_0x2bbf('0x4c')];}return db[_0x2bbf('0x2f')][_0x2bbf('0x48')]({'where':{'uniqueid':_0x392131[_0x2bbf('0x46')]['id']}})[_0x2bbf('0x22')](handleEntityNotFound(_0x4594f2,null))[_0x2bbf('0x22')](saveUpdates(_0x392131[_0x2bbf('0x2a')],null))[_0x2bbf('0x22')](respondWithResult(_0x4594f2,null))[_0x2bbf('0x49')](handleError(_0x4594f2,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x440001,_0x65d738,_0x129f70){return db['CmHopperFinal'][_0x2bbf('0x4d')]({'raw':![],'where':{'VoiceQueueId':_0x440001[_0x2bbf('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x2bbf('0x4e'),db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')]['literal'](_0x2bbf('0x50')))),_0x2bbf('0x51')],[db[_0x2bbf('0x4f')]['fn'](_0x2bbf('0x4e'),db[_0x2bbf('0x4f')]['fn']('IF',db['sequelize'][_0x2bbf('0x52')]('`state`\x20=\x203,\x201,\x20null'))),_0x2bbf('0x53')],[db[_0x2bbf('0x4f')]['fn'](_0x2bbf('0x4e'),db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')]['literal'](_0x2bbf('0x54')))),_0x2bbf('0x55')],[db[_0x2bbf('0x4f')]['fn']('COUNT',db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')][_0x2bbf('0x52')]('`state`\x20=\x208,\x201,\x20null'))),_0x2bbf('0x56')],[db[_0x2bbf('0x4f')]['fn']('COUNT',db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')][_0x2bbf('0x52')](_0x2bbf('0x57')))),_0x2bbf('0x58')],[db[_0x2bbf('0x4f')]['fn'](_0x2bbf('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x2bbf('0x52')](_0x2bbf('0x59')))),'abandonedContacts'],[db[_0x2bbf('0x4f')]['fn'](_0x2bbf('0x4e'),db['sequelize']['fn']('IF',db[_0x2bbf('0x4f')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x2bbf('0x4f')]['fn']('COUNT',db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')]['literal'](_0x2bbf('0x5a')))),_0x2bbf('0x5b')]]})['then'](handleEntityNotFound(_0x65d738,null))[_0x2bbf('0x22')](respondWithResult(_0x65d738,null))[_0x2bbf('0x49')](handleError(_0x65d738,null));};exports[_0x2bbf('0x5c')]=function(_0x237a5b,_0x5cf91d,_0x62997c){return db[_0x2bbf('0x2f')][_0x2bbf('0x4d')]({'raw':![],'where':{'CampaignId':_0x237a5b[_0x2bbf('0x46')]['id']},'attributes':[[db[_0x2bbf('0x4f')]['fn']('COUNT',db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')][_0x2bbf('0x52')](_0x2bbf('0x50')))),_0x2bbf('0x51')],[db['sequelize']['fn'](_0x2bbf('0x4e'),db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')][_0x2bbf('0x52')](_0x2bbf('0x5d')))),'noAnswerContacts'],[db[_0x2bbf('0x4f')]['fn']('COUNT',db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')][_0x2bbf('0x52')](_0x2bbf('0x54')))),_0x2bbf('0x55')],[db['sequelize']['fn']('COUNT',db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')][_0x2bbf('0x52')](_0x2bbf('0x5e')))),_0x2bbf('0x56')],[db[_0x2bbf('0x4f')]['fn'](_0x2bbf('0x4e'),db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')]['literal'](_0x2bbf('0x57')))),_0x2bbf('0x58')],[db[_0x2bbf('0x4f')]['fn'](_0x2bbf('0x4e'),db['sequelize']['fn']('IF',db[_0x2bbf('0x4f')]['literal'](_0x2bbf('0x59')))),'abandonedContacts'],[db[_0x2bbf('0x4f')]['fn'](_0x2bbf('0x4e'),db['sequelize']['fn']('IF',db[_0x2bbf('0x4f')][_0x2bbf('0x52')](_0x2bbf('0x5f')))),_0x2bbf('0x60')],[db[_0x2bbf('0x4f')]['fn'](_0x2bbf('0x4e'),db[_0x2bbf('0x4f')]['fn']('IF',db[_0x2bbf('0x4f')][_0x2bbf('0x52')](_0x2bbf('0x5a')))),'answeringMachine']]})[_0x2bbf('0x22')](handleEntityNotFound(_0x5cf91d,null))[_0x2bbf('0x22')](respondWithResult(_0x5cf91d,null))[_0x2bbf('0x49')](handleError(_0x5cf91d,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x53df7a,_0x42e4fa,_0x38efd2){return db['VoiceQueue'][_0x2bbf('0x48')]({'where':{'id':_0x53df7a[_0x2bbf('0x46')]['id']}})[_0x2bbf('0x22')](handleEntityNotFound(_0x42e4fa,null))[_0x2bbf('0x22')](function(_0x2c8533){var _0x1b8655;if(_0x2c8533){_0x1b8655=squel[_0x2bbf('0x61')]()[_0x2bbf('0x62')](_0x2bbf('0x63'))[_0x2bbf('0x64')]([_0x2bbf('0x65'),'scheduledAt','ContactId',_0x2bbf('0x66'),'VoiceQueueId',_0x2bbf('0x67'),_0x2bbf('0x68')],squel[_0x2bbf('0x69')]()[_0x2bbf('0x6a')]('ANY_VALUE(calleridnum)','phone')[_0x2bbf('0x6a')](_0x2bbf('0x6b'),_0x2bbf('0x6c'))['field'](_0x2bbf('0x6d'),_0x2bbf('0x6e'))['field'](_0x2bbf('0x6f'),'ListId')[_0x2bbf('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x2bbf('0x70'))[_0x2bbf('0x6a')]('NOW()',_0x2bbf('0x67'))['field'](_0x2bbf('0x6b'),_0x2bbf('0x68'))[_0x2bbf('0x71')](_0x2bbf('0x72'))[_0x2bbf('0x3f')](_0x2bbf('0x73'),_0x53df7a['params']['id']['toString']())[_0x2bbf('0x3f')](_0x2bbf('0x74'),_0x53df7a[_0x2bbf('0x2a')][_0x2bbf('0x75')][_0x2bbf('0x76')]())[_0x2bbf('0x3f')](_0x2bbf('0x77'))[_0x2bbf('0x3f')](_0x2bbf('0x78'),squel[_0x2bbf('0x69')]()[_0x2bbf('0x6a')](_0x2bbf('0x65'))[_0x2bbf('0x71')]('cm_hopper')[_0x2bbf('0x3f')](_0x2bbf('0x73'),_0x53df7a[_0x2bbf('0x46')]['id'][_0x2bbf('0x76')]()))[_0x2bbf('0x3f')](_0x2bbf('0x78'),squel[_0x2bbf('0x69')]()[_0x2bbf('0x6a')](_0x2bbf('0x79'))['from'](_0x2bbf('0x72'))['where']('VoiceQueueId\x20=\x20?',_0x53df7a[_0x2bbf('0x46')]['id'][_0x2bbf('0x76')]())[_0x2bbf('0x3f')]('state\x20=\x204'))[_0x2bbf('0x7a')](_0x2bbf('0x6e')))[_0x2bbf('0x76')]();return db['sequelize'][_0x2bbf('0x33')](_0x1b8655);}return[];})[_0x2bbf('0x22')](respondWithResult(_0x42e4fa,null))[_0x2bbf('0x49')](handleError(_0x42e4fa,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x5bb3b9,_0xcd4426,_0x323d80){return db[_0x2bbf('0x7b')][_0x2bbf('0x48')]({'where':{'id':_0x5bb3b9[_0x2bbf('0x46')]['id']}})[_0x2bbf('0x22')](handleEntityNotFound(_0xcd4426,null))[_0x2bbf('0x22')](function(_0xa3078e){var _0x4eae7f;if(_0xa3078e){_0x4eae7f=squel[_0x2bbf('0x61')]()[_0x2bbf('0x62')](_0x2bbf('0x63'))[_0x2bbf('0x64')](['phone',_0x2bbf('0x6c'),_0x2bbf('0x6e'),_0x2bbf('0x66'),_0x2bbf('0x7c'),_0x2bbf('0x67'),_0x2bbf('0x68')],squel[_0x2bbf('0x69')]()['field'](_0x2bbf('0x7d'),_0x2bbf('0x65'))[_0x2bbf('0x6a')]('NOW()',_0x2bbf('0x6c'))[_0x2bbf('0x6a')]('ANY_VALUE(ContactId)','ContactId')[_0x2bbf('0x6a')](_0x2bbf('0x6f'),'ListId')[_0x2bbf('0x6a')]('ANY_VALUE(CampaignId)','CampaignId')[_0x2bbf('0x6a')](_0x2bbf('0x6b'),'createdAt')[_0x2bbf('0x6a')](_0x2bbf('0x6b'),_0x2bbf('0x68'))['from']('cm_hopper_final')[_0x2bbf('0x3f')](_0x2bbf('0x7e'),_0x5bb3b9[_0x2bbf('0x46')]['id']['toString']())[_0x2bbf('0x3f')](_0x2bbf('0x74'),_0x5bb3b9['body'][_0x2bbf('0x75')]['toString']())['where'](_0x2bbf('0x77'))[_0x2bbf('0x3f')](_0x2bbf('0x78'),squel[_0x2bbf('0x69')]()[_0x2bbf('0x6a')](_0x2bbf('0x65'))[_0x2bbf('0x71')](_0x2bbf('0x63'))[_0x2bbf('0x3f')](_0x2bbf('0x7e'),_0x5bb3b9['params']['id'][_0x2bbf('0x76')]()))[_0x2bbf('0x3f')](_0x2bbf('0x78'),squel[_0x2bbf('0x69')]()[_0x2bbf('0x6a')](_0x2bbf('0x79'))[_0x2bbf('0x71')](_0x2bbf('0x72'))[_0x2bbf('0x3f')]('CampaignId\x20=\x20?',_0x5bb3b9['params']['id'][_0x2bbf('0x76')]())['where'](_0x2bbf('0x7f')))[_0x2bbf('0x7a')](_0x2bbf('0x6e')))['toString']();return db[_0x2bbf('0x4f')][_0x2bbf('0x33')](_0x4eae7f);}return[];})[_0x2bbf('0x22')](respondWithResult(_0xcd4426,null))[_0x2bbf('0x49')](handleError(_0xcd4426,null));};exports[_0x2bbf('0x80')]=function(_0xd94c0f,_0x283625,_0x23733f){return db['CmHopper'][_0x2bbf('0x81')]({'where':{'VoiceQueueId':_0xd94c0f[_0x2bbf('0x2a')][_0x2bbf('0x70')],'CampaignId':_0xd94c0f[_0x2bbf('0x2a')][_0x2bbf('0x7c')],'ContactId':_0xd94c0f[_0x2bbf('0x2a')][_0x2bbf('0x6e')]}})['then'](handleEntityNotFound(_0x283625,null))['then'](function(_0x5a5fda){if(_0x5a5fda){return _0x5a5fda;}return null;})[_0x2bbf('0x22')](respondWithResult(_0x283625,null))[_0x2bbf('0x49')](handleError(_0x283625,null));};