Built motion from commit (unavailable).|2.4.21
[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 _0x165e=['agi','exports','POST','resolve','/token','username','password','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','Bearer\x20','access_token','channelData','ndagenerate_audio','body','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x165e,0x1ad));var _0xe165=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0x165e[_0x26b622];return _0x58a028;};'use strict';var rp=require(_0xe165('0x0'));var url=require(_0xe165('0x1'));var logger=require(_0xe165('0x2'))(_0xe165('0x3'));module[_0xe165('0x4')]=function(_0x2b360e,_0x12ef23){var _0x3a51f6={'method':_0xe165('0x5'),'uri':url[_0xe165('0x6')](_0x12ef23['ndauth_url'],_0xe165('0x7')),'form':{'grant_type':'password','username':_0x12ef23[_0xe165('0x8')],'password':_0x12ef23[_0xe165('0x9')]},'json':!![]};return rp(_0x3a51f6)['then'](function(_0x5ee0ad){var _0x3aa523={'method':_0xe165('0x5'),'uri':url['resolve'](_0x12ef23['ndassistant_url'],_0xe165('0xa')),'body':{'type':_0x12ef23[_0xe165('0xb')]||_0xe165('0xc'),'channelId':_0xe165('0xd'),'conversation':{'id':_0x2b360e[_0xe165('0xe')]},'from':{'id':_0x2b360e[_0xe165('0xf')],'name':_0x2b360e['calleridname']},'recipient':{'id':_0x2b360e['dnid'],'name':_0x2b360e['extension']},'text':_0x12ef23['text'],'channelData':{}},'headers':{'Authorization':_0xe165('0x10')+_0x5ee0ad[_0xe165('0x11')]},'json':!![]};if(_0x12ef23['project']){_0x3aa523['body'][_0xe165('0x12')]['ProjectName']=_0x12ef23['project'];}if(_0x12ef23[_0xe165('0x13')]=='1'){_0x3aa523[_0xe165('0x14')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe165('0x15')};}if(_0x12ef23[_0xe165('0x16')]){_0x3aa523[_0xe165('0x14')]['channelData'][_0xe165('0x17')]=_0x12ef23['custom_action'];if(_0x12ef23['custom_action_data']){_0x3aa523['body'][_0xe165('0x12')]['CustomActionData']=_0x12ef23[_0xe165('0x18')];}}logger[_0xe165('0x19')](JSON[_0xe165('0x1a')](_0x3aa523));return rp(_0x3aa523);});};