Built motion from commit fa4c4286.|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 _0xcf5a=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4d4325,_0x2db6f3){var _0x3eaaf2=function(_0xd7ffc0){while(--_0xd7ffc0){_0x4d4325['push'](_0x4d4325['shift']());}};_0x3eaaf2(++_0x2db6f3);}(_0xcf5a,0xd7));var _0xacf5=function(_0xe92978,_0x2b3aba){_0xe92978=_0xe92978-0x0;var _0x4b1111=_0xcf5a[_0xe92978];return _0x4b1111;};'use strict';var _=require(_0xacf5('0x0'));var util=require(_0xacf5('0x1'));var moment=require(_0xacf5('0x2'));var BPromise=require(_0xacf5('0x3'));var rs=require(_0xacf5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xacf5('0x6'))(_0xacf5('0x7'));var config=require(_0xacf5('0x8'));var jayson=require(_0xacf5('0x9'));var client=jayson[_0xacf5('0xa')][_0xacf5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13ac49,_0x1978b0,_0x449a49){return new BPromise(function(_0x354904,_0x3f2a2e){return client['request'](_0x13ac49,_0x449a49)[_0xacf5('0xc')](function(_0x35f80c){logger[_0xacf5('0xd')](_0xacf5('0xe'),_0x1978b0,_0xacf5('0xf'));logger[_0xacf5('0x10')](_0xacf5('0x11'),_0x1978b0,_0xacf5('0xf'),JSON[_0xacf5('0x12')](_0x35f80c));if(_0x35f80c['error']){if(_0x35f80c[_0xacf5('0x13')]['code']===0x1f4){logger['error'](_0xacf5('0xe'),_0x1978b0,_0x35f80c[_0xacf5('0x13')][_0xacf5('0x14')]);return _0x3f2a2e(_0x35f80c[_0xacf5('0x13')][_0xacf5('0x14')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x1978b0,_0x35f80c[_0xacf5('0x13')][_0xacf5('0x14')]);return _0x354904(_0x35f80c[_0xacf5('0x13')][_0xacf5('0x14')]);}else{logger[_0xacf5('0xd')](_0xacf5('0xe'),_0x1978b0,_0xacf5('0xf'));_0x354904(_0x35f80c['result'][_0xacf5('0x14')]);}})[_0xacf5('0x15')](function(_0x20bafb){logger['error'](_0xacf5('0xe'),_0x1978b0,_0x20bafb);_0x3f2a2e(_0x20bafb);});});}