Built motion from commit dbf3a7e2.|2.6.30
[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 _0x8ace=['VoicePrefix,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','register','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x1f79df,_0x1aa436){var _0x59089b=function(_0x2c76e7){while(--_0x2c76e7){_0x1f79df['push'](_0x1f79df['shift']());}};_0x59089b(++_0x1aa436);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x1eb186,_0x3e8197){_0x1eb186=_0x1eb186-0x0;var _0x49079e=_0x8ace[_0x1eb186];return _0x49079e;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var BPromise=require(_0xe8ac('0x3'));var rs=require(_0xe8ac('0x4'));var fs=require('fs');var Redis=require(_0xe8ac('0x5'));var db=require(_0xe8ac('0x6'))['db'];var utils=require(_0xe8ac('0x7'));var logger=require(_0xe8ac('0x8'))(_0xe8ac('0x9'));var config=require(_0xe8ac('0xa'));var jayson=require(_0xe8ac('0xb'));var client=jayson[_0xe8ac('0xc')][_0xe8ac('0xd')]({'port':0x232a});config['redis']=_[_0xe8ac('0xe')](config[_0xe8ac('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8ac('0xf')]));require('./voicePrefix.socket')[_0xe8ac('0x10')](socket);function respondWithRpcPromise(_0x271fdb,_0x19d9c8,_0x4778d7){return new BPromise(function(_0xa18ae1,_0x277ed8){return client['request'](_0x271fdb,_0x4778d7)[_0xe8ac('0x11')](function(_0x2e3b25){logger[_0xe8ac('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x19d9c8,_0xe8ac('0x13'));logger[_0xe8ac('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x19d9c8,_0xe8ac('0x13'),JSON[_0xe8ac('0x15')](_0x2e3b25));if(_0x2e3b25[_0xe8ac('0x16')]){if(_0x2e3b25[_0xe8ac('0x16')][_0xe8ac('0x17')]===0x1f4){logger[_0xe8ac('0x16')](_0xe8ac('0x18'),_0x19d9c8,_0x2e3b25[_0xe8ac('0x16')][_0xe8ac('0x19')]);return _0x277ed8(_0x2e3b25[_0xe8ac('0x16')]['message']);}logger[_0xe8ac('0x16')](_0xe8ac('0x18'),_0x19d9c8,_0x2e3b25['error'][_0xe8ac('0x19')]);return _0xa18ae1(_0x2e3b25[_0xe8ac('0x16')][_0xe8ac('0x19')]);}else{logger[_0xe8ac('0x12')](_0xe8ac('0x18'),_0x19d9c8,_0xe8ac('0x13'));_0xa18ae1(_0x2e3b25['result']['message']);}})['catch'](function(_0x18cf29){logger[_0xe8ac('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x19d9c8,_0x18cf29);_0x277ed8(_0x18cf29);});});}