Built motion from commit (unavailable).|2.5.21
[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 _0xffcd=['include','model','attributes','map','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','ShowSound','find','options','raw'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xffcd,0x10d));var _0xdffc=function(_0x5407e7,_0x6a7a13){_0x5407e7=_0x5407e7-0x0;var _0x562bda=_0xffcd[_0x5407e7];return _0x562bda;};'use strict';var _=require(_0xdffc('0x0'));var util=require(_0xdffc('0x1'));var moment=require(_0xdffc('0x2'));var BPromise=require(_0xdffc('0x3'));var rs=require(_0xdffc('0x4'));var fs=require('fs');var Redis=require(_0xdffc('0x5'));var db=require(_0xdffc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdffc('0x7'))(_0xdffc('0x8'));var config=require(_0xdffc('0x9'));var jayson=require(_0xdffc('0xa'));var client=jayson['client'][_0xdffc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ce193,_0x531c2b,_0xf9be12){return new BPromise(function(_0x1db691,_0x440c7f){return client[_0xdffc('0xc')](_0x5ce193,_0xf9be12)[_0xdffc('0xd')](function(_0x4f4545){logger[_0xdffc('0xe')]('Sound,\x20%s,\x20%s',_0x531c2b,_0xdffc('0xf'));logger[_0xdffc('0x10')](_0xdffc('0x11'),_0x531c2b,_0xdffc('0xf'),JSON[_0xdffc('0x12')](_0x4f4545));if(_0x4f4545[_0xdffc('0x13')]){if(_0x4f4545[_0xdffc('0x13')][_0xdffc('0x14')]===0x1f4){logger['error'](_0xdffc('0x15'),_0x531c2b,_0x4f4545[_0xdffc('0x13')][_0xdffc('0x16')]);return _0x440c7f(_0x4f4545[_0xdffc('0x13')]['message']);}logger[_0xdffc('0x13')](_0xdffc('0x15'),_0x531c2b,_0x4f4545[_0xdffc('0x13')][_0xdffc('0x16')]);return _0x1db691(_0x4f4545[_0xdffc('0x13')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x531c2b,'request\x20sent');_0x1db691(_0x4f4545[_0xdffc('0x17')]['message']);}})['catch'](function(_0xa4e0d7){logger['error']('Sound,\x20%s,\x20%s',_0x531c2b,_0xa4e0d7);_0x440c7f(_0xa4e0d7);});});}exports[_0xdffc('0x18')]=function(_0x19840a){var _0x2d3059=this;return new Promise(function(_0x44f3be,_0x3a3eff){return db['Sound'][_0xdffc('0x19')]({'raw':_0x19840a[_0xdffc('0x1a')]?_0x19840a[_0xdffc('0x1a')][_0xdffc('0x1b')]===undefined?!![]:![]:!![],'where':_0x19840a[_0xdffc('0x1a')]?_0x19840a[_0xdffc('0x1a')]['where']||null:null,'attributes':_0x19840a[_0xdffc('0x1a')]?_0x19840a['options']['attributes']||null:null,'include':_0x19840a[_0xdffc('0x1a')]?_0x19840a[_0xdffc('0x1a')][_0xdffc('0x1c')]?_['map'](_0x19840a[_0xdffc('0x1a')]['include'],function(_0x3450a6){return{'model':db[_0x3450a6[_0xdffc('0x1d')]],'as':_0x3450a6['as'],'attributes':_0x3450a6[_0xdffc('0x1e')],'include':_0x3450a6[_0xdffc('0x1c')]?_['map'](_0x3450a6[_0xdffc('0x1c')],function(_0x501292){return{'model':db[_0x501292[_0xdffc('0x1d')]],'as':_0x501292['as'],'attributes':_0x501292[_0xdffc('0x1e')],'include':_0x501292[_0xdffc('0x1c')]?_[_0xdffc('0x1f')](_0x501292[_0xdffc('0x1c')],function(_0x4f5d1e){return{'model':db[_0x4f5d1e[_0xdffc('0x1d')]],'as':_0x4f5d1e['as'],'attributes':_0x4f5d1e[_0xdffc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdffc('0xd')](function(_0x3c7795){logger[_0xdffc('0xe')](_0xdffc('0x18'),_0x19840a);logger[_0xdffc('0x10')](_0xdffc('0x18'),_0x19840a,JSON[_0xdffc('0x12')](_0x3c7795));_0x44f3be(_0x3c7795);})[_0xdffc('0x20')](function(_0x3ecefe){logger[_0xdffc('0x13')]('ShowSound',_0x3ecefe[_0xdffc('0x16')],_0x19840a);_0x3a3eff(_0x2d3059[_0xdffc('0x13')](0x1f4,_0x3ecefe['message']));});});};