Built motion from commit 639a1a7f.|2.6.19
[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 _0xb14c=['then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSound','Sound','find','options','where','attributes','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xba40e1,_0x4c3fa5){var _0x1d8a19=function(_0x27751a){while(--_0x27751a){_0xba40e1['push'](_0xba40e1['shift']());}};_0x1d8a19(++_0x4c3fa5);}(_0xb14c,0x173));var _0xcb14=function(_0x7b17fe,_0x1233ff){_0x7b17fe=_0x7b17fe-0x0;var _0x5215be=_0xb14c[_0x7b17fe];return _0x5215be;};'use strict';var _=require(_0xcb14('0x0'));var util=require(_0xcb14('0x1'));var moment=require(_0xcb14('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb14('0x3'));var db=require(_0xcb14('0x4'))['db'];var utils=require(_0xcb14('0x5'));var logger=require(_0xcb14('0x6'))(_0xcb14('0x7'));var config=require(_0xcb14('0x8'));var jayson=require(_0xcb14('0x9'));var client=jayson[_0xcb14('0xa')][_0xcb14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xff0564,_0x5660ea,_0xee4202){return new BPromise(function(_0x4dc816,_0x1e1115){return client[_0xcb14('0xc')](_0xff0564,_0xee4202)[_0xcb14('0xd')](function(_0x34adfc){logger[_0xcb14('0xe')](_0xcb14('0xf'),_0x5660ea,_0xcb14('0x10'));logger[_0xcb14('0x11')](_0xcb14('0x12'),_0x5660ea,'request\x20sent',JSON[_0xcb14('0x13')](_0x34adfc));if(_0x34adfc[_0xcb14('0x14')]){if(_0x34adfc[_0xcb14('0x14')]['code']===0x1f4){logger[_0xcb14('0x14')](_0xcb14('0xf'),_0x5660ea,_0x34adfc['error']['message']);return _0x1e1115(_0x34adfc[_0xcb14('0x14')]['message']);}logger[_0xcb14('0x14')]('Sound,\x20%s,\x20%s',_0x5660ea,_0x34adfc[_0xcb14('0x14')][_0xcb14('0x15')]);return _0x4dc816(_0x34adfc[_0xcb14('0x14')][_0xcb14('0x15')]);}else{logger[_0xcb14('0xe')](_0xcb14('0xf'),_0x5660ea,'request\x20sent');_0x4dc816(_0x34adfc['result'][_0xcb14('0x15')]);}})[_0xcb14('0x16')](function(_0xfd030d){logger[_0xcb14('0x14')](_0xcb14('0xf'),_0x5660ea,_0xfd030d);_0x1e1115(_0xfd030d);});});}exports[_0xcb14('0x17')]=function(_0x3a0a9c){var _0x4da535=this;return new Promise(function(_0x29083c,_0x53513e){return db[_0xcb14('0x18')][_0xcb14('0x19')]({'raw':_0x3a0a9c[_0xcb14('0x1a')]?_0x3a0a9c[_0xcb14('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3a0a9c['options']?_0x3a0a9c['options'][_0xcb14('0x1b')]||null:null,'attributes':_0x3a0a9c[_0xcb14('0x1a')]?_0x3a0a9c[_0xcb14('0x1a')][_0xcb14('0x1c')]||null:null,'include':_0x3a0a9c['options']?_0x3a0a9c['options'][_0xcb14('0x1d')]?_[_0xcb14('0x1e')](_0x3a0a9c[_0xcb14('0x1a')][_0xcb14('0x1d')],function(_0x3b2fcf){return{'model':db[_0x3b2fcf['model']],'as':_0x3b2fcf['as'],'attributes':_0x3b2fcf[_0xcb14('0x1c')],'include':_0x3b2fcf[_0xcb14('0x1d')]?_[_0xcb14('0x1e')](_0x3b2fcf[_0xcb14('0x1d')],function(_0x31e6cd){return{'model':db[_0x31e6cd[_0xcb14('0x1f')]],'as':_0x31e6cd['as'],'attributes':_0x31e6cd[_0xcb14('0x1c')],'include':_0x31e6cd[_0xcb14('0x1d')]?_['map'](_0x31e6cd[_0xcb14('0x1d')],function(_0x58eac7){return{'model':db[_0x58eac7[_0xcb14('0x1f')]],'as':_0x58eac7['as'],'attributes':_0x58eac7['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb14('0xd')](function(_0x12c744){logger[_0xcb14('0xe')](_0xcb14('0x17'),_0x3a0a9c);logger['debug'](_0xcb14('0x17'),_0x3a0a9c,JSON[_0xcb14('0x13')](_0x12c744));_0x29083c(_0x12c744);})[_0xcb14('0x16')](function(_0x28972b){logger[_0xcb14('0x14')](_0xcb14('0x17'),_0x28972b[_0xcb14('0x15')],_0x3a0a9c);_0x53513e(_0x4da535['error'](0x1f4,_0x28972b['message']));});});};