Built motion from commit b5413ace.|2.6.9
[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 _0x4ca4=['socket.io-emitter','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x249b1e,_0x3f41a1){var _0x54ad9e=function(_0x4be2e4){while(--_0x4be2e4){_0x249b1e['push'](_0x249b1e['shift']());}};_0x54ad9e(++_0x3f41a1);}(_0x4ca4,0x100));var _0x44ca=function(_0x508742,_0x3a828d){_0x508742=_0x508742-0x0;var _0x1542c1=_0x4ca4[_0x508742];return _0x1542c1;};'use strict';var _=require(_0x44ca('0x0'));var util=require(_0x44ca('0x1'));var moment=require(_0x44ca('0x2'));var BPromise=require(_0x44ca('0x3'));var rs=require(_0x44ca('0x4'));var fs=require('fs');var Redis=require(_0x44ca('0x5'));var db=require(_0x44ca('0x6'))['db'];var utils=require(_0x44ca('0x7'));var logger=require('../../config/logger')(_0x44ca('0x8'));var config=require(_0x44ca('0x9'));var jayson=require(_0x44ca('0xa'));var client=jayson[_0x44ca('0xb')][_0x44ca('0xc')]({'port':0x232a});config[_0x44ca('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x44ca('0xe'))(new Redis(config[_0x44ca('0xd')]));require('./voicePrefix.socket')[_0x44ca('0xf')](socket);function respondWithRpcPromise(_0x5e3b2b,_0x4b16de,_0x89a1c5){return new BPromise(function(_0x12e21e,_0xe84c65){return client[_0x44ca('0x10')](_0x5e3b2b,_0x89a1c5)[_0x44ca('0x11')](function(_0x48c477){logger['info'](_0x44ca('0x12'),_0x4b16de,_0x44ca('0x13'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x4b16de,_0x44ca('0x13'),JSON[_0x44ca('0x14')](_0x48c477));if(_0x48c477[_0x44ca('0x15')]){if(_0x48c477[_0x44ca('0x15')][_0x44ca('0x16')]===0x1f4){logger[_0x44ca('0x15')](_0x44ca('0x12'),_0x4b16de,_0x48c477[_0x44ca('0x15')]['message']);return _0xe84c65(_0x48c477[_0x44ca('0x15')][_0x44ca('0x17')]);}logger['error'](_0x44ca('0x12'),_0x4b16de,_0x48c477[_0x44ca('0x15')]['message']);return _0x12e21e(_0x48c477[_0x44ca('0x15')][_0x44ca('0x17')]);}else{logger[_0x44ca('0x18')](_0x44ca('0x12'),_0x4b16de,_0x44ca('0x13'));_0x12e21e(_0x48c477[_0x44ca('0x19')][_0x44ca('0x17')]);}})[_0x44ca('0x1a')](function(_0x22e86c){logger['error'](_0x44ca('0x12'),_0x4b16de,_0x22e86c);_0xe84c65(_0x22e86c);});});}