Built motion from commit 1fa89557.|2.6.10
[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 _0x2948=['project','body','channelData','ProjectName','ndagenerate_audio','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','password','username','resolve','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token'];(function(_0x52bdd8,_0x4e2f5e){var _0x14445a=function(_0x41be88){while(--_0x41be88){_0x52bdd8['push'](_0x52bdd8['shift']());}};_0x14445a(++_0x4e2f5e);}(_0x2948,0xcb));var _0x8294=function(_0x4c53c1,_0x177202){_0x4c53c1=_0x4c53c1-0x0;var _0x54bd98=_0x2948[_0x4c53c1];return _0x54bd98;};'use strict';var rp=require(_0x8294('0x0'));var url=require(_0x8294('0x1'));var logger=require(_0x8294('0x2'))(_0x8294('0x3'));module[_0x8294('0x4')]=function(_0xbbaec1,_0xcb5eea){var _0x2209e9={'method':_0x8294('0x5'),'uri':url['resolve'](_0xcb5eea[_0x8294('0x6')],'/token'),'form':{'grant_type':_0x8294('0x7'),'username':_0xcb5eea[_0x8294('0x8')],'password':_0xcb5eea[_0x8294('0x7')]},'json':!![]};return rp(_0x2209e9)['then'](function(_0x5a7135){var _0x56f7c8={'method':'POST','uri':url[_0x8294('0x9')](_0xcb5eea[_0x8294('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0xcb5eea[_0x8294('0xb')]||_0x8294('0xc'),'channelId':_0x8294('0xd'),'conversation':{'id':_0xbbaec1[_0x8294('0xe')]},'from':{'id':_0xbbaec1[_0x8294('0xf')],'name':_0xbbaec1[_0x8294('0x10')]},'recipient':{'id':_0xbbaec1['dnid'],'name':_0xbbaec1[_0x8294('0x11')]},'text':_0xcb5eea[_0x8294('0x12')],'channelData':{}},'headers':{'Authorization':_0x8294('0x13')+_0x5a7135[_0x8294('0x14')]},'json':!![]};if(_0xcb5eea[_0x8294('0x15')]){_0x56f7c8[_0x8294('0x16')][_0x8294('0x17')][_0x8294('0x18')]=_0xcb5eea['project'];}if(_0xcb5eea[_0x8294('0x19')]=='1'){_0x56f7c8[_0x8294('0x16')][_0x8294('0x17')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0xcb5eea['custom_action']){_0x56f7c8[_0x8294('0x16')][_0x8294('0x17')][_0x8294('0x1a')]=_0xcb5eea[_0x8294('0x1b')];if(_0xcb5eea[_0x8294('0x1c')]){_0x56f7c8[_0x8294('0x16')][_0x8294('0x17')][_0x8294('0x1d')]=_0xcb5eea[_0x8294('0x1c')];}}logger[_0x8294('0x1e')](JSON[_0x8294('0x1f')](_0x56f7c8));return rp(_0x56f7c8);});};