Built motion from commit eddce310.|2.6.12
[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 _0xf977=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5aa1cc,_0x2f4191){var _0x30eeb7=function(_0x53930a){while(--_0x53930a){_0x5aa1cc['push'](_0x5aa1cc['shift']());}};_0x30eeb7(++_0x2f4191);}(_0xf977,0x161));var _0x7f97=function(_0x169836,_0x4f1deb){_0x169836=_0x169836-0x0;var _0x364653=_0xf977[_0x169836];return _0x364653;};'use strict';var _=require(_0x7f97('0x0'));var util=require(_0x7f97('0x1'));var moment=require(_0x7f97('0x2'));var BPromise=require(_0x7f97('0x3'));var rs=require(_0x7f97('0x4'));var fs=require('fs');var Redis=require(_0x7f97('0x5'));var db=require(_0x7f97('0x6'))['db'];var utils=require(_0x7f97('0x7'));var logger=require(_0x7f97('0x8'))(_0x7f97('0x9'));var config=require(_0x7f97('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7f97('0xb')]=_['defaults'](config[_0x7f97('0xb')],{'host':_0x7f97('0xc'),'port':0x18eb});var socket=require(_0x7f97('0xd'))(new Redis(config[_0x7f97('0xb')]));require(_0x7f97('0xe'))['register'](socket);function respondWithRpcPromise(_0x28de16,_0x35f2d7,_0x2e340b){return new BPromise(function(_0x3ea6f8,_0x179713){return client['request'](_0x28de16,_0x2e340b)[_0x7f97('0xf')](function(_0x35762f){logger[_0x7f97('0x10')](_0x7f97('0x11'),_0x35f2d7,_0x7f97('0x12'));logger['debug'](_0x7f97('0x13'),_0x35f2d7,_0x7f97('0x12'),JSON[_0x7f97('0x14')](_0x35762f));if(_0x35762f[_0x7f97('0x15')]){if(_0x35762f[_0x7f97('0x15')][_0x7f97('0x16')]===0x1f4){logger[_0x7f97('0x15')](_0x7f97('0x11'),_0x35f2d7,_0x35762f['error'][_0x7f97('0x17')]);return _0x179713(_0x35762f[_0x7f97('0x15')][_0x7f97('0x17')]);}logger[_0x7f97('0x15')](_0x7f97('0x11'),_0x35f2d7,_0x35762f['error']['message']);return _0x3ea6f8(_0x35762f[_0x7f97('0x15')][_0x7f97('0x17')]);}else{logger[_0x7f97('0x10')](_0x7f97('0x11'),_0x35f2d7,'request\x20sent');_0x3ea6f8(_0x35762f['result'][_0x7f97('0x17')]);}})[_0x7f97('0x18')](function(_0x393eb9){logger[_0x7f97('0x15')](_0x7f97('0x11'),_0x35f2d7,_0x393eb9);_0x179713(_0x393eb9);});});}