Built motion from commit (unavailable).|2.5.22
[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 _0x76a6=['redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xe66daa,_0x35c239){var _0x35d538=function(_0x4dd0cd){while(--_0x4dd0cd){_0xe66daa['push'](_0xe66daa['shift']());}};_0x35d538(++_0x35c239);}(_0x76a6,0x18b));var _0x676a=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x76a6[_0x56fe98];return _0x212f4f;};'use strict';var _=require(_0x676a('0x0'));var util=require(_0x676a('0x1'));var moment=require('moment');var BPromise=require(_0x676a('0x2'));var rs=require(_0x676a('0x3'));var fs=require('fs');var Redis=require(_0x676a('0x4'));var db=require(_0x676a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x676a('0x6'))(_0x676a('0x7'));var config=require(_0x676a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x676a('0x9')][_0x676a('0xa')]({'port':0x232a});config[_0x676a('0xb')]=_[_0x676a('0xc')](config['redis'],{'host':_0x676a('0xd'),'port':0x18eb});var socket=require(_0x676a('0xe'))(new Redis(config[_0x676a('0xb')]));require(_0x676a('0xf'))[_0x676a('0x10')](socket);function respondWithRpcPromise(_0x435062,_0x403c64,_0x1779f8){return new BPromise(function(_0x373024,_0x1d517b){return client[_0x676a('0x11')](_0x435062,_0x1779f8)[_0x676a('0x12')](function(_0x52a6e2){logger['info'](_0x676a('0x13'),_0x403c64,_0x676a('0x14'));logger[_0x676a('0x15')](_0x676a('0x16'),_0x403c64,_0x676a('0x14'),JSON[_0x676a('0x17')](_0x52a6e2));if(_0x52a6e2[_0x676a('0x18')]){if(_0x52a6e2[_0x676a('0x18')][_0x676a('0x19')]===0x1f4){logger[_0x676a('0x18')](_0x676a('0x13'),_0x403c64,_0x52a6e2[_0x676a('0x18')]['message']);return _0x1d517b(_0x52a6e2[_0x676a('0x18')][_0x676a('0x1a')]);}logger[_0x676a('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x403c64,_0x52a6e2[_0x676a('0x18')]['message']);return _0x373024(_0x52a6e2[_0x676a('0x18')][_0x676a('0x1a')]);}else{logger[_0x676a('0x1b')](_0x676a('0x13'),_0x403c64,_0x676a('0x14'));_0x373024(_0x52a6e2['result']['message']);}})[_0x676a('0x1c')](function(_0x37baeb){logger[_0x676a('0x18')](_0x676a('0x13'),_0x403c64,_0x37baeb);_0x1d517b(_0x37baeb);});});}