12a8f519e170eb94c529659ca1fa31763145d534
[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 _0x9a1c=['then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','request'];(function(_0x32d91c,_0x459413){var _0x347c7d=function(_0xff141b){while(--_0xff141b){_0x32d91c['push'](_0x32d91c['shift']());}};_0x347c7d(++_0x459413);}(_0x9a1c,0xec));var _0xc9a1=function(_0x159cd8,_0x3b372a){_0x159cd8=_0x159cd8-0x0;var _0x361e18=_0x9a1c[_0x159cd8];return _0x361e18;};'use strict';var _=require(_0xc9a1('0x0'));var util=require(_0xc9a1('0x1'));var moment=require(_0xc9a1('0x2'));var BPromise=require(_0xc9a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9a1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9a1('0x5'));var logger=require(_0xc9a1('0x6'))('rpc');var config=require(_0xc9a1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc9a1('0x8')]({'port':0x232a});config[_0xc9a1('0x9')]=_[_0xc9a1('0xa')](config[_0xc9a1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc9a1('0xb'))(new Redis(config[_0xc9a1('0x9')]));require(_0xc9a1('0xc'))['register'](socket);function respondWithRpcPromise(_0x232937,_0x2329ff,_0x43700e){return new BPromise(function(_0x3a158b,_0x42c1d3){return client[_0xc9a1('0xd')](_0x232937,_0x43700e)[_0xc9a1('0xe')](function(_0x178abd){logger[_0xc9a1('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x2329ff,_0xc9a1('0x10'));logger[_0xc9a1('0x11')](_0xc9a1('0x12'),_0x2329ff,'request\x20sent',JSON[_0xc9a1('0x13')](_0x178abd));if(_0x178abd['error']){if(_0x178abd[_0xc9a1('0x14')]['code']===0x1f4){logger[_0xc9a1('0x14')](_0xc9a1('0x15'),_0x2329ff,_0x178abd[_0xc9a1('0x14')][_0xc9a1('0x16')]);return _0x42c1d3(_0x178abd[_0xc9a1('0x14')][_0xc9a1('0x16')]);}logger[_0xc9a1('0x14')](_0xc9a1('0x15'),_0x2329ff,_0x178abd[_0xc9a1('0x14')][_0xc9a1('0x16')]);return _0x3a158b(_0x178abd[_0xc9a1('0x14')]['message']);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2329ff,'request\x20sent');_0x3a158b(_0x178abd[_0xc9a1('0x17')]['message']);}})[_0xc9a1('0x18')](function(_0x359297){logger[_0xc9a1('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x2329ff,_0x359297);_0x42c1d3(_0x359297);});});}