Built motion from commit d69f4380.|2.6.29
[motion2.git] / server / api / voiceContext / voiceContext.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 _0x4295=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2d4abf,_0x5f0d14){var _0x31ffdc=function(_0xa160b0){while(--_0xa160b0){_0x2d4abf['push'](_0x2d4abf['shift']());}};_0x31ffdc(++_0x5f0d14);}(_0x4295,0xc3));var _0x5429=function(_0x50a51e,_0x56e813){_0x50a51e=_0x50a51e-0x0;var _0x8a736e=_0x4295[_0x50a51e];return _0x8a736e;};'use strict';var _=require(_0x5429('0x0'));var util=require('util');var moment=require(_0x5429('0x1'));var BPromise=require(_0x5429('0x2'));var rs=require(_0x5429('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5429('0x4'))['db'];var utils=require(_0x5429('0x5'));var logger=require('../../config/logger')(_0x5429('0x6'));var config=require(_0x5429('0x7'));var jayson=require(_0x5429('0x8'));var client=jayson['client'][_0x5429('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d9893,_0x126193,_0x7315eb){return new BPromise(function(_0x58f37e,_0x2d814d){return client[_0x5429('0xa')](_0x5d9893,_0x7315eb)['then'](function(_0x43d54c){logger['info'](_0x5429('0xb'),_0x126193,'request\x20sent');logger[_0x5429('0xc')](_0x5429('0xd'),_0x126193,_0x5429('0xe'),JSON[_0x5429('0xf')](_0x43d54c));if(_0x43d54c[_0x5429('0x10')]){if(_0x43d54c[_0x5429('0x10')]['code']===0x1f4){logger[_0x5429('0x10')](_0x5429('0xb'),_0x126193,_0x43d54c[_0x5429('0x10')]['message']);return _0x2d814d(_0x43d54c[_0x5429('0x10')]['message']);}logger[_0x5429('0x10')]('VoiceContext,\x20%s,\x20%s',_0x126193,_0x43d54c['error'][_0x5429('0x11')]);return _0x58f37e(_0x43d54c[_0x5429('0x10')][_0x5429('0x11')]);}else{logger[_0x5429('0x12')](_0x5429('0xb'),_0x126193,_0x5429('0xe'));_0x58f37e(_0x43d54c[_0x5429('0x13')]['message']);}})['catch'](function(_0x4326a5){logger[_0x5429('0x10')](_0x5429('0xb'),_0x126193,_0x4326a5);_0x2d814d(_0x4326a5);});});}