a1b37e8cb342f3f8ff9040408de76c3647525ed8
[motion-next.git] / server / services / agi / scripts / sestek / nda / index.js
1 const a1042_0x356a=['Bearer\x20','uniqueid','toString','AudioOutputSettings','/token','agi','custom_action','POST','CustomActionData','url','body','extension','ndagenerate_audio','ProjectName','callerid','audio/wav','request-promise-native','message','text','URL','Nda','/api/NaturalDialogAssistant/v1/Run','CustomAction','dnid','access_token','channelData','password','ndauth_url','stringify','project'];(function(_0x1b2ff3,_0x356a0a){const _0x3c501c=function(_0x1be940){while(--_0x1be940){_0x1b2ff3['push'](_0x1b2ff3['shift']());}};_0x3c501c(++_0x356a0a);}(a1042_0x356a,0x1b4));const a1042_0x3c50=function(_0x1b2ff3,_0x356a0a){_0x1b2ff3=_0x1b2ff3-0x0;let _0x3c501c=a1042_0x356a[_0x1b2ff3];return _0x3c501c;};const _0x4940cb=a1042_0x3c50;'use strict';const rp=require(_0x4940cb('0x0')),url=require(_0x4940cb('0x17')),logger=require('../../../../../config/logger')(_0x4940cb('0x13'));module['exports']=function(_0x1be940,_0x163ba1){const _0x54299c=_0x4940cb,_0x6d3eb9=new url['URL'](_0x54299c('0x12'),_0x163ba1[_0x54299c('0xb')])[_0x54299c('0x10')](),_0x58fa4d={'method':'POST','uri':_0x6d3eb9,'form':{'grant_type':_0x54299c('0xa'),'username':_0x163ba1['username'],'password':_0x163ba1['password']},'json':!![]};return rp(_0x58fa4d)['then'](function(_0x43dfca){const _0x43491f=_0x54299c,_0x1ce385=new url[(_0x43491f('0x3'))](_0x43491f('0x5'),_0x163ba1['ndassistant_url'])[_0x43491f('0x10')](),_0x5aa78f={'method':_0x43491f('0x15'),'uri':_0x1ce385,'body':{'type':_0x163ba1['ndaactivity_type']||_0x43491f('0x1'),'channelId':_0x43491f('0x4'),'conversation':{'id':_0x1be940[_0x43491f('0xf')]},'from':{'id':_0x1be940[_0x43491f('0x1c')],'name':_0x1be940['calleridname']},'recipient':{'id':_0x1be940[_0x43491f('0x7')],'name':_0x1be940[_0x43491f('0x19')]},'text':_0x163ba1[_0x43491f('0x2')],'channelData':{}},'headers':{'Authorization':_0x43491f('0xe')+_0x43dfca[_0x43491f('0x8')]},'json':!![]};return _0x163ba1[_0x43491f('0xd')]&&(_0x5aa78f['body']['channelData'][_0x43491f('0x1b')]=_0x163ba1[_0x43491f('0xd')]),_0x163ba1[_0x43491f('0x1a')]=='1'&&(_0x5aa78f[_0x43491f('0x18')][_0x43491f('0x9')][_0x43491f('0x11')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x43491f('0x1d')}),_0x163ba1[_0x43491f('0x14')]&&(_0x5aa78f[_0x43491f('0x18')][_0x43491f('0x9')][_0x43491f('0x6')]=_0x163ba1[_0x43491f('0x14')],_0x163ba1['custom_action_data']&&(_0x5aa78f[_0x43491f('0x18')][_0x43491f('0x9')][_0x43491f('0x16')]=_0x163ba1['custom_action_data'])),logger['info'](JSON[_0x43491f('0xc')](_0x5aa78f)),rp(_0x5aa78f);});};