Built motion from commit fe909640.|2.6.8
[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 _0xb11e=['custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','password','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','channelData','AudioOutputSettings','audio/wav'];(function(_0x4a5709,_0x500897){var _0x23bc21=function(_0x50bb70){while(--_0x50bb70){_0x4a5709['push'](_0x4a5709['shift']());}};_0x23bc21(++_0x500897);}(_0xb11e,0x7d));var _0xeb11=function(_0x24e8c0,_0x2da9ec){_0x24e8c0=_0x24e8c0-0x0;var _0x3e312d=_0xb11e[_0x24e8c0];return _0x3e312d;};'use strict';var rp=require(_0xeb11('0x0'));var url=require(_0xeb11('0x1'));var logger=require(_0xeb11('0x2'))(_0xeb11('0x3'));module[_0xeb11('0x4')]=function(_0x47e4c3,_0x5753d5){var _0x3a68aa={'method':_0xeb11('0x5'),'uri':url[_0xeb11('0x6')](_0x5753d5[_0xeb11('0x7')],'/token'),'form':{'grant_type':_0xeb11('0x8'),'username':_0x5753d5['username'],'password':_0x5753d5['password']},'json':!![]};return rp(_0x3a68aa)[_0xeb11('0x9')](function(_0x4994a2){var _0x5e5648={'method':_0xeb11('0x5'),'uri':url[_0xeb11('0x6')](_0x5753d5[_0xeb11('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5753d5[_0xeb11('0xb')]||_0xeb11('0xc'),'channelId':_0xeb11('0xd'),'conversation':{'id':_0x47e4c3[_0xeb11('0xe')]},'from':{'id':_0x47e4c3[_0xeb11('0xf')],'name':_0x47e4c3[_0xeb11('0x10')]},'recipient':{'id':_0x47e4c3[_0xeb11('0x11')],'name':_0x47e4c3[_0xeb11('0x12')]},'text':_0x5753d5['text'],'channelData':{}},'headers':{'Authorization':_0xeb11('0x13')+_0x4994a2[_0xeb11('0x14')]},'json':!![]};if(_0x5753d5[_0xeb11('0x15')]){_0x5e5648['body'][_0xeb11('0x16')]['ProjectName']=_0x5753d5[_0xeb11('0x15')];}if(_0x5753d5['ndagenerate_audio']=='1'){_0x5e5648['body'][_0xeb11('0x16')][_0xeb11('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xeb11('0x18')};}if(_0x5753d5[_0xeb11('0x19')]){_0x5e5648['body']['channelData'][_0xeb11('0x1a')]=_0x5753d5[_0xeb11('0x19')];if(_0x5753d5[_0xeb11('0x1b')]){_0x5e5648['body'][_0xeb11('0x16')]['CustomActionData']=_0x5753d5[_0xeb11('0x1b')];}}logger[_0xeb11('0x1c')](JSON[_0xeb11('0x1d')](_0x5e5648));return rp(_0x5e5648);});};