Built motion from commit 55091a5c.|2.6.30
[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 _0xe28e=['resolve','ndauth_url','/token','password','then','ndassistant_url','Nda','uniqueid','calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST'];(function(_0x3f2f69,_0x288a93){var _0x7afa2a=function(_0x5713b1){while(--_0x5713b1){_0x3f2f69['push'](_0x3f2f69['shift']());}};_0x7afa2a(++_0x288a93);}(_0xe28e,0x1ba));var _0xee28=function(_0x41da98,_0x56d235){_0x41da98=_0x41da98-0x0;var _0x2a6520=_0xe28e[_0x41da98];return _0x2a6520;};'use strict';var rp=require(_0xee28('0x0'));var url=require(_0xee28('0x1'));var logger=require(_0xee28('0x2'))(_0xee28('0x3'));module[_0xee28('0x4')]=function(_0x117a12,_0x3e541a){var _0x9f2216={'method':_0xee28('0x5'),'uri':url[_0xee28('0x6')](_0x3e541a[_0xee28('0x7')],_0xee28('0x8')),'form':{'grant_type':_0xee28('0x9'),'username':_0x3e541a['username'],'password':_0x3e541a[_0xee28('0x9')]},'json':!![]};return rp(_0x9f2216)[_0xee28('0xa')](function(_0x3f9bd9){var _0x66d0b6={'method':_0xee28('0x5'),'uri':url[_0xee28('0x6')](_0x3e541a[_0xee28('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3e541a['ndaactivity_type']||'message','channelId':_0xee28('0xc'),'conversation':{'id':_0x117a12[_0xee28('0xd')]},'from':{'id':_0x117a12['callerid'],'name':_0x117a12[_0xee28('0xe')]},'recipient':{'id':_0x117a12[_0xee28('0xf')],'name':_0x117a12['extension']},'text':_0x3e541a[_0xee28('0x10')],'channelData':{}},'headers':{'Authorization':_0xee28('0x11')+_0x3f9bd9[_0xee28('0x12')]},'json':!![]};if(_0x3e541a[_0xee28('0x13')]){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x16')]=_0x3e541a['project'];}if(_0x3e541a[_0xee28('0x17')]=='1'){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xee28('0x19')};}if(_0x3e541a['custom_action']){_0x66d0b6[_0xee28('0x14')][_0xee28('0x15')][_0xee28('0x1a')]=_0x3e541a[_0xee28('0x1b')];if(_0x3e541a[_0xee28('0x1c')]){_0x66d0b6[_0xee28('0x14')]['channelData'][_0xee28('0x1d')]=_0x3e541a['custom_action_data'];}}logger[_0xee28('0x1e')](JSON[_0xee28('0x1f')](_0x66d0b6));return rp(_0x66d0b6);});};