Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / crmWorkflow / crmWorkflow.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 _0xa945=['stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','CrmWorkflow,\x20%s,\x20%s','request\x20sent','debug','CrmWorkflow,\x20%s,\x20%s,\x20%s'];(function(_0x1654d1,_0x3d5e4b){var _0x4a28ae=function(_0x2d6d66){while(--_0x2d6d66){_0x1654d1['push'](_0x1654d1['shift']());}};_0x4a28ae(++_0x3d5e4b);}(_0xa945,0x118));var _0x5a94=function(_0x409ea4,_0x53fea5){_0x409ea4=_0x409ea4-0x0;var _0x5b1196=_0xa945[_0x409ea4];return _0x5b1196;};'use strict';var _=require(_0x5a94('0x0'));var util=require(_0x5a94('0x1'));var moment=require(_0x5a94('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a94('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a94('0x4'));var logger=require('../../config/logger')(_0x5a94('0x5'));var config=require('../../config/environment');var jayson=require(_0x5a94('0x6'));var client=jayson[_0x5a94('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36fe63,_0x14fa1a,_0x164363){return new BPromise(function(_0x4f2bf4,_0x10df15){return client[_0x5a94('0x8')](_0x36fe63,_0x164363)[_0x5a94('0x9')](function(_0x544257){logger['info'](_0x5a94('0xa'),_0x14fa1a,_0x5a94('0xb'));logger[_0x5a94('0xc')](_0x5a94('0xd'),_0x14fa1a,'request\x20sent',JSON[_0x5a94('0xe')](_0x544257));if(_0x544257[_0x5a94('0xf')]){if(_0x544257['error'][_0x5a94('0x10')]===0x1f4){logger[_0x5a94('0xf')](_0x5a94('0xa'),_0x14fa1a,_0x544257[_0x5a94('0xf')][_0x5a94('0x11')]);return _0x10df15(_0x544257[_0x5a94('0xf')][_0x5a94('0x11')]);}logger['error']('CrmWorkflow,\x20%s,\x20%s',_0x14fa1a,_0x544257[_0x5a94('0xf')]['message']);return _0x4f2bf4(_0x544257[_0x5a94('0xf')][_0x5a94('0x11')]);}else{logger[_0x5a94('0x12')](_0x5a94('0xa'),_0x14fa1a,_0x5a94('0xb'));_0x4f2bf4(_0x544257[_0x5a94('0x13')][_0x5a94('0x11')]);}})[_0x5a94('0x14')](function(_0x108d1c){logger[_0x5a94('0xf')]('CrmWorkflow,\x20%s,\x20%s',_0x14fa1a,_0x108d1c);_0x10df15(_0x108d1c);});});}