98dd28f04421bc4b0640519486b7f9af432d4c5b
[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 _0xf105=['register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket'];(function(_0x49f3a4,_0x2d0f9d){var _0x559fbf=function(_0x2ce9f9){while(--_0x2ce9f9){_0x49f3a4['push'](_0x49f3a4['shift']());}};_0x559fbf(++_0x2d0f9d);}(_0xf105,0x1b0));var _0x5f10=function(_0xcdaaa6,_0x4767df){_0xcdaaa6=_0xcdaaa6-0x0;var _0x575d02=_0xf105[_0xcdaaa6];return _0x575d02;};'use strict';var _=require(_0x5f10('0x0'));var util=require(_0x5f10('0x1'));var moment=require(_0x5f10('0x2'));var BPromise=require(_0x5f10('0x3'));var rs=require(_0x5f10('0x4'));var fs=require('fs');var Redis=require(_0x5f10('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f10('0x6'));var logger=require('../../config/logger')(_0x5f10('0x7'));var config=require(_0x5f10('0x8'));var jayson=require(_0x5f10('0x9'));var client=jayson[_0x5f10('0xa')][_0x5f10('0xb')]({'port':0x232a});config[_0x5f10('0xc')]=_[_0x5f10('0xd')](config[_0x5f10('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f10('0xe'))(new Redis(config[_0x5f10('0xc')]));require(_0x5f10('0xf'))[_0x5f10('0x10')](socket);function respondWithRpcPromise(_0x1b5463,_0x6dc96e,_0x540d92){return new BPromise(function(_0x1009b9,_0x3fd8eb){return client[_0x5f10('0x11')](_0x1b5463,_0x540d92)[_0x5f10('0x12')](function(_0x20fad6){logger[_0x5f10('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x6dc96e,_0x5f10('0x14'));logger[_0x5f10('0x15')](_0x5f10('0x16'),_0x6dc96e,_0x5f10('0x14'),JSON['stringify'](_0x20fad6));if(_0x20fad6['error']){if(_0x20fad6[_0x5f10('0x17')][_0x5f10('0x18')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x6dc96e,_0x20fad6[_0x5f10('0x17')]['message']);return _0x3fd8eb(_0x20fad6['error']['message']);}logger[_0x5f10('0x17')](_0x5f10('0x19'),_0x6dc96e,_0x20fad6['error'][_0x5f10('0x1a')]);return _0x1009b9(_0x20fad6[_0x5f10('0x17')]['message']);}else{logger[_0x5f10('0x13')](_0x5f10('0x19'),_0x6dc96e,_0x5f10('0x14'));_0x1009b9(_0x20fad6[_0x5f10('0x1b')]['message']);}})['catch'](function(_0x40c679){logger[_0x5f10('0x17')](_0x5f10('0x19'),_0x6dc96e,_0x40c679);_0x3fd8eb(_0x40c679);});});}