Built motion from commit (unavailable).|2.5.0
[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 _0x7181=['socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x5c9865,_0x1a299a){var _0x54c22b=function(_0x538537){while(--_0x538537){_0x5c9865['push'](_0x5c9865['shift']());}};_0x54c22b(++_0x1a299a);}(_0x7181,0xb1));var _0x1718=function(_0x16c467,_0x53d6fa){_0x16c467=_0x16c467-0x0;var _0x22db4f=_0x7181[_0x16c467];return _0x22db4f;};'use strict';var _=require('lodash');var util=require(_0x1718('0x0'));var moment=require('moment');var BPromise=require(_0x1718('0x1'));var rs=require(_0x1718('0x2'));var fs=require('fs');var Redis=require(_0x1718('0x3'));var db=require(_0x1718('0x4'))['db'];var utils=require(_0x1718('0x5'));var logger=require('../../config/logger')(_0x1718('0x6'));var config=require(_0x1718('0x7'));var jayson=require(_0x1718('0x8'));var client=jayson[_0x1718('0x9')]['http']({'port':0x232a});config[_0x1718('0xa')]=_[_0x1718('0xb')](config[_0x1718('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1718('0xc'))(new Redis(config[_0x1718('0xa')]));require(_0x1718('0xd'))[_0x1718('0xe')](socket);function respondWithRpcPromise(_0x45b6db,_0x15141f,_0x34f5d3){return new BPromise(function(_0x91409a,_0x3c838c){return client[_0x1718('0xf')](_0x45b6db,_0x34f5d3)[_0x1718('0x10')](function(_0x2700e4){logger[_0x1718('0x11')](_0x1718('0x12'),_0x15141f,_0x1718('0x13'));logger[_0x1718('0x14')](_0x1718('0x15'),_0x15141f,'request\x20sent',JSON[_0x1718('0x16')](_0x2700e4));if(_0x2700e4[_0x1718('0x17')]){if(_0x2700e4[_0x1718('0x17')]['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x15141f,_0x2700e4[_0x1718('0x17')][_0x1718('0x18')]);return _0x3c838c(_0x2700e4['error'][_0x1718('0x18')]);}logger['error'](_0x1718('0x12'),_0x15141f,_0x2700e4[_0x1718('0x17')][_0x1718('0x18')]);return _0x91409a(_0x2700e4[_0x1718('0x17')][_0x1718('0x18')]);}else{logger[_0x1718('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x15141f,_0x1718('0x13'));_0x91409a(_0x2700e4[_0x1718('0x19')][_0x1718('0x18')]);}})[_0x1718('0x1a')](function(_0x34bc0f){logger[_0x1718('0x17')](_0x1718('0x12'),_0x15141f,_0x34bc0f);_0x3c838c(_0x34bc0f);});});}