Built motion from commit da617fac.|2.6.6
[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 _0xdf30=['http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x35bdab,_0x28a695){var _0xbe96b0=function(_0x425977){while(--_0x425977){_0x35bdab['push'](_0x35bdab['shift']());}};_0xbe96b0(++_0x28a695);}(_0xdf30,0x65));var _0x0df3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf30[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0df3('0x0'));var util=require(_0x0df3('0x1'));var moment=require(_0x0df3('0x2'));var BPromise=require('bluebird');var rs=require(_0x0df3('0x3'));var fs=require('fs');var Redis=require(_0x0df3('0x4'));var db=require(_0x0df3('0x5'))['db'];var utils=require(_0x0df3('0x6'));var logger=require(_0x0df3('0x7'))(_0x0df3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0df3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34c0b4,_0x196ebd,_0x140541){return new BPromise(function(_0x153175,_0x1a74fc){return client[_0x0df3('0xa')](_0x34c0b4,_0x140541)[_0x0df3('0xb')](function(_0x41e02b){logger[_0x0df3('0xc')](_0x0df3('0xd'),_0x196ebd,_0x0df3('0xe'));logger[_0x0df3('0xf')](_0x0df3('0x10'),_0x196ebd,_0x0df3('0xe'),JSON[_0x0df3('0x11')](_0x41e02b));if(_0x41e02b['error']){if(_0x41e02b['error']['code']===0x1f4){logger[_0x0df3('0x12')](_0x0df3('0xd'),_0x196ebd,_0x41e02b['error'][_0x0df3('0x13')]);return _0x1a74fc(_0x41e02b[_0x0df3('0x12')][_0x0df3('0x13')]);}logger[_0x0df3('0x12')](_0x0df3('0xd'),_0x196ebd,_0x41e02b[_0x0df3('0x12')][_0x0df3('0x13')]);return _0x153175(_0x41e02b[_0x0df3('0x12')][_0x0df3('0x13')]);}else{logger[_0x0df3('0xc')]('ChatApplication,\x20%s,\x20%s',_0x196ebd,_0x0df3('0xe'));_0x153175(_0x41e02b[_0x0df3('0x14')][_0x0df3('0x13')]);}})[_0x0df3('0x15')](function(_0x4405ab){logger[_0x0df3('0x12')](_0x0df3('0xd'),_0x196ebd,_0x4405ab);_0x1a74fc(_0x4405ab);});});}