c6d2dda563bc7b7c894454b4e4520c8eb7235e3f
[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 _0x3143=['username','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','resolve','/token','password'];(function(_0x49dc49,_0x5b0a31){var _0x2e2af8=function(_0x2ff529){while(--_0x2ff529){_0x49dc49['push'](_0x49dc49['shift']());}};_0x2e2af8(++_0x5b0a31);}(_0x3143,0x1b8));var _0x3314=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x3143[_0x1a7846];return _0x48049;};'use strict';var rp=require(_0x3314('0x0'));var url=require(_0x3314('0x1'));var logger=require(_0x3314('0x2'))(_0x3314('0x3'));module[_0x3314('0x4')]=function(_0x1cfe50,_0x4dbcc9){var _0x4dd1c5={'method':'POST','uri':url[_0x3314('0x5')](_0x4dbcc9['ndauth_url'],_0x3314('0x6')),'form':{'grant_type':_0x3314('0x7'),'username':_0x4dbcc9[_0x3314('0x8')],'password':_0x4dbcc9['password']},'json':!![]};return rp(_0x4dd1c5)['then'](function(_0x2135c7){var _0x5d525a={'method':_0x3314('0x9'),'uri':url[_0x3314('0x5')](_0x4dbcc9['ndassistant_url'],_0x3314('0xa')),'body':{'type':_0x4dbcc9[_0x3314('0xb')]||_0x3314('0xc'),'channelId':'Nda','conversation':{'id':_0x1cfe50[_0x3314('0xd')]},'from':{'id':_0x1cfe50[_0x3314('0xe')],'name':_0x1cfe50[_0x3314('0xf')]},'recipient':{'id':_0x1cfe50[_0x3314('0x10')],'name':_0x1cfe50['extension']},'text':_0x4dbcc9['text'],'channelData':{}},'headers':{'Authorization':_0x3314('0x11')+_0x2135c7[_0x3314('0x12')]},'json':!![]};if(_0x4dbcc9[_0x3314('0x13')]){_0x5d525a[_0x3314('0x14')][_0x3314('0x15')][_0x3314('0x16')]=_0x4dbcc9[_0x3314('0x13')];}if(_0x4dbcc9[_0x3314('0x17')]=='1'){_0x5d525a[_0x3314('0x14')][_0x3314('0x15')][_0x3314('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3314('0x19')};}if(_0x4dbcc9[_0x3314('0x1a')]){_0x5d525a[_0x3314('0x14')]['channelData'][_0x3314('0x1b')]=_0x4dbcc9['custom_action'];if(_0x4dbcc9[_0x3314('0x1c')]){_0x5d525a[_0x3314('0x14')][_0x3314('0x15')][_0x3314('0x1d')]=_0x4dbcc9[_0x3314('0x1c')];}}logger[_0x3314('0x1e')](JSON[_0x3314('0x1f')](_0x5d525a));return rp(_0x5d525a);});};