Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / api / sound / sound.rpc.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 _0x7c13=['stringify','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSound','Sound','find','options','where','attributes','map','include','model'];(function(_0x424bbd,_0x32f293){var _0x5ca432=function(_0xfd0800){while(--_0xfd0800){_0x424bbd['push'](_0x424bbd['shift']());}};_0x5ca432(++_0x32f293);}(_0x7c13,0x12d));var _0x37c1=function(_0x56f6c0,_0x37c097){_0x56f6c0=_0x56f6c0-0x0;var _0x249342=_0x7c13[_0x56f6c0];return _0x249342;};'use strict';var _=require(_0x37c1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x37c1('0x1'));var rs=require(_0x37c1('0x2'));var fs=require('fs');var Redis=require(_0x37c1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37c1('0x4'))(_0x37c1('0x5'));var config=require(_0x37c1('0x6'));var jayson=require(_0x37c1('0x7'));var client=jayson[_0x37c1('0x8')][_0x37c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x316d6e,_0x423fde,_0x5949df){return new BPromise(function(_0xc2da2b,_0x1ae1f8){return client['request'](_0x316d6e,_0x5949df)[_0x37c1('0xa')](function(_0x307ae8){logger[_0x37c1('0xb')](_0x37c1('0xc'),_0x423fde,_0x37c1('0xd'));logger[_0x37c1('0xe')](_0x37c1('0xf'),_0x423fde,_0x37c1('0xd'),JSON['stringify'](_0x307ae8));if(_0x307ae8[_0x37c1('0x10')]){if(_0x307ae8[_0x37c1('0x10')][_0x37c1('0x11')]===0x1f4){logger[_0x37c1('0x10')](_0x37c1('0xc'),_0x423fde,_0x307ae8[_0x37c1('0x10')][_0x37c1('0x12')]);return _0x1ae1f8(_0x307ae8[_0x37c1('0x10')][_0x37c1('0x12')]);}logger[_0x37c1('0x10')]('Sound,\x20%s,\x20%s',_0x423fde,_0x307ae8[_0x37c1('0x10')][_0x37c1('0x12')]);return _0xc2da2b(_0x307ae8[_0x37c1('0x10')][_0x37c1('0x12')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x423fde,_0x37c1('0xd'));_0xc2da2b(_0x307ae8[_0x37c1('0x13')]['message']);}})['catch'](function(_0x1f93cb){logger[_0x37c1('0x10')]('Sound,\x20%s,\x20%s',_0x423fde,_0x1f93cb);_0x1ae1f8(_0x1f93cb);});});}exports[_0x37c1('0x14')]=function(_0x40c464){var _0x487507=this;return new Promise(function(_0x415c32,_0x348b62){return db[_0x37c1('0x15')][_0x37c1('0x16')]({'raw':_0x40c464['options']?_0x40c464[_0x37c1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x40c464['options']?_0x40c464[_0x37c1('0x17')][_0x37c1('0x18')]||null:null,'attributes':_0x40c464[_0x37c1('0x17')]?_0x40c464['options'][_0x37c1('0x19')]||null:null,'include':_0x40c464['options']?_0x40c464['options']['include']?_[_0x37c1('0x1a')](_0x40c464[_0x37c1('0x17')][_0x37c1('0x1b')],function(_0x2c9f19){return{'model':db[_0x2c9f19[_0x37c1('0x1c')]],'as':_0x2c9f19['as'],'attributes':_0x2c9f19[_0x37c1('0x19')],'include':_0x2c9f19[_0x37c1('0x1b')]?_[_0x37c1('0x1a')](_0x2c9f19[_0x37c1('0x1b')],function(_0x5661d6){return{'model':db[_0x5661d6[_0x37c1('0x1c')]],'as':_0x5661d6['as'],'attributes':_0x5661d6['attributes'],'include':_0x5661d6['include']?_[_0x37c1('0x1a')](_0x5661d6[_0x37c1('0x1b')],function(_0x365141){return{'model':db[_0x365141['model']],'as':_0x365141['as'],'attributes':_0x365141[_0x37c1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x37c1('0xa')](function(_0x217db0){logger[_0x37c1('0xb')]('ShowSound',_0x40c464);logger[_0x37c1('0xe')](_0x37c1('0x14'),_0x40c464,JSON[_0x37c1('0x1d')](_0x217db0));_0x415c32(_0x217db0);})['catch'](function(_0x55bac0){logger[_0x37c1('0x10')]('ShowSound',_0x55bac0[_0x37c1('0x12')],_0x40c464);_0x348b62(_0x487507[_0x37c1('0x10')](0x1f4,_0x55bac0[_0x37c1('0x12')]));});});};