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 _0xa14a=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment'];(function(_0x567be4,_0x528383){var _0x13067b=function(_0x3afb62){while(--_0x3afb62){_0x567be4['push'](_0x567be4['shift']());}};_0x13067b(++_0x528383);}(_0xa14a,0x1b9));var _0xaa14=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xa14a[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xaa14('0x0'));var util=require('util');var moment=require(_0xaa14('0x1'));var BPromise=require(_0xaa14('0x2'));var rs=require(_0xaa14('0x3'));var fs=require('fs');var Redis=require(_0xaa14('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaa14('0x5'));var config=require(_0xaa14('0x6'));var jayson=require(_0xaa14('0x7'));var client=jayson['client'][_0xaa14('0x8')]({'port':0x232a});config[_0xaa14('0x9')]=_[_0xaa14('0xa')](config['redis'],{'host':_0xaa14('0xb'),'port':0x18eb});var socket=require(_0xaa14('0xc'))(new Redis(config[_0xaa14('0x9')]));require(_0xaa14('0xd'))[_0xaa14('0xe')](socket);function respondWithRpcPromise(_0x3ddaef,_0x1c6689,_0x454b9c){return new BPromise(function(_0x1fdd61,_0x1ca205){return client[_0xaa14('0xf')](_0x3ddaef,_0x454b9c)[_0xaa14('0x10')](function(_0x116cc4){logger[_0xaa14('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1c6689,_0xaa14('0x12'));logger[_0xaa14('0x13')](_0xaa14('0x14'),_0x1c6689,_0xaa14('0x12'),JSON[_0xaa14('0x15')](_0x116cc4));if(_0x116cc4[_0xaa14('0x16')]){if(_0x116cc4['error'][_0xaa14('0x17')]===0x1f4){logger[_0xaa14('0x16')](_0xaa14('0x18'),_0x1c6689,_0x116cc4['error']['message']);return _0x1ca205(_0x116cc4[_0xaa14('0x16')][_0xaa14('0x19')]);}logger['error'](_0xaa14('0x18'),_0x1c6689,_0x116cc4[_0xaa14('0x16')][_0xaa14('0x19')]);return _0x1fdd61(_0x116cc4['error'][_0xaa14('0x19')]);}else{logger[_0xaa14('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1c6689,'request\x20sent');_0x1fdd61(_0x116cc4[_0xaa14('0x1a')]['message']);}})[_0xaa14('0x1b')](function(_0x4579bc){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x1c6689,_0x4579bc);_0x1ca205(_0x4579bc);});});}