Built motion from commit (unavailable).|2.5.23
[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 _0x48e4=['then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x48e4,0x94));var _0x448e=function(_0x467327,_0x518f4c){_0x467327=_0x467327-0x0;var _0xd177cc=_0x48e4[_0x467327];return _0xd177cc;};'use strict';var _=require(_0x448e('0x0'));var util=require('util');var moment=require(_0x448e('0x1'));var BPromise=require('bluebird');var rs=require(_0x448e('0x2'));var fs=require('fs');var Redis=require(_0x448e('0x3'));var db=require(_0x448e('0x4'))['db'];var utils=require(_0x448e('0x5'));var logger=require(_0x448e('0x6'))(_0x448e('0x7'));var config=require(_0x448e('0x8'));var jayson=require(_0x448e('0x9'));var client=jayson[_0x448e('0xa')][_0x448e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5813b3,_0x52829b,_0x38e973){return new BPromise(function(_0x2c7081,_0x46c19f){return client[_0x448e('0xc')](_0x5813b3,_0x38e973)[_0x448e('0xd')](function(_0x178b59){logger[_0x448e('0xe')](_0x448e('0xf'),_0x52829b,_0x448e('0x10'));logger['debug'](_0x448e('0x11'),_0x52829b,_0x448e('0x10'),JSON[_0x448e('0x12')](_0x178b59));if(_0x178b59[_0x448e('0x13')]){if(_0x178b59[_0x448e('0x13')]['code']===0x1f4){logger[_0x448e('0x13')]('ChatApplication,\x20%s,\x20%s',_0x52829b,_0x178b59[_0x448e('0x13')][_0x448e('0x14')]);return _0x46c19f(_0x178b59[_0x448e('0x13')]['message']);}logger[_0x448e('0x13')]('ChatApplication,\x20%s,\x20%s',_0x52829b,_0x178b59[_0x448e('0x13')][_0x448e('0x14')]);return _0x2c7081(_0x178b59['error'][_0x448e('0x14')]);}else{logger[_0x448e('0xe')](_0x448e('0xf'),_0x52829b,'request\x20sent');_0x2c7081(_0x178b59[_0x448e('0x15')][_0x448e('0x14')]);}})[_0x448e('0x16')](function(_0x1fb5b0){logger[_0x448e('0x13')]('ChatApplication,\x20%s,\x20%s',_0x52829b,_0x1fb5b0);_0x46c19f(_0x1fb5b0);});});}