Built motion from commit (unavailable).|2.5.4
[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 _0x1444=['Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0x1444,0x143));var _0x4144=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x1444[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0x4144('0x0'));var moment=require(_0x4144('0x1'));var BPromise=require(_0x4144('0x2'));var rs=require(_0x4144('0x3'));var fs=require('fs');var Redis=require(_0x4144('0x4'));var db=require(_0x4144('0x5'))['db'];var utils=require(_0x4144('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4144('0x7'));var client=jayson[_0x4144('0x8')][_0x4144('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6c40a8,_0x102485,_0x47ec03){return new BPromise(function(_0x2bc37a,_0x3ce3cd){return client[_0x4144('0xa')](_0x6c40a8,_0x47ec03)[_0x4144('0xb')](function(_0x47c77b){logger[_0x4144('0xc')]('Sound,\x20%s,\x20%s',_0x102485,_0x4144('0xd'));logger[_0x4144('0xe')](_0x4144('0xf'),_0x102485,'request\x20sent',JSON[_0x4144('0x10')](_0x47c77b));if(_0x47c77b[_0x4144('0x11')]){if(_0x47c77b[_0x4144('0x11')]['code']===0x1f4){logger['error'](_0x4144('0x12'),_0x102485,_0x47c77b['error'][_0x4144('0x13')]);return _0x3ce3cd(_0x47c77b[_0x4144('0x11')][_0x4144('0x13')]);}logger[_0x4144('0x11')](_0x4144('0x12'),_0x102485,_0x47c77b[_0x4144('0x11')][_0x4144('0x13')]);return _0x2bc37a(_0x47c77b[_0x4144('0x11')][_0x4144('0x13')]);}else{logger[_0x4144('0xc')]('Sound,\x20%s,\x20%s',_0x102485,'request\x20sent');_0x2bc37a(_0x47c77b[_0x4144('0x14')][_0x4144('0x13')]);}})[_0x4144('0x15')](function(_0x23c022){logger[_0x4144('0x11')](_0x4144('0x12'),_0x102485,_0x23c022);_0x3ce3cd(_0x23c022);});});}exports[_0x4144('0x16')]=function(_0xbd42f6){var _0x915640=this;return new Promise(function(_0x5ecac2,_0x27315e){return db[_0x4144('0x17')][_0x4144('0x18')]({'raw':_0xbd42f6['options']?_0xbd42f6[_0x4144('0x19')][_0x4144('0x1a')]===undefined?!![]:![]:!![],'where':_0xbd42f6[_0x4144('0x19')]?_0xbd42f6[_0x4144('0x19')]['where']||null:null,'attributes':_0xbd42f6[_0x4144('0x19')]?_0xbd42f6[_0x4144('0x19')][_0x4144('0x1b')]||null:null,'include':_0xbd42f6[_0x4144('0x19')]?_0xbd42f6[_0x4144('0x19')][_0x4144('0x1c')]?_[_0x4144('0x1d')](_0xbd42f6[_0x4144('0x19')][_0x4144('0x1c')],function(_0x116dbb){return{'model':db[_0x116dbb[_0x4144('0x1e')]],'as':_0x116dbb['as'],'attributes':_0x116dbb[_0x4144('0x1b')],'include':_0x116dbb[_0x4144('0x1c')]?_['map'](_0x116dbb[_0x4144('0x1c')],function(_0x47450d){return{'model':db[_0x47450d[_0x4144('0x1e')]],'as':_0x47450d['as'],'attributes':_0x47450d['attributes'],'include':_0x47450d[_0x4144('0x1c')]?_[_0x4144('0x1d')](_0x47450d['include'],function(_0x38f221){return{'model':db[_0x38f221[_0x4144('0x1e')]],'as':_0x38f221['as'],'attributes':_0x38f221[_0x4144('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4144('0xb')](function(_0x377aff){logger[_0x4144('0xc')]('ShowSound',_0xbd42f6);logger[_0x4144('0xe')]('ShowSound',_0xbd42f6,JSON[_0x4144('0x10')](_0x377aff));_0x5ecac2(_0x377aff);})[_0x4144('0x15')](function(_0x5c58e5){logger[_0x4144('0x11')](_0x4144('0x16'),_0x5c58e5[_0x4144('0x13')],_0xbd42f6);_0x27315e(_0x915640['error'](0x1f4,_0x5c58e5[_0x4144('0x13')]));});});};