Built motion from commit (unavailable).|2.4.18
[motion2.git] / server / api / chatInternalMessage / chatInternalMessage.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 _0xad22=['request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x36250a,_0x3e2e72){var _0x43a5eb=function(_0x448663){while(--_0x448663){_0x36250a['push'](_0x36250a['shift']());}};_0x43a5eb(++_0x3e2e72);}(_0xad22,0x1bd));var _0x2ad2=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0xad22[_0x2e249d];return _0x1faa37;};'use strict';var _=require(_0x2ad2('0x0'));var util=require(_0x2ad2('0x1'));var moment=require(_0x2ad2('0x2'));var BPromise=require(_0x2ad2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ad2('0x4'));var db=require(_0x2ad2('0x5'))['db'];var utils=require(_0x2ad2('0x6'));var logger=require(_0x2ad2('0x7'))(_0x2ad2('0x8'));var config=require(_0x2ad2('0x9'));var jayson=require(_0x2ad2('0xa'));var client=jayson[_0x2ad2('0xb')][_0x2ad2('0xc')]({'port':0x232a});config['redis']=_[_0x2ad2('0xd')](config[_0x2ad2('0xe')],{'host':_0x2ad2('0xf'),'port':0x18eb});var socket=require(_0x2ad2('0x10'))(new Redis(config[_0x2ad2('0xe')]));require(_0x2ad2('0x11'))[_0x2ad2('0x12')](socket);function respondWithRpcPromise(_0x108964,_0x4f1e0f,_0x385cd7){return new BPromise(function(_0x100f32,_0x374228){return client[_0x2ad2('0x13')](_0x108964,_0x385cd7)['then'](function(_0x49f5ca){logger[_0x2ad2('0x14')](_0x2ad2('0x15'),_0x4f1e0f,_0x2ad2('0x16'));logger[_0x2ad2('0x17')](_0x2ad2('0x18'),_0x4f1e0f,'request\x20sent',JSON['stringify'](_0x49f5ca));if(_0x49f5ca[_0x2ad2('0x19')]){if(_0x49f5ca[_0x2ad2('0x19')]['code']===0x1f4){logger[_0x2ad2('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x4f1e0f,_0x49f5ca['error'][_0x2ad2('0x1a')]);return _0x374228(_0x49f5ca['error'][_0x2ad2('0x1a')]);}logger[_0x2ad2('0x19')](_0x2ad2('0x15'),_0x4f1e0f,_0x49f5ca[_0x2ad2('0x19')][_0x2ad2('0x1a')]);return _0x100f32(_0x49f5ca[_0x2ad2('0x19')]['message']);}else{logger[_0x2ad2('0x14')](_0x2ad2('0x15'),_0x4f1e0f,_0x2ad2('0x16'));_0x100f32(_0x49f5ca[_0x2ad2('0x1b')][_0x2ad2('0x1a')]);}})[_0x2ad2('0x1c')](function(_0x157f49){logger['error'](_0x2ad2('0x15'),_0x4f1e0f,_0x157f49);_0x374228(_0x157f49);});});}