Built motion from commit (unavailable).|2.4.21
[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 _0xf0b7=['util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','VoicePrefix,\x20%s,\x20%s','result','lodash'];(function(_0x1f4955,_0x1716cc){var _0x491643=function(_0xa6e78a){while(--_0xa6e78a){_0x1f4955['push'](_0x1f4955['shift']());}};_0x491643(++_0x1716cc);}(_0xf0b7,0x158));var _0x7f0b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf0b7[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7f0b('0x0'));var util=require(_0x7f0b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f0b('0x2'));var db=require(_0x7f0b('0x3'))['db'];var utils=require(_0x7f0b('0x4'));var logger=require('../../config/logger')(_0x7f0b('0x5'));var config=require(_0x7f0b('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7f0b('0x7')]=_[_0x7f0b('0x8')](config[_0x7f0b('0x7')],{'host':_0x7f0b('0x9'),'port':0x18eb});var socket=require(_0x7f0b('0xa'))(new Redis(config[_0x7f0b('0x7')]));require(_0x7f0b('0xb'))[_0x7f0b('0xc')](socket);function respondWithRpcPromise(_0x6b6a24,_0x219ca2,_0x1ee905){return new BPromise(function(_0xf2b9c4,_0x3b4abb){return client[_0x7f0b('0xd')](_0x6b6a24,_0x1ee905)[_0x7f0b('0xe')](function(_0x416536){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x219ca2,_0x7f0b('0xf'));logger[_0x7f0b('0x10')](_0x7f0b('0x11'),_0x219ca2,'request\x20sent',JSON[_0x7f0b('0x12')](_0x416536));if(_0x416536[_0x7f0b('0x13')]){if(_0x416536[_0x7f0b('0x13')]['code']===0x1f4){logger[_0x7f0b('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x219ca2,_0x416536[_0x7f0b('0x13')]['message']);return _0x3b4abb(_0x416536[_0x7f0b('0x13')][_0x7f0b('0x14')]);}logger[_0x7f0b('0x13')](_0x7f0b('0x15'),_0x219ca2,_0x416536[_0x7f0b('0x13')][_0x7f0b('0x14')]);return _0xf2b9c4(_0x416536[_0x7f0b('0x13')][_0x7f0b('0x14')]);}else{logger['info'](_0x7f0b('0x15'),_0x219ca2,_0x7f0b('0xf'));_0xf2b9c4(_0x416536[_0x7f0b('0x16')][_0x7f0b('0x14')]);}})['catch'](function(_0x3c55fc){logger[_0x7f0b('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x219ca2,_0x3c55fc);_0x3b4abb(_0x3c55fc);});});}