Built motion from commit b5996064.|2.6.21
[motion2.git] / server / api / contactItemType / contactItemType.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 _0x5c5a=['../../config/logger','../../config/environment','jayson/promise','client','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x5c5a,0x198));var _0xa5c5=function(_0x26244f,_0x591e0f){_0x26244f=_0x26244f-0x0;var _0x36d5c0=_0x5c5a[_0x26244f];return _0x36d5c0;};'use strict';var _=require('lodash');var util=require(_0xa5c5('0x0'));var moment=require(_0xa5c5('0x1'));var BPromise=require(_0xa5c5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5c5('0x3'));var db=require(_0xa5c5('0x4'))['db'];var utils=require(_0xa5c5('0x5'));var logger=require(_0xa5c5('0x6'))('rpc');var config=require(_0xa5c5('0x7'));var jayson=require(_0xa5c5('0x8'));var client=jayson[_0xa5c5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249017,_0x53d781,_0x43e82d){return new BPromise(function(_0x4fac62,_0x498a5b){return client['request'](_0x249017,_0x43e82d)[_0xa5c5('0xa')](function(_0x5219f6){logger[_0xa5c5('0xb')](_0xa5c5('0xc'),_0x53d781,_0xa5c5('0xd'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x53d781,'request\x20sent',JSON[_0xa5c5('0xe')](_0x5219f6));if(_0x5219f6[_0xa5c5('0xf')]){if(_0x5219f6[_0xa5c5('0xf')][_0xa5c5('0x10')]===0x1f4){logger[_0xa5c5('0xf')]('ContactItemType,\x20%s,\x20%s',_0x53d781,_0x5219f6[_0xa5c5('0xf')]['message']);return _0x498a5b(_0x5219f6[_0xa5c5('0xf')][_0xa5c5('0x11')]);}logger['error'](_0xa5c5('0xc'),_0x53d781,_0x5219f6[_0xa5c5('0xf')][_0xa5c5('0x11')]);return _0x4fac62(_0x5219f6[_0xa5c5('0xf')][_0xa5c5('0x11')]);}else{logger[_0xa5c5('0xb')](_0xa5c5('0xc'),_0x53d781,'request\x20sent');_0x4fac62(_0x5219f6['result'][_0xa5c5('0x11')]);}})['catch'](function(_0x396a3a){logger[_0xa5c5('0xf')]('ContactItemType,\x20%s,\x20%s',_0x53d781,_0x396a3a);_0x498a5b(_0x396a3a);});});}