Built motion from commit 10af8726.|2.6.34
[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 _0xf685=['util','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','request\x20sent','error','code','message','result','catch','ChatApplication,\x20%s,\x20%s','lodash'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xf685,0x19d));var _0x5f68=function(_0x21ed4,_0x462075){_0x21ed4=_0x21ed4-0x0;var _0x280473=_0xf685[_0x21ed4];return _0x280473;};'use strict';var _=require(_0x5f68('0x0'));var util=require(_0x5f68('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5f68('0x2'));var fs=require('fs');var Redis=require(_0x5f68('0x3'));var db=require(_0x5f68('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5f68('0x5'));var config=require('../../config/environment');var jayson=require(_0x5f68('0x6'));var client=jayson['client'][_0x5f68('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4997e1,_0x4671e2,_0x4753a4){return new BPromise(function(_0x288b11,_0x1a4194){return client[_0x5f68('0x8')](_0x4997e1,_0x4753a4)[_0x5f68('0x9')](function(_0x254d5a){logger[_0x5f68('0xa')]('ChatApplication,\x20%s,\x20%s',_0x4671e2,_0x5f68('0xb'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4671e2,_0x5f68('0xb'),JSON['stringify'](_0x254d5a));if(_0x254d5a[_0x5f68('0xc')]){if(_0x254d5a[_0x5f68('0xc')][_0x5f68('0xd')]===0x1f4){logger[_0x5f68('0xc')]('ChatApplication,\x20%s,\x20%s',_0x4671e2,_0x254d5a['error'][_0x5f68('0xe')]);return _0x1a4194(_0x254d5a[_0x5f68('0xc')][_0x5f68('0xe')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x4671e2,_0x254d5a['error'][_0x5f68('0xe')]);return _0x288b11(_0x254d5a[_0x5f68('0xc')][_0x5f68('0xe')]);}else{logger[_0x5f68('0xa')]('ChatApplication,\x20%s,\x20%s',_0x4671e2,_0x5f68('0xb'));_0x288b11(_0x254d5a[_0x5f68('0xf')]['message']);}})[_0x5f68('0x10')](function(_0x42ff3b){logger[_0x5f68('0xc')](_0x5f68('0x11'),_0x4671e2,_0x42ff3b);_0x1a4194(_0x42ff3b);});});}