Built motion from commit e1760111.|2.6.18
[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 _0x0f75=['ChatApplication,\x20%s,\x20%s,\x20%s','error','code','ChatApplication,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x0f75,0x14a));var _0x50f7=function(_0x289e85,_0x5ecfaf){_0x289e85=_0x289e85-0x0;var _0x5e76ad=_0x0f75[_0x289e85];return _0x5e76ad;};'use strict';var _=require('lodash');var util=require(_0x50f7('0x0'));var moment=require(_0x50f7('0x1'));var BPromise=require(_0x50f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50f7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x50f7('0x4'));var logger=require('../../config/logger')(_0x50f7('0x5'));var config=require(_0x50f7('0x6'));var jayson=require(_0x50f7('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x558e37,_0x19fd60,_0x40dbb7){return new BPromise(function(_0x144d10,_0x55172e){return client[_0x50f7('0x8')](_0x558e37,_0x40dbb7)[_0x50f7('0x9')](function(_0x3c4d22){logger[_0x50f7('0xa')]('ChatApplication,\x20%s,\x20%s',_0x19fd60,_0x50f7('0xb'));logger['debug'](_0x50f7('0xc'),_0x19fd60,_0x50f7('0xb'),JSON['stringify'](_0x3c4d22));if(_0x3c4d22[_0x50f7('0xd')]){if(_0x3c4d22[_0x50f7('0xd')][_0x50f7('0xe')]===0x1f4){logger[_0x50f7('0xd')](_0x50f7('0xf'),_0x19fd60,_0x3c4d22[_0x50f7('0xd')][_0x50f7('0x10')]);return _0x55172e(_0x3c4d22[_0x50f7('0xd')][_0x50f7('0x10')]);}logger[_0x50f7('0xd')](_0x50f7('0xf'),_0x19fd60,_0x3c4d22[_0x50f7('0xd')]['message']);return _0x144d10(_0x3c4d22[_0x50f7('0xd')][_0x50f7('0x10')]);}else{logger[_0x50f7('0xa')]('ChatApplication,\x20%s,\x20%s',_0x19fd60,_0x50f7('0xb'));_0x144d10(_0x3c4d22['result'][_0x50f7('0x10')]);}})[_0x50f7('0x11')](function(_0x4d5a3e){logger[_0x50f7('0xd')](_0x50f7('0xf'),_0x19fd60,_0x4d5a3e);_0x55172e(_0x4d5a3e);});});}