Built motion from commit eddce310.|2.6.12
[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 _0xa786=['stringify','error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57d86d,_0x3003d6){var _0xf3992f=function(_0xe4547a){while(--_0xe4547a){_0x57d86d['push'](_0x57d86d['shift']());}};_0xf3992f(++_0x3003d6);}(_0xa786,0x71));var _0x6a78=function(_0xa2abfc,_0x194e68){_0xa2abfc=_0xa2abfc-0x0;var _0x2af93c=_0xa786[_0xa2abfc];return _0x2af93c;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a78('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6a78('0x4'));var logger=require(_0x6a78('0x5'))(_0x6a78('0x6'));var config=require(_0x6a78('0x7'));var jayson=require(_0x6a78('0x8'));var client=jayson[_0x6a78('0x9')][_0x6a78('0xa')]({'port':0x232a});config['redis']=_[_0x6a78('0xb')](config[_0x6a78('0xc')],{'host':_0x6a78('0xd'),'port':0x18eb});var socket=require(_0x6a78('0xe'))(new Redis(config[_0x6a78('0xc')]));require(_0x6a78('0xf'))[_0x6a78('0x10')](socket);function respondWithRpcPromise(_0x2364b5,_0x43e233,_0x5dd2d2){return new BPromise(function(_0x25b436,_0x1fca69){return client[_0x6a78('0x11')](_0x2364b5,_0x5dd2d2)['then'](function(_0x2a433a){logger[_0x6a78('0x12')](_0x6a78('0x13'),_0x43e233,_0x6a78('0x14'));logger[_0x6a78('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x43e233,_0x6a78('0x14'),JSON[_0x6a78('0x16')](_0x2a433a));if(_0x2a433a[_0x6a78('0x17')]){if(_0x2a433a['error'][_0x6a78('0x18')]===0x1f4){logger[_0x6a78('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x43e233,_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);return _0x1fca69(_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);}logger[_0x6a78('0x17')](_0x6a78('0x13'),_0x43e233,_0x2a433a['error'][_0x6a78('0x19')]);return _0x25b436(_0x2a433a[_0x6a78('0x17')][_0x6a78('0x19')]);}else{logger[_0x6a78('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x43e233,'request\x20sent');_0x25b436(_0x2a433a[_0x6a78('0x1a')]['message']);}})['catch'](function(_0x4efb20){logger[_0x6a78('0x17')](_0x6a78('0x13'),_0x43e233,_0x4efb20);_0x1fca69(_0x4efb20);});});}