Built motion from commit (unavailable).|2.5.4
[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 _0xb943=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb943,0x90));var _0x3b94=function(_0x5e83ec,_0x5abaaf){_0x5e83ec=_0x5e83ec-0x0;var _0x43c08c=_0xb943[_0x5e83ec];return _0x43c08c;};'use strict';var _=require(_0x3b94('0x0'));var util=require(_0x3b94('0x1'));var moment=require(_0x3b94('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b94('0x3'));var fs=require('fs');var Redis=require(_0x3b94('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b94('0x5'));var logger=require(_0x3b94('0x6'))(_0x3b94('0x7'));var config=require('../../config/environment');var jayson=require(_0x3b94('0x8'));var client=jayson[_0x3b94('0x9')][_0x3b94('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x168611,_0x193f19,_0x23d2ba){return new BPromise(function(_0x2bfd6a,_0x2937bb){return client[_0x3b94('0xb')](_0x168611,_0x23d2ba)[_0x3b94('0xc')](function(_0x28a89c){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x193f19,_0x3b94('0xd'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x193f19,_0x3b94('0xd'),JSON[_0x3b94('0xe')](_0x28a89c));if(_0x28a89c[_0x3b94('0xf')]){if(_0x28a89c['error']['code']===0x1f4){logger[_0x3b94('0xf')](_0x3b94('0x10'),_0x193f19,_0x28a89c[_0x3b94('0xf')][_0x3b94('0x11')]);return _0x2937bb(_0x28a89c[_0x3b94('0xf')]['message']);}logger[_0x3b94('0xf')](_0x3b94('0x10'),_0x193f19,_0x28a89c[_0x3b94('0xf')][_0x3b94('0x11')]);return _0x2bfd6a(_0x28a89c['error'][_0x3b94('0x11')]);}else{logger[_0x3b94('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x193f19,_0x3b94('0xd'));_0x2bfd6a(_0x28a89c[_0x3b94('0x13')]['message']);}})[_0x3b94('0x14')](function(_0x491a4a){logger[_0x3b94('0xf')](_0x3b94('0x10'),_0x193f19,_0x491a4a);_0x2937bb(_0x491a4a);});});}