Built motion from commit 753c950e.|2.5.42
[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 _0x28b1=['../../mysqldb','../../config/utils','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x28b1,0x1d6));var _0x128b=function(_0x3a7ffc,_0x12ab2a){_0x3a7ffc=_0x3a7ffc-0x0;var _0x34593a=_0x28b1[_0x3a7ffc];return _0x34593a;};'use strict';var _=require(_0x128b('0x0'));var util=require(_0x128b('0x1'));var moment=require(_0x128b('0x2'));var BPromise=require('bluebird');var rs=require(_0x128b('0x3'));var fs=require('fs');var Redis=require(_0x128b('0x4'));var db=require(_0x128b('0x5'))['db'];var utils=require(_0x128b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x128b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x128b('0x8')]({'port':0x232a});config['redis']=_[_0x128b('0x9')](config[_0x128b('0xa')],{'host':_0x128b('0xb'),'port':0x18eb});var socket=require(_0x128b('0xc'))(new Redis(config[_0x128b('0xa')]));require(_0x128b('0xd'))['register'](socket);function respondWithRpcPromise(_0x5252ca,_0xcc2756,_0x568534){return new BPromise(function(_0x5c73a3,_0x2d807b){return client[_0x128b('0xe')](_0x5252ca,_0x568534)[_0x128b('0xf')](function(_0x2f8056){logger[_0x128b('0x10')]('VoicePrefix,\x20%s,\x20%s',_0xcc2756,_0x128b('0x11'));logger['debug'](_0x128b('0x12'),_0xcc2756,_0x128b('0x11'),JSON[_0x128b('0x13')](_0x2f8056));if(_0x2f8056[_0x128b('0x14')]){if(_0x2f8056[_0x128b('0x14')][_0x128b('0x15')]===0x1f4){logger[_0x128b('0x14')](_0x128b('0x16'),_0xcc2756,_0x2f8056[_0x128b('0x14')][_0x128b('0x17')]);return _0x2d807b(_0x2f8056[_0x128b('0x14')][_0x128b('0x17')]);}logger[_0x128b('0x14')]('VoicePrefix,\x20%s,\x20%s',_0xcc2756,_0x2f8056['error']['message']);return _0x5c73a3(_0x2f8056['error']['message']);}else{logger[_0x128b('0x10')](_0x128b('0x16'),_0xcc2756,_0x128b('0x11'));_0x5c73a3(_0x2f8056[_0x128b('0x18')][_0x128b('0x17')]);}})['catch'](function(_0x7b16bf){logger[_0x128b('0x14')](_0x128b('0x16'),_0xcc2756,_0x7b16bf);_0x2d807b(_0x7b16bf);});});}