Built motion from commit f0a64034.|2.6.11
[motion2.git] / server / api / voicePrefix / voicePrefix.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 _0xa280=['http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5c3ea6,_0x5656a1){var _0x5b4d01=function(_0x38daf8){while(--_0x38daf8){_0x5c3ea6['push'](_0x5c3ea6['shift']());}};_0x5b4d01(++_0x5656a1);}(_0xa280,0xc4));var _0x0a28=function(_0x3f2668,_0x156268){_0x3f2668=_0x3f2668-0x0;var _0x1da0b7=_0xa280[_0x3f2668];return _0x1da0b7;};'use strict';var _=require(_0x0a28('0x0'));var util=require(_0x0a28('0x1'));var moment=require('moment');var BPromise=require(_0x0a28('0x2'));var rs=require(_0x0a28('0x3'));var fs=require('fs');var Redis=require(_0x0a28('0x4'));var db=require(_0x0a28('0x5'))['db'];var utils=require(_0x0a28('0x6'));var logger=require(_0x0a28('0x7'))(_0x0a28('0x8'));var config=require(_0x0a28('0x9'));var jayson=require(_0x0a28('0xa'));var client=jayson[_0x0a28('0xb')][_0x0a28('0xc')]({'port':0x232a});config[_0x0a28('0xd')]=_[_0x0a28('0xe')](config[_0x0a28('0xd')],{'host':_0x0a28('0xf'),'port':0x18eb});var socket=require(_0x0a28('0x10'))(new Redis(config[_0x0a28('0xd')]));require(_0x0a28('0x11'))['register'](socket);function respondWithRpcPromise(_0x11b36e,_0x28bca7,_0x48cbf1){return new BPromise(function(_0x30e340,_0x1ad1ef){return client['request'](_0x11b36e,_0x48cbf1)['then'](function(_0x1a8ad4){logger[_0x0a28('0x12')](_0x0a28('0x13'),_0x28bca7,_0x0a28('0x14'));logger[_0x0a28('0x15')](_0x0a28('0x16'),_0x28bca7,_0x0a28('0x14'),JSON['stringify'](_0x1a8ad4));if(_0x1a8ad4[_0x0a28('0x17')]){if(_0x1a8ad4[_0x0a28('0x17')]['code']===0x1f4){logger[_0x0a28('0x17')](_0x0a28('0x13'),_0x28bca7,_0x1a8ad4[_0x0a28('0x17')][_0x0a28('0x18')]);return _0x1ad1ef(_0x1a8ad4['error'][_0x0a28('0x18')]);}logger[_0x0a28('0x17')](_0x0a28('0x13'),_0x28bca7,_0x1a8ad4[_0x0a28('0x17')]['message']);return _0x30e340(_0x1a8ad4[_0x0a28('0x17')][_0x0a28('0x18')]);}else{logger[_0x0a28('0x12')](_0x0a28('0x13'),_0x28bca7,'request\x20sent');_0x30e340(_0x1a8ad4['result'][_0x0a28('0x18')]);}})[_0x0a28('0x19')](function(_0x169bb6){logger['error'](_0x0a28('0x13'),_0x28bca7,_0x169bb6);_0x1ad1ef(_0x169bb6);});});}