Built motion from commit (unavailable).|2.4.18
[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 _0xcbb1=['message','result','catch','lodash','util','moment','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','Disposition,\x20%s,\x20%s'];(function(_0x4b793b,_0x1ee112){var _0xcfbd6a=function(_0x2eb91c){while(--_0x2eb91c){_0x4b793b['push'](_0x4b793b['shift']());}};_0xcfbd6a(++_0x1ee112);}(_0xcbb1,0x1a7));var _0x1cbb=function(_0x361634,_0x2693da){_0x361634=_0x361634-0x0;var _0x43c535=_0xcbb1[_0x361634];return _0x43c535;};'use strict';var _=require(_0x1cbb('0x0'));var util=require(_0x1cbb('0x1'));var moment=require(_0x1cbb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1cbb('0x3'))(_0x1cbb('0x4'));var config=require('../../config/environment');var jayson=require(_0x1cbb('0x5'));var client=jayson['client'][_0x1cbb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x266629,_0x30a13b,_0x2a8672){return new BPromise(function(_0x33ace7,_0x2668ce){return client[_0x1cbb('0x7')](_0x266629,_0x2a8672)[_0x1cbb('0x8')](function(_0x36894b){logger[_0x1cbb('0x9')]('Disposition,\x20%s,\x20%s',_0x30a13b,_0x1cbb('0xa'));logger[_0x1cbb('0xb')](_0x1cbb('0xc'),_0x30a13b,_0x1cbb('0xa'),JSON[_0x1cbb('0xd')](_0x36894b));if(_0x36894b[_0x1cbb('0xe')]){if(_0x36894b[_0x1cbb('0xe')][_0x1cbb('0xf')]===0x1f4){logger[_0x1cbb('0xe')](_0x1cbb('0x10'),_0x30a13b,_0x36894b['error'][_0x1cbb('0x11')]);return _0x2668ce(_0x36894b[_0x1cbb('0xe')][_0x1cbb('0x11')]);}logger['error'](_0x1cbb('0x10'),_0x30a13b,_0x36894b[_0x1cbb('0xe')][_0x1cbb('0x11')]);return _0x33ace7(_0x36894b[_0x1cbb('0xe')]['message']);}else{logger[_0x1cbb('0x9')](_0x1cbb('0x10'),_0x30a13b,_0x1cbb('0xa'));_0x33ace7(_0x36894b[_0x1cbb('0x12')][_0x1cbb('0x11')]);}})[_0x1cbb('0x13')](function(_0x5e8d01){logger[_0x1cbb('0xe')](_0x1cbb('0x10'),_0x30a13b,_0x5e8d01);_0x2668ce(_0x5e8d01);});});}