Built motion from commit cb845558.|2.6.34
[motion2.git] / server / services / agi / scripts / sestek / nda / index.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 _0xbfa6=['dnid','text','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','stringify','request-promise','url','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x1b999f,_0xada878){_0x1b999f=_0x1b999f-0x0;var _0x51d27a=_0xbfa6[_0x1b999f];return _0x51d27a;};'use strict';var rp=require(_0x6bfa('0x0'));var url=require(_0x6bfa('0x1'));var logger=require('../../../../../config/logger')('agi');module['exports']=function(_0x2cae45,_0x10c0e2){var _0x72d347={'method':'POST','uri':url[_0x6bfa('0x2')](_0x10c0e2[_0x6bfa('0x3')],_0x6bfa('0x4')),'form':{'grant_type':_0x6bfa('0x5'),'username':_0x10c0e2[_0x6bfa('0x6')],'password':_0x10c0e2[_0x6bfa('0x5')]},'json':!![]};return rp(_0x72d347)[_0x6bfa('0x7')](function(_0x5b4337){var _0x1ad59f={'method':'POST','uri':url[_0x6bfa('0x2')](_0x10c0e2[_0x6bfa('0x8')],_0x6bfa('0x9')),'body':{'type':_0x10c0e2[_0x6bfa('0xa')]||_0x6bfa('0xb'),'channelId':_0x6bfa('0xc'),'conversation':{'id':_0x2cae45[_0x6bfa('0xd')]},'from':{'id':_0x2cae45[_0x6bfa('0xe')],'name':_0x2cae45[_0x6bfa('0xf')]},'recipient':{'id':_0x2cae45[_0x6bfa('0x10')],'name':_0x2cae45['extension']},'text':_0x10c0e2[_0x6bfa('0x11')],'channelData':{}},'headers':{'Authorization':_0x6bfa('0x12')+_0x5b4337[_0x6bfa('0x13')]},'json':!![]};if(_0x10c0e2['project']){_0x1ad59f[_0x6bfa('0x14')][_0x6bfa('0x15')][_0x6bfa('0x16')]=_0x10c0e2[_0x6bfa('0x17')];}if(_0x10c0e2[_0x6bfa('0x18')]=='1'){_0x1ad59f['body'][_0x6bfa('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6bfa('0x19')};}if(_0x10c0e2[_0x6bfa('0x1a')]){_0x1ad59f[_0x6bfa('0x14')][_0x6bfa('0x15')][_0x6bfa('0x1b')]=_0x10c0e2[_0x6bfa('0x1a')];if(_0x10c0e2[_0x6bfa('0x1c')]){_0x1ad59f[_0x6bfa('0x14')][_0x6bfa('0x15')]['CustomActionData']=_0x10c0e2[_0x6bfa('0x1c')];}}logger['info'](JSON[_0x6bfa('0x1d')](_0x1ad59f));return rp(_0x1ad59f);});};