f130b04683a3a606a97c905fadca783f577a8a29
[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 _0xd98a=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoicePrefix,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then','request\x20sent'];(function(_0x582ad0,_0x171edd){var _0x258b0b=function(_0x1d8dfb){while(--_0x1d8dfb){_0x582ad0['push'](_0x582ad0['shift']());}};_0x258b0b(++_0x171edd);}(_0xd98a,0xfc));var _0xad98=function(_0x187d27,_0x3cc2df){_0x187d27=_0x187d27-0x0;var _0x564efb=_0xd98a[_0x187d27];return _0x564efb;};'use strict';var _=require(_0xad98('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xad98('0x1'));var rs=require(_0xad98('0x2'));var fs=require('fs');var Redis=require(_0xad98('0x3'));var db=require(_0xad98('0x4'))['db'];var utils=require(_0xad98('0x5'));var logger=require(_0xad98('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad98('0x7'));var client=jayson[_0xad98('0x8')][_0xad98('0x9')]({'port':0x232a});config[_0xad98('0xa')]=_[_0xad98('0xb')](config['redis'],{'host':_0xad98('0xc'),'port':0x18eb});var socket=require(_0xad98('0xd'))(new Redis(config['redis']));require(_0xad98('0xe'))['register'](socket);function respondWithRpcPromise(_0x145cbe,_0x525e32,_0x4cf45b){return new BPromise(function(_0x5d5f3b,_0x15ca48){return client[_0xad98('0xf')](_0x145cbe,_0x4cf45b)[_0xad98('0x10')](function(_0x120abe){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x525e32,_0xad98('0x11'));logger[_0xad98('0x12')](_0xad98('0x13'),_0x525e32,_0xad98('0x11'),JSON[_0xad98('0x14')](_0x120abe));if(_0x120abe[_0xad98('0x15')]){if(_0x120abe[_0xad98('0x15')][_0xad98('0x16')]===0x1f4){logger[_0xad98('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x525e32,_0x120abe[_0xad98('0x15')][_0xad98('0x17')]);return _0x15ca48(_0x120abe[_0xad98('0x15')][_0xad98('0x17')]);}logger[_0xad98('0x15')](_0xad98('0x18'),_0x525e32,_0x120abe[_0xad98('0x15')][_0xad98('0x17')]);return _0x5d5f3b(_0x120abe[_0xad98('0x15')]['message']);}else{logger['info'](_0xad98('0x18'),_0x525e32,'request\x20sent');_0x5d5f3b(_0x120abe[_0xad98('0x19')][_0xad98('0x17')]);}})[_0xad98('0x1a')](function(_0x1b2a36){logger[_0xad98('0x15')](_0xad98('0x18'),_0x525e32,_0x1b2a36);_0x15ca48(_0x1b2a36);});});}