0e193d810d3fb32631a06773a0b688a347fc19df
[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 _0xaa37=['VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info'];(function(_0x295148,_0x585dfa){var _0xaf3076=function(_0x43ecd6){while(--_0x43ecd6){_0x295148['push'](_0x295148['shift']());}};_0xaf3076(++_0x585dfa);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xaa37[_0x279d37];return _0x530173;};'use strict';var _=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var moment=require(_0x7aa3('0x2'));var BPromise=require(_0x7aa3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7aa3('0x4'));var db=require(_0x7aa3('0x5'))['db'];var utils=require(_0x7aa3('0x6'));var logger=require(_0x7aa3('0x7'))(_0x7aa3('0x8'));var config=require(_0x7aa3('0x9'));var jayson=require(_0x7aa3('0xa'));var client=jayson['client'][_0x7aa3('0xb')]({'port':0x232a});config[_0x7aa3('0xc')]=_['defaults'](config[_0x7aa3('0xc')],{'host':_0x7aa3('0xd'),'port':0x18eb});var socket=require(_0x7aa3('0xe'))(new Redis(config['redis']));require(_0x7aa3('0xf'))[_0x7aa3('0x10')](socket);function respondWithRpcPromise(_0x321fd3,_0x1725d1,_0x10aa91){return new BPromise(function(_0x67838e,_0x5aa7f2){return client['request'](_0x321fd3,_0x10aa91)[_0x7aa3('0x11')](function(_0x509eb9){logger[_0x7aa3('0x12')](_0x7aa3('0x13'),_0x1725d1,'request\x20sent');logger[_0x7aa3('0x14')](_0x7aa3('0x15'),_0x1725d1,'request\x20sent',JSON['stringify'](_0x509eb9));if(_0x509eb9['error']){if(_0x509eb9[_0x7aa3('0x16')][_0x7aa3('0x17')]===0x1f4){logger[_0x7aa3('0x16')](_0x7aa3('0x13'),_0x1725d1,_0x509eb9[_0x7aa3('0x16')]['message']);return _0x5aa7f2(_0x509eb9[_0x7aa3('0x16')][_0x7aa3('0x18')]);}logger[_0x7aa3('0x16')](_0x7aa3('0x13'),_0x1725d1,_0x509eb9['error']['message']);return _0x67838e(_0x509eb9[_0x7aa3('0x16')]['message']);}else{logger[_0x7aa3('0x12')](_0x7aa3('0x13'),_0x1725d1,'request\x20sent');_0x67838e(_0x509eb9[_0x7aa3('0x19')][_0x7aa3('0x18')]);}})[_0x7aa3('0x1a')](function(_0x357564){logger[_0x7aa3('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x1725d1,_0x357564);_0x5aa7f2(_0x357564);});});}