d54e453fbac5389035421fdbe0e726a574fe9674
[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 _0x423c=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x444cbb,_0x2d6a39){var _0x232ef9=function(_0x20c97e){while(--_0x20c97e){_0x444cbb['push'](_0x444cbb['shift']());}};_0x232ef9(++_0x2d6a39);}(_0x423c,0xba));var _0xc423=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x423c[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xc423('0x0'));var util=require(_0xc423('0x1'));var moment=require('moment');var BPromise=require(_0xc423('0x2'));var rs=require(_0xc423('0x3'));var fs=require('fs');var Redis=require(_0xc423('0x4'));var db=require(_0xc423('0x5'))['db'];var utils=require(_0xc423('0x6'));var logger=require(_0xc423('0x7'))(_0xc423('0x8'));var config=require(_0xc423('0x9'));var jayson=require(_0xc423('0xa'));var client=jayson[_0xc423('0xb')]['http']({'port':0x232a});config[_0xc423('0xc')]=_[_0xc423('0xd')](config[_0xc423('0xc')],{'host':_0xc423('0xe'),'port':0x18eb});var socket=require(_0xc423('0xf'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xc423('0x10')](socket);function respondWithRpcPromise(_0x165b74,_0x50d9e0,_0x5a3c90){return new BPromise(function(_0x18d802,_0x514ae5){return client['request'](_0x165b74,_0x5a3c90)[_0xc423('0x11')](function(_0x4cd551){logger[_0xc423('0x12')](_0xc423('0x13'),_0x50d9e0,_0xc423('0x14'));logger[_0xc423('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x50d9e0,_0xc423('0x14'),JSON[_0xc423('0x16')](_0x4cd551));if(_0x4cd551['error']){if(_0x4cd551['error'][_0xc423('0x17')]===0x1f4){logger[_0xc423('0x18')](_0xc423('0x13'),_0x50d9e0,_0x4cd551[_0xc423('0x18')]['message']);return _0x514ae5(_0x4cd551['error'][_0xc423('0x19')]);}logger[_0xc423('0x18')](_0xc423('0x13'),_0x50d9e0,_0x4cd551[_0xc423('0x18')][_0xc423('0x19')]);return _0x18d802(_0x4cd551['error'][_0xc423('0x19')]);}else{logger[_0xc423('0x12')](_0xc423('0x13'),_0x50d9e0,_0xc423('0x14'));_0x18d802(_0x4cd551[_0xc423('0x1a')][_0xc423('0x19')]);}})[_0xc423('0x1b')](function(_0x1962c9){logger[_0xc423('0x18')](_0xc423('0x13'),_0x50d9e0,_0x1962c9);_0x514ae5(_0x1962c9);});});}