Built motion from commit (unavailable).|2.4.20
[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 _0x009f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','info','request\x20sent','debug','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','lodash'];(function(_0x92ad8e,_0x42b381){var _0x1b2610=function(_0x3a7635){while(--_0x3a7635){_0x92ad8e['push'](_0x92ad8e['shift']());}};_0x1b2610(++_0x42b381);}(_0x009f,0x1b4));var _0xf009=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0x009f[_0x3987a1];return _0xe2596e;};'use strict';var _=require(_0xf009('0x0'));var util=require(_0xf009('0x1'));var moment=require(_0xf009('0x2'));var BPromise=require(_0xf009('0x3'));var rs=require(_0xf009('0x4'));var fs=require('fs');var Redis=require(_0xf009('0x5'));var db=require(_0xf009('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf009('0x7'))(_0xf009('0x8'));var config=require(_0xf009('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf009('0xa')]['http']({'port':0x232a});config[_0xf009('0xb')]=_['defaults'](config[_0xf009('0xb')],{'host':_0xf009('0xc'),'port':0x18eb});var socket=require(_0xf009('0xd'))(new Redis(config[_0xf009('0xb')]));require(_0xf009('0xe'))['register'](socket);function respondWithRpcPromise(_0x326291,_0x36db1c,_0x4f55a9){return new BPromise(function(_0x549010,_0x4c1057){return client[_0xf009('0xf')](_0x326291,_0x4f55a9)['then'](function(_0x5a54e9){logger[_0xf009('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x36db1c,_0xf009('0x11'));logger[_0xf009('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x36db1c,_0xf009('0x11'),JSON[_0xf009('0x13')](_0x5a54e9));if(_0x5a54e9['error']){if(_0x5a54e9['error']['code']===0x1f4){logger[_0xf009('0x14')](_0xf009('0x15'),_0x36db1c,_0x5a54e9[_0xf009('0x14')][_0xf009('0x16')]);return _0x4c1057(_0x5a54e9[_0xf009('0x14')][_0xf009('0x16')]);}logger[_0xf009('0x14')](_0xf009('0x15'),_0x36db1c,_0x5a54e9[_0xf009('0x14')][_0xf009('0x16')]);return _0x549010(_0x5a54e9[_0xf009('0x14')]['message']);}else{logger[_0xf009('0x10')](_0xf009('0x15'),_0x36db1c,_0xf009('0x11'));_0x549010(_0x5a54e9['result'][_0xf009('0x16')]);}})['catch'](function(_0x5b2786){logger[_0xf009('0x14')](_0xf009('0x15'),_0x36db1c,_0x5b2786);_0x4c1057(_0x5b2786);});});}