Built motion from commit (unavailable).|2.5.3
[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 _0xd213=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ShowSound','Sound','find','options','raw','include','map','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s'];(function(_0x2cae99,_0x2c4acb){var _0x2748b6=function(_0x277351){while(--_0x277351){_0x2cae99['push'](_0x2cae99['shift']());}};_0x2748b6(++_0x2c4acb);}(_0xd213,0xd8));var _0x3d21=function(_0x4f93a9,_0x2793c3){_0x4f93a9=_0x4f93a9-0x0;var _0x8fab33=_0xd213[_0x4f93a9];return _0x8fab33;};'use strict';var _=require(_0x3d21('0x0'));var util=require(_0x3d21('0x1'));var moment=require('moment');var BPromise=require(_0x3d21('0x2'));var rs=require(_0x3d21('0x3'));var fs=require('fs');var Redis=require(_0x3d21('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d21('0x5'));var logger=require(_0x3d21('0x6'))(_0x3d21('0x7'));var config=require(_0x3d21('0x8'));var jayson=require(_0x3d21('0x9'));var client=jayson[_0x3d21('0xa')][_0x3d21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x348705,_0x207390,_0x4dad54){return new BPromise(function(_0x37161c,_0x1bb65c){return client[_0x3d21('0xc')](_0x348705,_0x4dad54)[_0x3d21('0xd')](function(_0x3d62e2){logger['info'](_0x3d21('0xe'),_0x207390,_0x3d21('0xf'));logger[_0x3d21('0x10')](_0x3d21('0x11'),_0x207390,_0x3d21('0xf'),JSON['stringify'](_0x3d62e2));if(_0x3d62e2[_0x3d21('0x12')]){if(_0x3d62e2[_0x3d21('0x12')][_0x3d21('0x13')]===0x1f4){logger[_0x3d21('0x12')](_0x3d21('0xe'),_0x207390,_0x3d62e2['error'][_0x3d21('0x14')]);return _0x1bb65c(_0x3d62e2[_0x3d21('0x12')][_0x3d21('0x14')]);}logger[_0x3d21('0x12')]('Sound,\x20%s,\x20%s',_0x207390,_0x3d62e2[_0x3d21('0x12')]['message']);return _0x37161c(_0x3d62e2[_0x3d21('0x12')][_0x3d21('0x14')]);}else{logger[_0x3d21('0x15')]('Sound,\x20%s,\x20%s',_0x207390,'request\x20sent');_0x37161c(_0x3d62e2[_0x3d21('0x16')][_0x3d21('0x14')]);}})[_0x3d21('0x17')](function(_0x1f265f){logger[_0x3d21('0x12')]('Sound,\x20%s,\x20%s',_0x207390,_0x1f265f);_0x1bb65c(_0x1f265f);});});}exports[_0x3d21('0x18')]=function(_0x2ef54c){var _0x1c65aa=this;return new Promise(function(_0x3dacc4,_0x5313e5){return db[_0x3d21('0x19')][_0x3d21('0x1a')]({'raw':_0x2ef54c[_0x3d21('0x1b')]?_0x2ef54c[_0x3d21('0x1b')][_0x3d21('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ef54c[_0x3d21('0x1b')]?_0x2ef54c['options']['where']||null:null,'attributes':_0x2ef54c['options']?_0x2ef54c[_0x3d21('0x1b')]['attributes']||null:null,'include':_0x2ef54c[_0x3d21('0x1b')]?_0x2ef54c['options'][_0x3d21('0x1d')]?_[_0x3d21('0x1e')](_0x2ef54c[_0x3d21('0x1b')][_0x3d21('0x1d')],function(_0x5bc589){return{'model':db[_0x5bc589[_0x3d21('0x1f')]],'as':_0x5bc589['as'],'attributes':_0x5bc589[_0x3d21('0x20')],'include':_0x5bc589[_0x3d21('0x1d')]?_[_0x3d21('0x1e')](_0x5bc589[_0x3d21('0x1d')],function(_0x467692){return{'model':db[_0x467692[_0x3d21('0x1f')]],'as':_0x467692['as'],'attributes':_0x467692[_0x3d21('0x20')],'include':_0x467692[_0x3d21('0x1d')]?_[_0x3d21('0x1e')](_0x467692[_0x3d21('0x1d')],function(_0x21e1d3){return{'model':db[_0x21e1d3[_0x3d21('0x1f')]],'as':_0x21e1d3['as'],'attributes':_0x21e1d3[_0x3d21('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x265fbc){logger[_0x3d21('0x15')](_0x3d21('0x18'),_0x2ef54c);logger['debug'](_0x3d21('0x18'),_0x2ef54c,JSON['stringify'](_0x265fbc));_0x3dacc4(_0x265fbc);})[_0x3d21('0x17')](function(_0x3bace7){logger['error'](_0x3d21('0x18'),_0x3bace7[_0x3d21('0x14')],_0x2ef54c);_0x5313e5(_0x1c65aa[_0x3d21('0x12')](0x1f4,_0x3bace7[_0x3d21('0x14')]));});});};