Built motion from commit (unavailable).|2.5.1
[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 _0xb524=['info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','then'];(function(_0x1728af,_0x26d2a9){var _0x393882=function(_0x17f01a){while(--_0x17f01a){_0x1728af['push'](_0x1728af['shift']());}};_0x393882(++_0x26d2a9);}(_0xb524,0xb2));var _0x4b52=function(_0x2e243c,_0x24fe21){_0x2e243c=_0x2e243c-0x0;var _0x4f91eb=_0xb524[_0x2e243c];return _0x4f91eb;};'use strict';var _=require('lodash');var util=require(_0x4b52('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4b52('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4b52('0x2'));var logger=require('../../config/logger')(_0x4b52('0x3'));var config=require(_0x4b52('0x4'));var jayson=require(_0x4b52('0x5'));var client=jayson[_0x4b52('0x6')][_0x4b52('0x7')]({'port':0x232a});config['redis']=_[_0x4b52('0x8')](config[_0x4b52('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b52('0xa'))(new Redis(config[_0x4b52('0x9')]));require(_0x4b52('0xb'))[_0x4b52('0xc')](socket);function respondWithRpcPromise(_0x40068b,_0x4fd61c,_0x1342cc){return new BPromise(function(_0xeb276d,_0xad343e){return client['request'](_0x40068b,_0x1342cc)[_0x4b52('0xd')](function(_0x308fc2){logger[_0x4b52('0xe')](_0x4b52('0xf'),_0x4fd61c,_0x4b52('0x10'));logger[_0x4b52('0x11')](_0x4b52('0x12'),_0x4fd61c,_0x4b52('0x10'),JSON[_0x4b52('0x13')](_0x308fc2));if(_0x308fc2['error']){if(_0x308fc2[_0x4b52('0x14')][_0x4b52('0x15')]===0x1f4){logger[_0x4b52('0x14')](_0x4b52('0xf'),_0x4fd61c,_0x308fc2[_0x4b52('0x14')][_0x4b52('0x16')]);return _0xad343e(_0x308fc2[_0x4b52('0x14')]['message']);}logger[_0x4b52('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x4fd61c,_0x308fc2['error'][_0x4b52('0x16')]);return _0xeb276d(_0x308fc2[_0x4b52('0x14')][_0x4b52('0x16')]);}else{logger[_0x4b52('0xe')](_0x4b52('0xf'),_0x4fd61c,'request\x20sent');_0xeb276d(_0x308fc2[_0x4b52('0x17')][_0x4b52('0x16')]);}})['catch'](function(_0x1ac8db){logger[_0x4b52('0x14')](_0x4b52('0xf'),_0x4fd61c,_0x1ac8db);_0xad343e(_0x1ac8db);});});}