Built motion from commit da617fac.|2.6.6
[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 _0x9fe7=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xe7633c,_0x2f63f9){var _0x3ecc86=function(_0x4db9a3){while(--_0x4db9a3){_0xe7633c['push'](_0xe7633c['shift']());}};_0x3ecc86(++_0x2f63f9);}(_0x9fe7,0x1df));var _0x79fe=function(_0x5db66a,_0x4dcead){_0x5db66a=_0x5db66a-0x0;var _0x2404ed=_0x9fe7[_0x5db66a];return _0x2404ed;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var moment=require('moment');var BPromise=require(_0x79fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79fe('0x3'));var db=require(_0x79fe('0x4'))['db'];var utils=require(_0x79fe('0x5'));var logger=require('../../config/logger')(_0x79fe('0x6'));var config=require(_0x79fe('0x7'));var jayson=require(_0x79fe('0x8'));var client=jayson['client'][_0x79fe('0x9')]({'port':0x232a});config[_0x79fe('0xa')]=_[_0x79fe('0xb')](config['redis'],{'host':_0x79fe('0xc'),'port':0x18eb});var socket=require(_0x79fe('0xd'))(new Redis(config[_0x79fe('0xa')]));require(_0x79fe('0xe'))[_0x79fe('0xf')](socket);function respondWithRpcPromise(_0x5b914a,_0x34c217,_0x253f7d){return new BPromise(function(_0x4a3ccf,_0x20cde6){return client[_0x79fe('0x10')](_0x5b914a,_0x253f7d)[_0x79fe('0x11')](function(_0x20607a){logger['info'](_0x79fe('0x12'),_0x34c217,_0x79fe('0x13'));logger[_0x79fe('0x14')](_0x79fe('0x15'),_0x34c217,_0x79fe('0x13'),JSON[_0x79fe('0x16')](_0x20607a));if(_0x20607a[_0x79fe('0x17')]){if(_0x20607a[_0x79fe('0x17')]['code']===0x1f4){logger[_0x79fe('0x17')](_0x79fe('0x12'),_0x34c217,_0x20607a[_0x79fe('0x17')][_0x79fe('0x18')]);return _0x20cde6(_0x20607a[_0x79fe('0x17')][_0x79fe('0x18')]);}logger['error'](_0x79fe('0x12'),_0x34c217,_0x20607a[_0x79fe('0x17')][_0x79fe('0x18')]);return _0x4a3ccf(_0x20607a[_0x79fe('0x17')]['message']);}else{logger[_0x79fe('0x19')](_0x79fe('0x12'),_0x34c217,_0x79fe('0x13'));_0x4a3ccf(_0x20607a[_0x79fe('0x1a')]['message']);}})['catch'](function(_0x132964){logger[_0x79fe('0x17')](_0x79fe('0x12'),_0x34c217,_0x132964);_0x20cde6(_0x132964);});});}