ea50eede1dbd86bb47b089bbbad743e6711cc057
[motion2.git] / server / api / disposition / disposition.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 _0x44d0=['then','info','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','error','Disposition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request'];(function(_0x16311f,_0x40f002){var _0x42f147=function(_0x1887fd){while(--_0x1887fd){_0x16311f['push'](_0x16311f['shift']());}};_0x42f147(++_0x40f002);}(_0x44d0,0x1c2));var _0x044d=function(_0x21ae22,_0x54911f){_0x21ae22=_0x21ae22-0x0;var _0x1e610a=_0x44d0[_0x21ae22];return _0x1e610a;};'use strict';var _=require(_0x044d('0x0'));var util=require(_0x044d('0x1'));var moment=require(_0x044d('0x2'));var BPromise=require(_0x044d('0x3'));var rs=require(_0x044d('0x4'));var fs=require('fs');var Redis=require(_0x044d('0x5'));var db=require(_0x044d('0x6'))['db'];var utils=require(_0x044d('0x7'));var logger=require('../../config/logger')(_0x044d('0x8'));var config=require('../../config/environment');var jayson=require(_0x044d('0x9'));var client=jayson['client'][_0x044d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a05e3,_0x56afb9,_0x2befa0){return new BPromise(function(_0x3f61a1,_0x17fbae){return client[_0x044d('0xb')](_0x3a05e3,_0x2befa0)[_0x044d('0xc')](function(_0x2f805b){logger[_0x044d('0xd')]('Disposition,\x20%s,\x20%s',_0x56afb9,'request\x20sent');logger[_0x044d('0xe')](_0x044d('0xf'),_0x56afb9,_0x044d('0x10'),JSON['stringify'](_0x2f805b));if(_0x2f805b[_0x044d('0x11')]){if(_0x2f805b[_0x044d('0x11')]['code']===0x1f4){logger[_0x044d('0x11')](_0x044d('0x12'),_0x56afb9,_0x2f805b['error']['message']);return _0x17fbae(_0x2f805b[_0x044d('0x11')]['message']);}logger[_0x044d('0x11')](_0x044d('0x12'),_0x56afb9,_0x2f805b['error']['message']);return _0x3f61a1(_0x2f805b[_0x044d('0x11')][_0x044d('0x13')]);}else{logger[_0x044d('0xd')](_0x044d('0x12'),_0x56afb9,_0x044d('0x10'));_0x3f61a1(_0x2f805b[_0x044d('0x14')][_0x044d('0x13')]);}})[_0x044d('0x15')](function(_0x25d28b){logger[_0x044d('0x11')]('Disposition,\x20%s,\x20%s',_0x56afb9,_0x25d28b);_0x17fbae(_0x25d28b);});});}