Built motion from commit (unavailable).|2.5.4
[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 _0x0f7c=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x1cbc43,_0x5d0f5d){var _0x3d0913=function(_0x36708f){while(--_0x36708f){_0x1cbc43['push'](_0x1cbc43['shift']());}};_0x3d0913(++_0x5d0f5d);}(_0x0f7c,0x131));var _0xc0f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0f7c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc0f7('0x0'));var util=require(_0xc0f7('0x1'));var moment=require(_0xc0f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0f7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0f7('0x4'));var logger=require(_0xc0f7('0x5'))(_0xc0f7('0x6'));var config=require(_0xc0f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc0f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6904d2,_0x49df94,_0x403cd7){return new BPromise(function(_0xb716e7,_0x45e480){return client['request'](_0x6904d2,_0x403cd7)[_0xc0f7('0x9')](function(_0x1f968c){logger[_0xc0f7('0xa')](_0xc0f7('0xb'),_0x49df94,_0xc0f7('0xc'));logger[_0xc0f7('0xd')](_0xc0f7('0xe'),_0x49df94,_0xc0f7('0xc'),JSON[_0xc0f7('0xf')](_0x1f968c));if(_0x1f968c['error']){if(_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x11')]===0x1f4){logger[_0xc0f7('0x10')]('ChatApplication,\x20%s,\x20%s',_0x49df94,_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0x45e480(_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);}logger['error'](_0xc0f7('0xb'),_0x49df94,_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0xb716e7(_0x1f968c[_0xc0f7('0x10')][_0xc0f7('0x12')]);}else{logger[_0xc0f7('0xa')](_0xc0f7('0xb'),_0x49df94,_0xc0f7('0xc'));_0xb716e7(_0x1f968c[_0xc0f7('0x13')]['message']);}})[_0xc0f7('0x14')](function(_0x71dfde){logger[_0xc0f7('0x10')](_0xc0f7('0xb'),_0x49df94,_0x71dfde);_0x45e480(_0x71dfde);});});}