Built motion from commit (unavailable).|2.5.1
[motion2.git] / server / api / chatApplication / chatApplication.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 _0x7647=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','error'];(function(_0x36d081,_0x4ac187){var _0x4436f9=function(_0x43f7d4){while(--_0x43f7d4){_0x36d081['push'](_0x36d081['shift']());}};_0x4436f9(++_0x4ac187);}(_0x7647,0x95));var _0x7764=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7647[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x7764('0x0'));var util=require(_0x7764('0x1'));var moment=require(_0x7764('0x2'));var BPromise=require(_0x7764('0x3'));var rs=require(_0x7764('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7764('0x5'))['db'];var utils=require(_0x7764('0x6'));var logger=require(_0x7764('0x7'))(_0x7764('0x8'));var config=require(_0x7764('0x9'));var jayson=require(_0x7764('0xa'));var client=jayson[_0x7764('0xb')][_0x7764('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x639a89,_0x3d76fb,_0x1c5c13){return new BPromise(function(_0x4a5cde,_0x1c4506){return client[_0x7764('0xd')](_0x639a89,_0x1c5c13)[_0x7764('0xe')](function(_0x284329){logger[_0x7764('0xf')](_0x7764('0x10'),_0x3d76fb,_0x7764('0x11'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3d76fb,_0x7764('0x11'),JSON['stringify'](_0x284329));if(_0x284329[_0x7764('0x12')]){if(_0x284329[_0x7764('0x12')]['code']===0x1f4){logger['error'](_0x7764('0x10'),_0x3d76fb,_0x284329[_0x7764('0x12')][_0x7764('0x13')]);return _0x1c4506(_0x284329['error']['message']);}logger[_0x7764('0x12')](_0x7764('0x10'),_0x3d76fb,_0x284329[_0x7764('0x12')][_0x7764('0x13')]);return _0x4a5cde(_0x284329[_0x7764('0x12')]['message']);}else{logger[_0x7764('0xf')](_0x7764('0x10'),_0x3d76fb,'request\x20sent');_0x4a5cde(_0x284329['result'][_0x7764('0x13')]);}})[_0x7764('0x14')](function(_0xd4d5b7){logger[_0x7764('0x12')](_0x7764('0x10'),_0x3d76fb,_0xd4d5b7);_0x1c4506(_0xd4d5b7);});});}