Built motion from commit (unavailable).|2.4.17
[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 _0xc262=['rpc','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x496240,_0x204916){var _0x4d20fa=function(_0x5d071a){while(--_0x5d071a){_0x496240['push'](_0x496240['shift']());}};_0x4d20fa(++_0x204916);}(_0xc262,0x118));var _0x2c26=function(_0x2dfb67,_0x5355c2){_0x2dfb67=_0x2dfb67-0x0;var _0x3d0482=_0xc262[_0x2dfb67];return _0x3d0482;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2c26('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c26('0x1'));var db=require(_0x2c26('0x2'))['db'];var utils=require(_0x2c26('0x3'));var logger=require(_0x2c26('0x4'))(_0x2c26('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2c26('0x6')][_0x2c26('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b6792,_0xe3dd7b,_0x463c9f){return new BPromise(function(_0x4511da,_0x5b2988){return client[_0x2c26('0x8')](_0x3b6792,_0x463c9f)[_0x2c26('0x9')](function(_0x579d2e){logger[_0x2c26('0xa')](_0x2c26('0xb'),_0xe3dd7b,_0x2c26('0xc'));logger[_0x2c26('0xd')](_0x2c26('0xe'),_0xe3dd7b,_0x2c26('0xc'),JSON[_0x2c26('0xf')](_0x579d2e));if(_0x579d2e[_0x2c26('0x10')]){if(_0x579d2e[_0x2c26('0x10')]['code']===0x1f4){logger[_0x2c26('0x10')](_0x2c26('0xb'),_0xe3dd7b,_0x579d2e[_0x2c26('0x10')][_0x2c26('0x11')]);return _0x5b2988(_0x579d2e[_0x2c26('0x10')][_0x2c26('0x11')]);}logger['error']('Disposition,\x20%s,\x20%s',_0xe3dd7b,_0x579d2e[_0x2c26('0x10')]['message']);return _0x4511da(_0x579d2e[_0x2c26('0x10')]['message']);}else{logger['info'](_0x2c26('0xb'),_0xe3dd7b,_0x2c26('0xc'));_0x4511da(_0x579d2e['result'][_0x2c26('0x11')]);}})[_0x2c26('0x12')](function(_0x70c8d8){logger[_0x2c26('0x10')](_0x2c26('0xb'),_0xe3dd7b,_0x70c8d8);_0x5b2988(_0x70c8d8);});});}