Built motion from commit (unavailable).|2.5.7
[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 _0x1136=['VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1136,0x76));var _0x6113=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1136[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x6113('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6113('0x1'));var rs=require(_0x6113('0x2'));var fs=require('fs');var Redis=require(_0x6113('0x3'));var db=require(_0x6113('0x4'))['db'];var utils=require(_0x6113('0x5'));var logger=require('../../config/logger')(_0x6113('0x6'));var config=require(_0x6113('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6113('0x8')]['http']({'port':0x232a});config[_0x6113('0x9')]=_[_0x6113('0xa')](config['redis'],{'host':_0x6113('0xb'),'port':0x18eb});var socket=require(_0x6113('0xc'))(new Redis(config['redis']));require(_0x6113('0xd'))['register'](socket);function respondWithRpcPromise(_0x1cd238,_0x5e264a,_0x1ed2bd){return new BPromise(function(_0x4a4e6e,_0x4fca1f){return client[_0x6113('0xe')](_0x1cd238,_0x1ed2bd)[_0x6113('0xf')](function(_0x52c56d){logger[_0x6113('0x10')](_0x6113('0x11'),_0x5e264a,'request\x20sent');logger[_0x6113('0x12')](_0x6113('0x13'),_0x5e264a,'request\x20sent',JSON[_0x6113('0x14')](_0x52c56d));if(_0x52c56d['error']){if(_0x52c56d[_0x6113('0x15')][_0x6113('0x16')]===0x1f4){logger[_0x6113('0x15')](_0x6113('0x11'),_0x5e264a,_0x52c56d[_0x6113('0x15')][_0x6113('0x17')]);return _0x4fca1f(_0x52c56d[_0x6113('0x15')]['message']);}logger[_0x6113('0x15')](_0x6113('0x11'),_0x5e264a,_0x52c56d[_0x6113('0x15')][_0x6113('0x17')]);return _0x4a4e6e(_0x52c56d[_0x6113('0x15')][_0x6113('0x17')]);}else{logger[_0x6113('0x10')](_0x6113('0x11'),_0x5e264a,_0x6113('0x18'));_0x4a4e6e(_0x52c56d[_0x6113('0x19')][_0x6113('0x17')]);}})[_0x6113('0x1a')](function(_0x112c7d){logger['error'](_0x6113('0x11'),_0x5e264a,_0x112c7d);_0x4fca1f(_0x112c7d);});});}