6f3c1e9806f048a1a07d1b3207c4f11ab3bd63dc
[motion2.git] / server / api / chatProactiveAction / chatProactiveAction.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 _0xe358=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x494f9f,_0x33e73a){var _0x471400=function(_0x47d017){while(--_0x47d017){_0x494f9f['push'](_0x494f9f['shift']());}};_0x471400(++_0x33e73a);}(_0xe358,0x14a));var _0x8e35=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0xe358[_0x4cce65];return _0x4d1b45;};'use strict';var _=require(_0x8e35('0x0'));var util=require(_0x8e35('0x1'));var moment=require('moment');var BPromise=require(_0x8e35('0x2'));var rs=require(_0x8e35('0x3'));var fs=require('fs');var Redis=require(_0x8e35('0x4'));var db=require(_0x8e35('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e35('0x6'))(_0x8e35('0x7'));var config=require(_0x8e35('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8e35('0x9')][_0x8e35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc20cab,_0x18a80d,_0x3ffa82){return new BPromise(function(_0x40c422,_0xfb46e6){return client[_0x8e35('0xb')](_0xc20cab,_0x3ffa82)[_0x8e35('0xc')](function(_0x17a00e){logger[_0x8e35('0xd')](_0x8e35('0xe'),_0x18a80d,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x18a80d,_0x8e35('0xf'),JSON[_0x8e35('0x10')](_0x17a00e));if(_0x17a00e['error']){if(_0x17a00e[_0x8e35('0x11')]['code']===0x1f4){logger[_0x8e35('0x11')](_0x8e35('0xe'),_0x18a80d,_0x17a00e['error'][_0x8e35('0x12')]);return _0xfb46e6(_0x17a00e[_0x8e35('0x11')][_0x8e35('0x12')]);}logger[_0x8e35('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x18a80d,_0x17a00e[_0x8e35('0x11')][_0x8e35('0x12')]);return _0x40c422(_0x17a00e[_0x8e35('0x11')][_0x8e35('0x12')]);}else{logger['info'](_0x8e35('0xe'),_0x18a80d,_0x8e35('0xf'));_0x40c422(_0x17a00e[_0x8e35('0x13')][_0x8e35('0x12')]);}})[_0x8e35('0x14')](function(_0x163876){logger['error'](_0x8e35('0xe'),_0x18a80d,_0x163876);_0xfb46e6(_0x163876);});});}