Built motion from commit ce97982f.|2.6.29
[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 _0xf8bf=['request\x20sent','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x563d41,_0xab55e9){var _0x5bb15f=function(_0x290ba8){while(--_0x290ba8){_0x563d41['push'](_0x563d41['shift']());}};_0x5bb15f(++_0xab55e9);}(_0xf8bf,0x1aa));var _0xff8b=function(_0x4e3253,_0x49f2cf){_0x4e3253=_0x4e3253-0x0;var _0x3702a8=_0xf8bf[_0x4e3253];return _0x3702a8;};'use strict';var _=require('lodash');var util=require(_0xff8b('0x0'));var moment=require(_0xff8b('0x1'));var BPromise=require('bluebird');var rs=require(_0xff8b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff8b('0x3'))['db'];var utils=require(_0xff8b('0x4'));var logger=require(_0xff8b('0x5'))(_0xff8b('0x6'));var config=require('../../config/environment');var jayson=require(_0xff8b('0x7'));var client=jayson[_0xff8b('0x8')][_0xff8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1be14a,_0x2ec4ce,_0x41261a){return new BPromise(function(_0x26e64d,_0x240c9f){return client[_0xff8b('0xa')](_0x1be14a,_0x41261a)[_0xff8b('0xb')](function(_0x26eedd){logger[_0xff8b('0xc')]('ChatApplication,\x20%s,\x20%s',_0x2ec4ce,'request\x20sent');logger['debug'](_0xff8b('0xd'),_0x2ec4ce,_0xff8b('0xe'),JSON[_0xff8b('0xf')](_0x26eedd));if(_0x26eedd[_0xff8b('0x10')]){if(_0x26eedd[_0xff8b('0x10')][_0xff8b('0x11')]===0x1f4){logger[_0xff8b('0x10')](_0xff8b('0x12'),_0x2ec4ce,_0x26eedd[_0xff8b('0x10')][_0xff8b('0x13')]);return _0x240c9f(_0x26eedd[_0xff8b('0x10')][_0xff8b('0x13')]);}logger[_0xff8b('0x10')](_0xff8b('0x12'),_0x2ec4ce,_0x26eedd[_0xff8b('0x10')]['message']);return _0x26e64d(_0x26eedd[_0xff8b('0x10')]['message']);}else{logger['info'](_0xff8b('0x12'),_0x2ec4ce,'request\x20sent');_0x26e64d(_0x26eedd[_0xff8b('0x14')][_0xff8b('0x13')]);}})[_0xff8b('0x15')](function(_0x28ceba){logger[_0xff8b('0x10')](_0xff8b('0x12'),_0x2ec4ce,_0x28ceba);_0x240c9f(_0x28ceba);});});}