92160d5bcff6482fc8cb732723a0e1acd100d7bf
[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 _0xdcd5=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcd5,0x110));var _0x5dcd=function(_0x1d0499,_0x23e22f){_0x1d0499=_0x1d0499-0x0;var _0x153fb3=_0xdcd5[_0x1d0499];return _0x153fb3;};'use strict';var _=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var moment=require(_0x5dcd('0x2'));var BPromise=require(_0x5dcd('0x3'));var rs=require(_0x5dcd('0x4'));var fs=require('fs');var Redis=require(_0x5dcd('0x5'));var db=require(_0x5dcd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dcd('0x7'))(_0x5dcd('0x8'));var config=require(_0x5dcd('0x9'));var jayson=require(_0x5dcd('0xa'));var client=jayson[_0x5dcd('0xb')][_0x5dcd('0xc')]({'port':0x232a});config[_0x5dcd('0xd')]=_[_0x5dcd('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5dcd('0xf'))(new Redis(config[_0x5dcd('0xd')]));require(_0x5dcd('0x10'))['register'](socket);function respondWithRpcPromise(_0x1e1161,_0x29c3e1,_0xf0e115){return new BPromise(function(_0x1d46bc,_0x22680f){return client[_0x5dcd('0x11')](_0x1e1161,_0xf0e115)[_0x5dcd('0x12')](function(_0x57c64d){logger['info'](_0x5dcd('0x13'),_0x29c3e1,_0x5dcd('0x14'));logger['debug'](_0x5dcd('0x15'),_0x29c3e1,_0x5dcd('0x14'),JSON[_0x5dcd('0x16')](_0x57c64d));if(_0x57c64d[_0x5dcd('0x17')]){if(_0x57c64d[_0x5dcd('0x17')][_0x5dcd('0x18')]===0x1f4){logger[_0x5dcd('0x17')](_0x5dcd('0x13'),_0x29c3e1,_0x57c64d['error'][_0x5dcd('0x19')]);return _0x22680f(_0x57c64d[_0x5dcd('0x17')]['message']);}logger[_0x5dcd('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x29c3e1,_0x57c64d[_0x5dcd('0x17')][_0x5dcd('0x19')]);return _0x1d46bc(_0x57c64d[_0x5dcd('0x17')]['message']);}else{logger[_0x5dcd('0x1a')](_0x5dcd('0x13'),_0x29c3e1,_0x5dcd('0x14'));_0x1d46bc(_0x57c64d['result'][_0x5dcd('0x19')]);}})[_0x5dcd('0x1b')](function(_0x564b){logger['error'](_0x5dcd('0x13'),_0x29c3e1,_0x564b);_0x22680f(_0x564b);});});}