Built motion from commit (unavailable).|2.4.18
[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 _0x397a=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3cb11b,_0xfd38f4){var _0x37b8fc=function(_0x19e084){while(--_0x19e084){_0x3cb11b['push'](_0x3cb11b['shift']());}};_0x37b8fc(++_0xfd38f4);}(_0x397a,0x130));var _0xa397=function(_0x18d87f,_0x8cafdf){_0x18d87f=_0x18d87f-0x0;var _0x33c8a1=_0x397a[_0x18d87f];return _0x33c8a1;};'use strict';var _=require(_0xa397('0x0'));var util=require(_0xa397('0x1'));var moment=require(_0xa397('0x2'));var BPromise=require(_0xa397('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa397('0x4'));var db=require(_0xa397('0x5'))['db'];var utils=require(_0xa397('0x6'));var logger=require(_0xa397('0x7'))(_0xa397('0x8'));var config=require(_0xa397('0x9'));var jayson=require(_0xa397('0xa'));var client=jayson[_0xa397('0xb')][_0xa397('0xc')]({'port':0x232a});config[_0xa397('0xd')]=_[_0xa397('0xe')](config[_0xa397('0xd')],{'host':_0xa397('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa397('0xd')]));require(_0xa397('0x10'))[_0xa397('0x11')](socket);function respondWithRpcPromise(_0x5c454c,_0x28d07e,_0x5ee2c3){return new BPromise(function(_0x5dcb31,_0x4caa69){return client[_0xa397('0x12')](_0x5c454c,_0x5ee2c3)[_0xa397('0x13')](function(_0x16cb94){logger[_0xa397('0x14')](_0xa397('0x15'),_0x28d07e,_0xa397('0x16'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x28d07e,'request\x20sent',JSON[_0xa397('0x17')](_0x16cb94));if(_0x16cb94['error']){if(_0x16cb94[_0xa397('0x18')]['code']===0x1f4){logger[_0xa397('0x18')](_0xa397('0x15'),_0x28d07e,_0x16cb94[_0xa397('0x18')][_0xa397('0x19')]);return _0x4caa69(_0x16cb94[_0xa397('0x18')][_0xa397('0x19')]);}logger[_0xa397('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x28d07e,_0x16cb94[_0xa397('0x18')][_0xa397('0x19')]);return _0x5dcb31(_0x16cb94['error'][_0xa397('0x19')]);}else{logger[_0xa397('0x14')](_0xa397('0x15'),_0x28d07e,_0xa397('0x16'));_0x5dcb31(_0x16cb94['result'][_0xa397('0x19')]);}})['catch'](function(_0x1ac85d){logger[_0xa397('0x18')](_0xa397('0x15'),_0x28d07e,_0x1ac85d);_0x4caa69(_0x1ac85d);});});}