Built motion from commit 3e059bc2.|2.5.32
[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 _0xe953=['defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x5e7502,_0x4dc76e){var _0x3650e9=function(_0x58ca86){while(--_0x58ca86){_0x5e7502['push'](_0x5e7502['shift']());}};_0x3650e9(++_0x4dc76e);}(_0xe953,0xf9));var _0x3e95=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xe953[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x3e95('0x0'));var util=require(_0x3e95('0x1'));var moment=require(_0x3e95('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e95('0x3'));var fs=require('fs');var Redis=require(_0x3e95('0x4'));var db=require(_0x3e95('0x5'))['db'];var utils=require(_0x3e95('0x6'));var logger=require(_0x3e95('0x7'))(_0x3e95('0x8'));var config=require(_0x3e95('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e95('0xa')]({'port':0x232a});config['redis']=_[_0x3e95('0xb')](config['redis'],{'host':_0x3e95('0xc'),'port':0x18eb});var socket=require(_0x3e95('0xd'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x3e95('0xe')](socket);function respondWithRpcPromise(_0x521403,_0x44996c,_0x478d4d){return new BPromise(function(_0x569b9d,_0x369081){return client[_0x3e95('0xf')](_0x521403,_0x478d4d)[_0x3e95('0x10')](function(_0x4882e3){logger[_0x3e95('0x11')](_0x3e95('0x12'),_0x44996c,_0x3e95('0x13'));logger[_0x3e95('0x14')](_0x3e95('0x15'),_0x44996c,'request\x20sent',JSON[_0x3e95('0x16')](_0x4882e3));if(_0x4882e3[_0x3e95('0x17')]){if(_0x4882e3[_0x3e95('0x17')]['code']===0x1f4){logger[_0x3e95('0x17')](_0x3e95('0x12'),_0x44996c,_0x4882e3[_0x3e95('0x17')][_0x3e95('0x18')]);return _0x369081(_0x4882e3[_0x3e95('0x17')][_0x3e95('0x18')]);}logger[_0x3e95('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x44996c,_0x4882e3[_0x3e95('0x17')][_0x3e95('0x18')]);return _0x569b9d(_0x4882e3[_0x3e95('0x17')]['message']);}else{logger[_0x3e95('0x11')](_0x3e95('0x12'),_0x44996c,_0x3e95('0x13'));_0x569b9d(_0x4882e3['result']['message']);}})[_0x3e95('0x19')](function(_0x56ab9b){logger['error'](_0x3e95('0x12'),_0x44996c,_0x56ab9b);_0x369081(_0x56ab9b);});});}