Built motion from commit d5e4af8c.|2.6.23
[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 _0xbff9=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x31242e,_0x40adb9){var _0x610bea=function(_0x1050cc){while(--_0x1050cc){_0x31242e['push'](_0x31242e['shift']());}};_0x610bea(++_0x40adb9);}(_0xbff9,0x197));var _0x9bff=function(_0x183842,_0x57e3fa){_0x183842=_0x183842-0x0;var _0x4fc041=_0xbff9[_0x183842];return _0x4fc041;};'use strict';var _=require(_0x9bff('0x0'));var util=require(_0x9bff('0x1'));var moment=require(_0x9bff('0x2'));var BPromise=require(_0x9bff('0x3'));var rs=require(_0x9bff('0x4'));var fs=require('fs');var Redis=require(_0x9bff('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9bff('0x6'));var logger=require('../../config/logger')(_0x9bff('0x7'));var config=require(_0x9bff('0x8'));var jayson=require(_0x9bff('0x9'));var client=jayson[_0x9bff('0xa')]['http']({'port':0x232a});config[_0x9bff('0xb')]=_[_0x9bff('0xc')](config[_0x9bff('0xb')],{'host':_0x9bff('0xd'),'port':0x18eb});var socket=require(_0x9bff('0xe'))(new Redis(config[_0x9bff('0xb')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x29c44c,_0xb5ea3e,_0x549bea){return new BPromise(function(_0x43870b,_0x2b56b7){return client[_0x9bff('0xf')](_0x29c44c,_0x549bea)[_0x9bff('0x10')](function(_0x3bb292){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0xb5ea3e,_0x9bff('0x11'));logger['debug'](_0x9bff('0x12'),_0xb5ea3e,_0x9bff('0x11'),JSON[_0x9bff('0x13')](_0x3bb292));if(_0x3bb292[_0x9bff('0x14')]){if(_0x3bb292[_0x9bff('0x14')][_0x9bff('0x15')]===0x1f4){logger[_0x9bff('0x14')](_0x9bff('0x16'),_0xb5ea3e,_0x3bb292[_0x9bff('0x14')][_0x9bff('0x17')]);return _0x2b56b7(_0x3bb292['error'][_0x9bff('0x17')]);}logger[_0x9bff('0x14')](_0x9bff('0x16'),_0xb5ea3e,_0x3bb292[_0x9bff('0x14')][_0x9bff('0x17')]);return _0x43870b(_0x3bb292[_0x9bff('0x14')]['message']);}else{logger[_0x9bff('0x18')](_0x9bff('0x16'),_0xb5ea3e,_0x9bff('0x11'));_0x43870b(_0x3bb292[_0x9bff('0x19')][_0x9bff('0x17')]);}})['catch'](function(_0x25fc83){logger[_0x9bff('0x14')](_0x9bff('0x16'),_0xb5ea3e,_0x25fc83);_0x2b56b7(_0x25fc83);});});}