Built motion from commit (unavailable).|2.5.14
[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 _0x0216=['client','http','defaults','localhost','socket.io-emitter','redis','register','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','VoicePrefix,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xd3aca5,_0x36777f){var _0x302f8e=function(_0x51ba7f){while(--_0x51ba7f){_0xd3aca5['push'](_0xd3aca5['shift']());}};_0x302f8e(++_0x36777f);}(_0x0216,0x149));var _0x6021=function(_0x5b66ce,_0x4818ba){_0x5b66ce=_0x5b66ce-0x0;var _0x316e77=_0x0216[_0x5b66ce];return _0x316e77;};'use strict';var _=require(_0x6021('0x0'));var util=require(_0x6021('0x1'));var moment=require('moment');var BPromise=require(_0x6021('0x2'));var rs=require(_0x6021('0x3'));var fs=require('fs');var Redis=require(_0x6021('0x4'));var db=require(_0x6021('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6021('0x6'))(_0x6021('0x7'));var config=require(_0x6021('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6021('0x9')][_0x6021('0xa')]({'port':0x232a});config['redis']=_[_0x6021('0xb')](config['redis'],{'host':_0x6021('0xc'),'port':0x18eb});var socket=require(_0x6021('0xd'))(new Redis(config[_0x6021('0xe')]));require('./voicePrefix.socket')[_0x6021('0xf')](socket);function respondWithRpcPromise(_0x4e1073,_0x37b6a1,_0x35ecbd){return new BPromise(function(_0xf52738,_0x47cbe1){return client['request'](_0x4e1073,_0x35ecbd)[_0x6021('0x10')](function(_0x1a46a5){logger[_0x6021('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x37b6a1,_0x6021('0x12'));logger[_0x6021('0x13')](_0x6021('0x14'),_0x37b6a1,_0x6021('0x12'),JSON['stringify'](_0x1a46a5));if(_0x1a46a5['error']){if(_0x1a46a5[_0x6021('0x15')][_0x6021('0x16')]===0x1f4){logger[_0x6021('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x37b6a1,_0x1a46a5[_0x6021('0x15')]['message']);return _0x47cbe1(_0x1a46a5[_0x6021('0x15')][_0x6021('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x37b6a1,_0x1a46a5[_0x6021('0x15')][_0x6021('0x17')]);return _0xf52738(_0x1a46a5[_0x6021('0x15')]['message']);}else{logger['info'](_0x6021('0x18'),_0x37b6a1,'request\x20sent');_0xf52738(_0x1a46a5['result'][_0x6021('0x17')]);}})[_0x6021('0x19')](function(_0x35d076){logger[_0x6021('0x15')](_0x6021('0x18'),_0x37b6a1,_0x35d076);_0x47cbe1(_0x35d076);});});}