Built motion from commit (unavailable).|2.5.11
[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 _0xd7c3=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis'];(function(_0x495d4b,_0x517ef4){var _0x200ef4=function(_0x5e8010){while(--_0x5e8010){_0x495d4b['push'](_0x495d4b['shift']());}};_0x200ef4(++_0x517ef4);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x51c81f,_0x3908eb){_0x51c81f=_0x51c81f-0x0;var _0x2cf182=_0xd7c3[_0x51c81f];return _0x2cf182;};'use strict';var _=require(_0x3d7c('0x0'));var util=require(_0x3d7c('0x1'));var moment=require(_0x3d7c('0x2'));var BPromise=require(_0x3d7c('0x3'));var rs=require(_0x3d7c('0x4'));var fs=require('fs');var Redis=require(_0x3d7c('0x5'));var db=require(_0x3d7c('0x6'))['db'];var utils=require(_0x3d7c('0x7'));var logger=require(_0x3d7c('0x8'))('rpc');var config=require(_0x3d7c('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3d7c('0xa')]=_[_0x3d7c('0xb')](config[_0x3d7c('0xa')],{'host':_0x3d7c('0xc'),'port':0x18eb});var socket=require(_0x3d7c('0xd'))(new Redis(config[_0x3d7c('0xa')]));require(_0x3d7c('0xe'))[_0x3d7c('0xf')](socket);function respondWithRpcPromise(_0x2e387e,_0x3a2d6c,_0x222e27){return new BPromise(function(_0x1aec45,_0x295fbb){return client[_0x3d7c('0x10')](_0x2e387e,_0x222e27)[_0x3d7c('0x11')](function(_0x25e2f9){logger[_0x3d7c('0x12')](_0x3d7c('0x13'),_0x3a2d6c,'request\x20sent');logger[_0x3d7c('0x14')](_0x3d7c('0x15'),_0x3a2d6c,_0x3d7c('0x16'),JSON[_0x3d7c('0x17')](_0x25e2f9));if(_0x25e2f9[_0x3d7c('0x18')]){if(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x19')]===0x1f4){logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);return _0x295fbb(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);}logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x25e2f9[_0x3d7c('0x18')]['message']);return _0x1aec45(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x3a2d6c,_0x3d7c('0x16'));_0x1aec45(_0x25e2f9[_0x3d7c('0x1b')][_0x3d7c('0x1a')]);}})[_0x3d7c('0x1c')](function(_0x591455){logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x591455);_0x295fbb(_0x591455);});});}