Built motion from commit (unavailable).|2.5.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 _0x76e4=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x76e4,0x12c));var _0x476e=function(_0x207e1a,_0x52e04d){_0x207e1a=_0x207e1a-0x0;var _0x34bce7=_0x76e4[_0x207e1a];return _0x34bce7;};'use strict';var _=require(_0x476e('0x0'));var util=require('util');var moment=require(_0x476e('0x1'));var BPromise=require(_0x476e('0x2'));var rs=require(_0x476e('0x3'));var fs=require('fs');var Redis=require(_0x476e('0x4'));var db=require(_0x476e('0x5'))['db'];var utils=require(_0x476e('0x6'));var logger=require(_0x476e('0x7'))(_0x476e('0x8'));var config=require(_0x476e('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x476e('0xa')]=_[_0x476e('0xb')](config[_0x476e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x476e('0xc'))(new Redis(config[_0x476e('0xa')]));require(_0x476e('0xd'))[_0x476e('0xe')](socket);function respondWithRpcPromise(_0x248033,_0x186053,_0x159451){return new BPromise(function(_0x3694ff,_0x294eb6){return client[_0x476e('0xf')](_0x248033,_0x159451)[_0x476e('0x10')](function(_0x1a9639){logger['info'](_0x476e('0x11'),_0x186053,_0x476e('0x12'));logger['debug'](_0x476e('0x13'),_0x186053,_0x476e('0x12'),JSON['stringify'](_0x1a9639));if(_0x1a9639[_0x476e('0x14')]){if(_0x1a9639[_0x476e('0x14')][_0x476e('0x15')]===0x1f4){logger[_0x476e('0x14')](_0x476e('0x11'),_0x186053,_0x1a9639['error'][_0x476e('0x16')]);return _0x294eb6(_0x1a9639['error'][_0x476e('0x16')]);}logger[_0x476e('0x14')](_0x476e('0x11'),_0x186053,_0x1a9639[_0x476e('0x14')][_0x476e('0x16')]);return _0x3694ff(_0x1a9639['error']['message']);}else{logger['info'](_0x476e('0x11'),_0x186053,'request\x20sent');_0x3694ff(_0x1a9639[_0x476e('0x17')]['message']);}})[_0x476e('0x18')](function(_0x134b0e){logger['error'](_0x476e('0x11'),_0x186053,_0x134b0e);_0x294eb6(_0x134b0e);});});}