62d59cbfee5d84b7022cbd170b771a5577e34969
[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 _0x6666=['error','VoicePrefix,\x20%s,\x20%s','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0xb8f08e,_0x3542cb){var _0x397344=function(_0x412910){while(--_0x412910){_0xb8f08e['push'](_0xb8f08e['shift']());}};_0x397344(++_0x3542cb);}(_0x6666,0x1c7));var _0x6666=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x6666[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require(_0x6666('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6666('0x1'));var rs=require(_0x6666('0x2'));var fs=require('fs');var Redis=require(_0x6666('0x3'));var db=require(_0x6666('0x4'))['db'];var utils=require(_0x6666('0x5'));var logger=require(_0x6666('0x6'))(_0x6666('0x7'));var config=require(_0x6666('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6666('0x9')]['http']({'port':0x232a});config[_0x6666('0xa')]=_[_0x6666('0xb')](config['redis'],{'host':_0x6666('0xc'),'port':0x18eb});var socket=require(_0x6666('0xd'))(new Redis(config[_0x6666('0xa')]));require(_0x6666('0xe'))['register'](socket);function respondWithRpcPromise(_0x4afcbf,_0x4ca025,_0x41212d){return new BPromise(function(_0x401100,_0xf62d31){return client[_0x6666('0xf')](_0x4afcbf,_0x41212d)[_0x6666('0x10')](function(_0x3c0d55){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x4ca025,_0x6666('0x11'));logger[_0x6666('0x12')](_0x6666('0x13'),_0x4ca025,'request\x20sent',JSON['stringify'](_0x3c0d55));if(_0x3c0d55[_0x6666('0x14')]){if(_0x3c0d55[_0x6666('0x14')]['code']===0x1f4){logger['error'](_0x6666('0x15'),_0x4ca025,_0x3c0d55[_0x6666('0x14')][_0x6666('0x16')]);return _0xf62d31(_0x3c0d55['error']['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4ca025,_0x3c0d55['error']['message']);return _0x401100(_0x3c0d55['error'][_0x6666('0x16')]);}else{logger[_0x6666('0x17')](_0x6666('0x15'),_0x4ca025,_0x6666('0x11'));_0x401100(_0x3c0d55['result'][_0x6666('0x16')]);}})[_0x6666('0x18')](function(_0x366806){logger[_0x6666('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x4ca025,_0x366806);_0xf62d31(_0x366806);});});}