Built motion from commit (unavailable).|2.5.8
[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 _0xf0d9=['client','redis','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xc6afe9,_0x3eae56){var _0x21d51c=function(_0x28cc68){while(--_0x28cc68){_0xc6afe9['push'](_0xc6afe9['shift']());}};_0x21d51c(++_0x3eae56);}(_0xf0d9,0x78));var _0x9f0d=function(_0x1fad17,_0x480227){_0x1fad17=_0x1fad17-0x0;var _0x163eec=_0xf0d9[_0x1fad17];return _0x163eec;};'use strict';var _=require(_0x9f0d('0x0'));var util=require(_0x9f0d('0x1'));var moment=require(_0x9f0d('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f0d('0x3'));var fs=require('fs');var Redis=require(_0x9f0d('0x4'));var db=require(_0x9f0d('0x5'))['db'];var utils=require(_0x9f0d('0x6'));var logger=require('../../config/logger')(_0x9f0d('0x7'));var config=require(_0x9f0d('0x8'));var jayson=require(_0x9f0d('0x9'));var client=jayson[_0x9f0d('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f0d('0xb')]));require(_0x9f0d('0xc'))['register'](socket);function respondWithRpcPromise(_0x41c8ef,_0x111ffe,_0x5e8f45){return new BPromise(function(_0x560c4e,_0x2e48de){return client[_0x9f0d('0xd')](_0x41c8ef,_0x5e8f45)[_0x9f0d('0xe')](function(_0x21e765){logger[_0x9f0d('0xf')](_0x9f0d('0x10'),_0x111ffe,_0x9f0d('0x11'));logger[_0x9f0d('0x12')](_0x9f0d('0x13'),_0x111ffe,_0x9f0d('0x11'),JSON[_0x9f0d('0x14')](_0x21e765));if(_0x21e765['error']){if(_0x21e765[_0x9f0d('0x15')][_0x9f0d('0x16')]===0x1f4){logger[_0x9f0d('0x15')](_0x9f0d('0x10'),_0x111ffe,_0x21e765[_0x9f0d('0x15')][_0x9f0d('0x17')]);return _0x2e48de(_0x21e765[_0x9f0d('0x15')]['message']);}logger[_0x9f0d('0x15')](_0x9f0d('0x10'),_0x111ffe,_0x21e765[_0x9f0d('0x15')][_0x9f0d('0x17')]);return _0x560c4e(_0x21e765['error'][_0x9f0d('0x17')]);}else{logger[_0x9f0d('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x111ffe,_0x9f0d('0x11'));_0x560c4e(_0x21e765[_0x9f0d('0x18')][_0x9f0d('0x17')]);}})[_0x9f0d('0x19')](function(_0x34eccd){logger['error'](_0x9f0d('0x10'),_0x111ffe,_0x34eccd);_0x2e48de(_0x34eccd);});});}