Built motion from commit 3c2ce842.|2.6.31
[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 _0xce77=['stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug'];(function(_0x1580f7,_0x5580dc){var _0x147246=function(_0x5661ea){while(--_0x5661ea){_0x1580f7['push'](_0x1580f7['shift']());}};_0x147246(++_0x5580dc);}(_0xce77,0x18e));var _0x7ce7=function(_0xe12f87,_0x40f96b){_0xe12f87=_0xe12f87-0x0;var _0x2bb9f7=_0xce77[_0xe12f87];return _0x2bb9f7;};'use strict';var _=require(_0x7ce7('0x0'));var util=require(_0x7ce7('0x1'));var moment=require(_0x7ce7('0x2'));var BPromise=require(_0x7ce7('0x3'));var rs=require(_0x7ce7('0x4'));var fs=require('fs');var Redis=require(_0x7ce7('0x5'));var db=require(_0x7ce7('0x6'))['db'];var utils=require(_0x7ce7('0x7'));var logger=require(_0x7ce7('0x8'))('rpc');var config=require(_0x7ce7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ce7('0xa')][_0x7ce7('0xb')]({'port':0x232a});config[_0x7ce7('0xc')]=_[_0x7ce7('0xd')](config['redis'],{'host':_0x7ce7('0xe'),'port':0x18eb});var socket=require(_0x7ce7('0xf'))(new Redis(config[_0x7ce7('0xc')]));require(_0x7ce7('0x10'))['register'](socket);function respondWithRpcPromise(_0x50fc7e,_0x5ed452,_0xaba8a0){return new BPromise(function(_0x2bdff8,_0x1a6511){return client[_0x7ce7('0x11')](_0x50fc7e,_0xaba8a0)[_0x7ce7('0x12')](function(_0x1e6cbb){logger[_0x7ce7('0x13')](_0x7ce7('0x14'),_0x5ed452,'request\x20sent');logger[_0x7ce7('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5ed452,'request\x20sent',JSON[_0x7ce7('0x16')](_0x1e6cbb));if(_0x1e6cbb[_0x7ce7('0x17')]){if(_0x1e6cbb['error']['code']===0x1f4){logger[_0x7ce7('0x17')](_0x7ce7('0x14'),_0x5ed452,_0x1e6cbb[_0x7ce7('0x17')][_0x7ce7('0x18')]);return _0x1a6511(_0x1e6cbb[_0x7ce7('0x17')]['message']);}logger[_0x7ce7('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ed452,_0x1e6cbb[_0x7ce7('0x17')][_0x7ce7('0x18')]);return _0x2bdff8(_0x1e6cbb['error'][_0x7ce7('0x18')]);}else{logger['info'](_0x7ce7('0x14'),_0x5ed452,_0x7ce7('0x19'));_0x2bdff8(_0x1e6cbb[_0x7ce7('0x1a')][_0x7ce7('0x18')]);}})[_0x7ce7('0x1b')](function(_0x9ddb24){logger['error'](_0x7ce7('0x14'),_0x5ed452,_0x9ddb24);_0x1a6511(_0x9ddb24);});});}