Built motion from commit 1fa89557.|2.6.10
[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 _0x095b=['VoicePrefix,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2b7640,_0x2ca406){var _0x181339=function(_0x19ff0c){while(--_0x19ff0c){_0x2b7640['push'](_0x2b7640['shift']());}};_0x181339(++_0x2ca406);}(_0x095b,0x6e));var _0xb095=function(_0x18bbc8,_0x4ef946){_0x18bbc8=_0x18bbc8-0x0;var _0x4e3316=_0x095b[_0x18bbc8];return _0x4e3316;};'use strict';var _=require(_0xb095('0x0'));var util=require('util');var moment=require(_0xb095('0x1'));var BPromise=require(_0xb095('0x2'));var rs=require(_0xb095('0x3'));var fs=require('fs');var Redis=require(_0xb095('0x4'));var db=require(_0xb095('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb095('0x6'))(_0xb095('0x7'));var config=require(_0xb095('0x8'));var jayson=require(_0xb095('0x9'));var client=jayson[_0xb095('0xa')][_0xb095('0xb')]({'port':0x232a});config[_0xb095('0xc')]=_[_0xb095('0xd')](config[_0xb095('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb095('0xe'))(new Redis(config[_0xb095('0xc')]));require(_0xb095('0xf'))[_0xb095('0x10')](socket);function respondWithRpcPromise(_0x10efbe,_0x311c57,_0x5c3522){return new BPromise(function(_0x47f74d,_0x2e510a){return client[_0xb095('0x11')](_0x10efbe,_0x5c3522)['then'](function(_0x192d2){logger[_0xb095('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x311c57,_0xb095('0x13'));logger['debug'](_0xb095('0x14'),_0x311c57,_0xb095('0x13'),JSON[_0xb095('0x15')](_0x192d2));if(_0x192d2[_0xb095('0x16')]){if(_0x192d2[_0xb095('0x16')][_0xb095('0x17')]===0x1f4){logger[_0xb095('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x311c57,_0x192d2[_0xb095('0x16')][_0xb095('0x18')]);return _0x2e510a(_0x192d2[_0xb095('0x16')][_0xb095('0x18')]);}logger[_0xb095('0x16')](_0xb095('0x19'),_0x311c57,_0x192d2['error']['message']);return _0x47f74d(_0x192d2['error'][_0xb095('0x18')]);}else{logger[_0xb095('0x12')](_0xb095('0x19'),_0x311c57,_0xb095('0x13'));_0x47f74d(_0x192d2[_0xb095('0x1a')][_0xb095('0x18')]);}})['catch'](function(_0x7f9045){logger[_0xb095('0x16')](_0xb095('0x19'),_0x311c57,_0x7f9045);_0x2e510a(_0x7f9045);});});}