Built motion from commit d69f4380.|2.6.29
[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 _0x1180=['error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5adcce,_0x10dc8b){var _0x129eb4=function(_0x45a294){while(--_0x45a294){_0x5adcce['push'](_0x5adcce['shift']());}};_0x129eb4(++_0x10dc8b);}(_0x1180,0x7c));var _0x0118=function(_0x15b544,_0x2815cb){_0x15b544=_0x15b544-0x0;var _0x4bab81=_0x1180[_0x15b544];return _0x4bab81;};'use strict';var _=require(_0x0118('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0118('0x1'));var rs=require(_0x0118('0x2'));var fs=require('fs');var Redis=require(_0x0118('0x3'));var db=require(_0x0118('0x4'))['db'];var utils=require(_0x0118('0x5'));var logger=require(_0x0118('0x6'))(_0x0118('0x7'));var config=require(_0x0118('0x8'));var jayson=require(_0x0118('0x9'));var client=jayson['client'][_0x0118('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x87cd9f,_0x14898a,_0xeec794){return new BPromise(function(_0x11b82f,_0x31ea58){return client[_0x0118('0xb')](_0x87cd9f,_0xeec794)['then'](function(_0x4a01f3){logger[_0x0118('0xc')](_0x0118('0xd'),_0x14898a,_0x0118('0xe'));logger[_0x0118('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x14898a,_0x0118('0xe'),JSON['stringify'](_0x4a01f3));if(_0x4a01f3[_0x0118('0x10')]){if(_0x4a01f3[_0x0118('0x10')][_0x0118('0x11')]===0x1f4){logger['error'](_0x0118('0xd'),_0x14898a,_0x4a01f3['error']['message']);return _0x31ea58(_0x4a01f3['error'][_0x0118('0x12')]);}logger[_0x0118('0x10')](_0x0118('0xd'),_0x14898a,_0x4a01f3['error'][_0x0118('0x12')]);return _0x11b82f(_0x4a01f3['error'][_0x0118('0x12')]);}else{logger[_0x0118('0xc')](_0x0118('0xd'),_0x14898a,_0x0118('0xe'));_0x11b82f(_0x4a01f3['result'][_0x0118('0x12')]);}})[_0x0118('0x13')](function(_0x35b775){logger[_0x0118('0x10')](_0x0118('0xd'),_0x14898a,_0x35b775);_0x31ea58(_0x35b775);});});}