ed3e4d1066283068265d8f9bd392635c60fb3758
[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 _0x5186=['rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xf237f7,_0xb11ac){var _0x2c183b=function(_0xe3b47b){while(--_0xe3b47b){_0xf237f7['push'](_0xf237f7['shift']());}};_0x2c183b(++_0xb11ac);}(_0x5186,0x180));var _0x6518=function(_0x45f4aa,_0x47e91d){_0x45f4aa=_0x45f4aa-0x0;var _0x296353=_0x5186[_0x45f4aa];return _0x296353;};'use strict';var _=require(_0x6518('0x0'));var util=require(_0x6518('0x1'));var moment=require(_0x6518('0x2'));var BPromise=require(_0x6518('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6518('0x4'));var db=require(_0x6518('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6518('0x6'));var config=require('../../config/environment');var jayson=require(_0x6518('0x7'));var client=jayson[_0x6518('0x8')][_0x6518('0x9')]({'port':0x232a});config['redis']=_[_0x6518('0xa')](config['redis'],{'host':_0x6518('0xb'),'port':0x18eb});var socket=require(_0x6518('0xc'))(new Redis(config[_0x6518('0xd')]));require(_0x6518('0xe'))['register'](socket);function respondWithRpcPromise(_0x3414ff,_0x3b2e34,_0x2ba042){return new BPromise(function(_0x3e42dd,_0x3ea3d7){return client[_0x6518('0xf')](_0x3414ff,_0x2ba042)[_0x6518('0x10')](function(_0xaa4c87){logger[_0x6518('0x11')](_0x6518('0x12'),_0x3b2e34,_0x6518('0x13'));logger['debug'](_0x6518('0x14'),_0x3b2e34,_0x6518('0x13'),JSON[_0x6518('0x15')](_0xaa4c87));if(_0xaa4c87['error']){if(_0xaa4c87['error'][_0x6518('0x16')]===0x1f4){logger[_0x6518('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x3b2e34,_0xaa4c87[_0x6518('0x17')][_0x6518('0x18')]);return _0x3ea3d7(_0xaa4c87['error'][_0x6518('0x18')]);}logger[_0x6518('0x17')](_0x6518('0x12'),_0x3b2e34,_0xaa4c87['error']['message']);return _0x3e42dd(_0xaa4c87[_0x6518('0x17')][_0x6518('0x18')]);}else{logger[_0x6518('0x11')](_0x6518('0x12'),_0x3b2e34,_0x6518('0x13'));_0x3e42dd(_0xaa4c87['result'][_0x6518('0x18')]);}})[_0x6518('0x19')](function(_0x53f49a){logger[_0x6518('0x17')](_0x6518('0x12'),_0x3b2e34,_0x53f49a);_0x3ea3d7(_0x53f49a);});});}