6f85f7f3bfdc2d1fbbd30eba6f8efe303755e103
[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 _0x7350=['message','result','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','localhost','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2e4bd3,_0x349825){var _0x1c32e9=function(_0x1a50c9){while(--_0x1a50c9){_0x2e4bd3['push'](_0x2e4bd3['shift']());}};_0x1c32e9(++_0x349825);}(_0x7350,0x12e));var _0x0735=function(_0x4781c1,_0x3ead10){_0x4781c1=_0x4781c1-0x0;var _0x3b6395=_0x7350[_0x4781c1];return _0x3b6395;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0735('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0735('0x1'));var db=require(_0x0735('0x2'))['db'];var utils=require(_0x0735('0x3'));var logger=require(_0x0735('0x4'))(_0x0735('0x5'));var config=require('../../config/environment');var jayson=require(_0x0735('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0735('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0735('0x8'))['register'](socket);function respondWithRpcPromise(_0x4ebea5,_0x2cd289,_0x1253b8){return new BPromise(function(_0x186804,_0x325586){return client[_0x0735('0x9')](_0x4ebea5,_0x1253b8)[_0x0735('0xa')](function(_0x3c8994){logger[_0x0735('0xb')](_0x0735('0xc'),_0x2cd289,_0x0735('0xd'));logger[_0x0735('0xe')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2cd289,_0x0735('0xd'),JSON[_0x0735('0xf')](_0x3c8994));if(_0x3c8994[_0x0735('0x10')]){if(_0x3c8994[_0x0735('0x10')][_0x0735('0x11')]===0x1f4){logger[_0x0735('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x2cd289,_0x3c8994[_0x0735('0x10')][_0x0735('0x12')]);return _0x325586(_0x3c8994[_0x0735('0x10')][_0x0735('0x12')]);}logger['error'](_0x0735('0xc'),_0x2cd289,_0x3c8994[_0x0735('0x10')]['message']);return _0x186804(_0x3c8994[_0x0735('0x10')]['message']);}else{logger[_0x0735('0xb')](_0x0735('0xc'),_0x2cd289,_0x0735('0xd'));_0x186804(_0x3c8994[_0x0735('0x13')][_0x0735('0x12')]);}})['catch'](function(_0x7bab42){logger[_0x0735('0x10')](_0x0735('0xc'),_0x2cd289,_0x7bab42);_0x325586(_0x7bab42);});});}