Built motion from commit b0a9a629.|2.6.33
[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 _0x62b9=['./chatInternalMessage.socket','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x2a0f3f,_0x4dce14){var _0x43daa7=function(_0x357b96){while(--_0x357b96){_0x2a0f3f['push'](_0x2a0f3f['shift']());}};_0x43daa7(++_0x4dce14);}(_0x62b9,0x130));var _0x962b=function(_0x455ac7,_0x260578){_0x455ac7=_0x455ac7-0x0;var _0x2d28f6=_0x62b9[_0x455ac7];return _0x2d28f6;};'use strict';var _=require(_0x962b('0x0'));var util=require(_0x962b('0x1'));var moment=require(_0x962b('0x2'));var BPromise=require(_0x962b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x962b('0x4'))['db'];var utils=require(_0x962b('0x5'));var logger=require(_0x962b('0x6'))(_0x962b('0x7'));var config=require(_0x962b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x962b('0x9')][_0x962b('0xa')]({'port':0x232a});config[_0x962b('0xb')]=_[_0x962b('0xc')](config[_0x962b('0xb')],{'host':_0x962b('0xd'),'port':0x18eb});var socket=require(_0x962b('0xe'))(new Redis(config[_0x962b('0xb')]));require(_0x962b('0xf'))[_0x962b('0x10')](socket);function respondWithRpcPromise(_0x1c71f2,_0x3bcc5a,_0x564e62){return new BPromise(function(_0x1c056f,_0xc6d013){return client[_0x962b('0x11')](_0x1c71f2,_0x564e62)[_0x962b('0x12')](function(_0x2f0029){logger[_0x962b('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x3bcc5a,'request\x20sent');logger[_0x962b('0x14')](_0x962b('0x15'),_0x3bcc5a,_0x962b('0x16'),JSON[_0x962b('0x17')](_0x2f0029));if(_0x2f0029['error']){if(_0x2f0029['error']['code']===0x1f4){logger[_0x962b('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x3bcc5a,_0x2f0029[_0x962b('0x18')][_0x962b('0x19')]);return _0xc6d013(_0x2f0029['error'][_0x962b('0x19')]);}logger['error'](_0x962b('0x1a'),_0x3bcc5a,_0x2f0029[_0x962b('0x18')][_0x962b('0x19')]);return _0x1c056f(_0x2f0029[_0x962b('0x18')]['message']);}else{logger['info'](_0x962b('0x1a'),_0x3bcc5a,'request\x20sent');_0x1c056f(_0x2f0029[_0x962b('0x1b')]['message']);}})[_0x962b('0x1c')](function(_0x499a4e){logger[_0x962b('0x18')](_0x962b('0x1a'),_0x3bcc5a,_0x499a4e);_0xc6d013(_0x499a4e);});});}