Built motion from commit (unavailable).|2.5.31
[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 _0x7b2f=['debug','error','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','where','attributes','include','map','model','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x2d9f4d,_0xd055f7){var _0x647922=function(_0x5bb9c1){while(--_0x5bb9c1){_0x2d9f4d['push'](_0x2d9f4d['shift']());}};_0x647922(++_0xd055f7);}(_0x7b2f,0x130));var _0xf7b2=function(_0x202067,_0x25e057){_0x202067=_0x202067-0x0;var _0x4c792e=_0x7b2f[_0x202067];return _0x4c792e;};'use strict';var _=require('lodash');var util=require(_0xf7b2('0x0'));var moment=require(_0xf7b2('0x1'));var BPromise=require(_0xf7b2('0x2'));var rs=require(_0xf7b2('0x3'));var fs=require('fs');var Redis=require(_0xf7b2('0x4'));var db=require(_0xf7b2('0x5'))['db'];var utils=require(_0xf7b2('0x6'));var logger=require(_0xf7b2('0x7'))(_0xf7b2('0x8'));var config=require(_0xf7b2('0x9'));var jayson=require(_0xf7b2('0xa'));var client=jayson['client'][_0xf7b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a0d87,_0x3c567e,_0x59dc41){return new BPromise(function(_0x435669,_0x19b5f6){return client[_0xf7b2('0xc')](_0x4a0d87,_0x59dc41)[_0xf7b2('0xd')](function(_0x13b78d){logger[_0xf7b2('0xe')]('Sound,\x20%s,\x20%s',_0x3c567e,_0xf7b2('0xf'));logger[_0xf7b2('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x3c567e,_0xf7b2('0xf'),JSON['stringify'](_0x13b78d));if(_0x13b78d['error']){if(_0x13b78d['error']['code']===0x1f4){logger[_0xf7b2('0x11')](_0xf7b2('0x12'),_0x3c567e,_0x13b78d[_0xf7b2('0x11')][_0xf7b2('0x13')]);return _0x19b5f6(_0x13b78d[_0xf7b2('0x11')][_0xf7b2('0x13')]);}logger[_0xf7b2('0x11')](_0xf7b2('0x12'),_0x3c567e,_0x13b78d[_0xf7b2('0x11')][_0xf7b2('0x13')]);return _0x435669(_0x13b78d[_0xf7b2('0x11')]['message']);}else{logger[_0xf7b2('0xe')]('Sound,\x20%s,\x20%s',_0x3c567e,_0xf7b2('0xf'));_0x435669(_0x13b78d[_0xf7b2('0x14')][_0xf7b2('0x13')]);}})[_0xf7b2('0x15')](function(_0x25fc78){logger[_0xf7b2('0x11')](_0xf7b2('0x12'),_0x3c567e,_0x25fc78);_0x19b5f6(_0x25fc78);});});}exports[_0xf7b2('0x16')]=function(_0x3a3626){var _0x98f61e=this;return new Promise(function(_0x45c997,_0x4a105c){return db[_0xf7b2('0x17')][_0xf7b2('0x18')]({'raw':_0x3a3626[_0xf7b2('0x19')]?_0x3a3626[_0xf7b2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3a3626[_0xf7b2('0x19')]?_0x3a3626[_0xf7b2('0x19')][_0xf7b2('0x1a')]||null:null,'attributes':_0x3a3626[_0xf7b2('0x19')]?_0x3a3626[_0xf7b2('0x19')][_0xf7b2('0x1b')]||null:null,'include':_0x3a3626[_0xf7b2('0x19')]?_0x3a3626[_0xf7b2('0x19')][_0xf7b2('0x1c')]?_[_0xf7b2('0x1d')](_0x3a3626['options'][_0xf7b2('0x1c')],function(_0x176651){return{'model':db[_0x176651[_0xf7b2('0x1e')]],'as':_0x176651['as'],'attributes':_0x176651['attributes'],'include':_0x176651[_0xf7b2('0x1c')]?_[_0xf7b2('0x1d')](_0x176651[_0xf7b2('0x1c')],function(_0xff1288){return{'model':db[_0xff1288[_0xf7b2('0x1e')]],'as':_0xff1288['as'],'attributes':_0xff1288[_0xf7b2('0x1b')],'include':_0xff1288[_0xf7b2('0x1c')]?_[_0xf7b2('0x1d')](_0xff1288['include'],function(_0x504d40){return{'model':db[_0x504d40[_0xf7b2('0x1e')]],'as':_0x504d40['as'],'attributes':_0x504d40[_0xf7b2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf7b2('0xd')](function(_0x203e0b){logger[_0xf7b2('0xe')](_0xf7b2('0x16'),_0x3a3626);logger['debug'](_0xf7b2('0x16'),_0x3a3626,JSON[_0xf7b2('0x1f')](_0x203e0b));_0x45c997(_0x203e0b);})[_0xf7b2('0x15')](function(_0x1bccbb){logger['error']('ShowSound',_0x1bccbb['message'],_0x3a3626);_0x4a105c(_0x98f61e[_0xf7b2('0x11')](0x1f4,_0x1bccbb['message']));});});};