Built motion from commit 9d0783e6.|2.6.13
[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 _0xd916=['../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2c7626,_0x6c430e){var _0x3a2add=function(_0x1f96a9){while(--_0x1f96a9){_0x2c7626['push'](_0x2c7626['shift']());}};_0x3a2add(++_0x6c430e);}(_0xd916,0x18a));var _0x6d91=function(_0x528385,_0x46c45c){_0x528385=_0x528385-0x0;var _0x44893c=_0xd916[_0x528385];return _0x44893c;};'use strict';var _=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var moment=require(_0x6d91('0x2'));var BPromise=require(_0x6d91('0x3'));var rs=require(_0x6d91('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d91('0x5'))['db'];var utils=require(_0x6d91('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6d91('0x7'));var jayson=require(_0x6d91('0x8'));var client=jayson['client'][_0x6d91('0x9')]({'port':0x232a});config[_0x6d91('0xa')]=_[_0x6d91('0xb')](config[_0x6d91('0xa')],{'host':_0x6d91('0xc'),'port':0x18eb});var socket=require(_0x6d91('0xd'))(new Redis(config[_0x6d91('0xa')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x598756,_0x5ae90d,_0xab3051){return new BPromise(function(_0xae0aa1,_0x2e2cdd){return client[_0x6d91('0xe')](_0x598756,_0xab3051)[_0x6d91('0xf')](function(_0x540ddd){logger[_0x6d91('0x10')](_0x6d91('0x11'),_0x5ae90d,_0x6d91('0x12'));logger[_0x6d91('0x13')](_0x6d91('0x14'),_0x5ae90d,_0x6d91('0x12'),JSON[_0x6d91('0x15')](_0x540ddd));if(_0x540ddd[_0x6d91('0x16')]){if(_0x540ddd[_0x6d91('0x16')][_0x6d91('0x17')]===0x1f4){logger[_0x6d91('0x16')](_0x6d91('0x11'),_0x5ae90d,_0x540ddd[_0x6d91('0x16')][_0x6d91('0x18')]);return _0x2e2cdd(_0x540ddd[_0x6d91('0x16')]['message']);}logger[_0x6d91('0x16')](_0x6d91('0x11'),_0x5ae90d,_0x540ddd[_0x6d91('0x16')][_0x6d91('0x18')]);return _0xae0aa1(_0x540ddd[_0x6d91('0x16')][_0x6d91('0x18')]);}else{logger['info'](_0x6d91('0x11'),_0x5ae90d,'request\x20sent');_0xae0aa1(_0x540ddd['result'][_0x6d91('0x18')]);}})['catch'](function(_0xa8cc9){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x5ae90d,_0xa8cc9);_0x2e2cdd(_0xa8cc9);});});}