Built motion from commit (unavailable).|2.6.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 _0x19e9=['message','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','debug','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x19e9,0x161));var _0x919e=function(_0x2c9a31,_0x5b26f9){_0x2c9a31=_0x2c9a31-0x0;var _0x4291f7=_0x19e9[_0x2c9a31];return _0x4291f7;};'use strict';var _=require(_0x919e('0x0'));var util=require(_0x919e('0x1'));var moment=require(_0x919e('0x2'));var BPromise=require(_0x919e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x919e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x919e('0x5'));var config=require(_0x919e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x919e('0x7')]({'port':0x232a});config[_0x919e('0x8')]=_[_0x919e('0x9')](config[_0x919e('0x8')],{'host':_0x919e('0xa'),'port':0x18eb});var socket=require(_0x919e('0xb'))(new Redis(config[_0x919e('0x8')]));require(_0x919e('0xc'))[_0x919e('0xd')](socket);function respondWithRpcPromise(_0x3917f6,_0x5d76e7,_0x45f219){return new BPromise(function(_0x3ec3b5,_0x2860ae){return client['request'](_0x3917f6,_0x45f219)[_0x919e('0xe')](function(_0x512b32){logger[_0x919e('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x5d76e7,'request\x20sent');logger[_0x919e('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5d76e7,_0x919e('0x11'),JSON[_0x919e('0x12')](_0x512b32));if(_0x512b32[_0x919e('0x13')]){if(_0x512b32[_0x919e('0x13')][_0x919e('0x14')]===0x1f4){logger[_0x919e('0x13')](_0x919e('0x15'),_0x5d76e7,_0x512b32[_0x919e('0x13')][_0x919e('0x16')]);return _0x2860ae(_0x512b32[_0x919e('0x13')][_0x919e('0x16')]);}logger[_0x919e('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x5d76e7,_0x512b32[_0x919e('0x13')]['message']);return _0x3ec3b5(_0x512b32[_0x919e('0x13')][_0x919e('0x16')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x5d76e7,_0x919e('0x11'));_0x3ec3b5(_0x512b32[_0x919e('0x17')][_0x919e('0x16')]);}})[_0x919e('0x18')](function(_0x4e73e2){logger[_0x919e('0x13')](_0x919e('0x15'),_0x5d76e7,_0x4e73e2);_0x2860ae(_0x4e73e2);});});}