6a8deb072cf8bbefac900e7a142499f86bb91b18
[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 _0x8377=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ChatProactiveAction,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x149872,_0x24d88f){var _0x1143df=function(_0x226ba6){while(--_0x226ba6){_0x149872['push'](_0x149872['shift']());}};_0x1143df(++_0x24d88f);}(_0x8377,0x1aa));var _0x7837=function(_0x25096c,_0x4b39ad){_0x25096c=_0x25096c-0x0;var _0x20319d=_0x8377[_0x25096c];return _0x20319d;};'use strict';var _=require(_0x7837('0x0'));var util=require(_0x7837('0x1'));var moment=require(_0x7837('0x2'));var BPromise=require(_0x7837('0x3'));var rs=require(_0x7837('0x4'));var fs=require('fs');var Redis=require(_0x7837('0x5'));var db=require(_0x7837('0x6'))['db'];var utils=require(_0x7837('0x7'));var logger=require(_0x7837('0x8'))(_0x7837('0x9'));var config=require(_0x7837('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7837('0xb')][_0x7837('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xec2b51,_0x2f5eee,_0x1269ae){return new BPromise(function(_0x4cf4ca,_0xb4b133){return client[_0x7837('0xd')](_0xec2b51,_0x1269ae)['then'](function(_0x142974){logger[_0x7837('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x2f5eee,'request\x20sent');logger[_0x7837('0xf')](_0x7837('0x10'),_0x2f5eee,_0x7837('0x11'),JSON[_0x7837('0x12')](_0x142974));if(_0x142974[_0x7837('0x13')]){if(_0x142974['error']['code']===0x1f4){logger[_0x7837('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x2f5eee,_0x142974[_0x7837('0x13')][_0x7837('0x14')]);return _0xb4b133(_0x142974['error'][_0x7837('0x14')]);}logger[_0x7837('0x13')](_0x7837('0x15'),_0x2f5eee,_0x142974[_0x7837('0x13')][_0x7837('0x14')]);return _0x4cf4ca(_0x142974[_0x7837('0x13')][_0x7837('0x14')]);}else{logger[_0x7837('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x2f5eee,_0x7837('0x11'));_0x4cf4ca(_0x142974[_0x7837('0x16')][_0x7837('0x14')]);}})[_0x7837('0x17')](function(_0x4e8ff3){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x2f5eee,_0x4e8ff3);_0xb4b133(_0x4e8ff3);});});}