Built motion from commit (unavailable).|2.2.1
[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 _0x1273=['uniqueid','callerid','dnid','extension','text','Bearer\x20','project','body','channelData','ProjectName','AudioOutputSettings','custom_action','CustomAction','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x1fbf80,_0x31a995){var _0x312eb8=function(_0x371a83){while(--_0x371a83){_0x1fbf80['push'](_0x1fbf80['shift']());}};_0x312eb8(++_0x31a995);}(_0x1273,0x112));var _0x3127=function(_0x3f4263,_0x3d1a5f){_0x3f4263=_0x3f4263-0x0;var _0x7bcfbe=_0x1273[_0x3f4263];return _0x7bcfbe;};'use strict';var rp=require(_0x3127('0x0'));var url=require(_0x3127('0x1'));var logger=require(_0x3127('0x2'))(_0x3127('0x3'));module[_0x3127('0x4')]=function(_0x2370a6,_0x20e0b4){var _0x270c67={'method':_0x3127('0x5'),'uri':url[_0x3127('0x6')](_0x20e0b4['ndauth_url'],'/token'),'form':{'grant_type':_0x3127('0x7'),'username':_0x20e0b4['username'],'password':_0x20e0b4[_0x3127('0x7')]},'json':!![]};return rp(_0x270c67)[_0x3127('0x8')](function(_0x2ea24b){var _0x18af45={'method':_0x3127('0x5'),'uri':url['resolve'](_0x20e0b4[_0x3127('0x9')],_0x3127('0xa')),'body':{'type':_0x20e0b4[_0x3127('0xb')]||'message','channelId':'Nda','conversation':{'id':_0x2370a6[_0x3127('0xc')]},'from':{'id':_0x2370a6[_0x3127('0xd')],'name':_0x2370a6['calleridname']},'recipient':{'id':_0x2370a6[_0x3127('0xe')],'name':_0x2370a6[_0x3127('0xf')]},'text':_0x20e0b4[_0x3127('0x10')],'channelData':{}},'headers':{'Authorization':_0x3127('0x11')+_0x2ea24b['access_token']},'json':!![]};if(_0x20e0b4[_0x3127('0x12')]){_0x18af45[_0x3127('0x13')][_0x3127('0x14')][_0x3127('0x15')]=_0x20e0b4[_0x3127('0x12')];}if(_0x20e0b4['ndagenerate_audio']=='1'){_0x18af45['body'][_0x3127('0x14')][_0x3127('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x20e0b4[_0x3127('0x17')]){_0x18af45[_0x3127('0x13')][_0x3127('0x14')][_0x3127('0x18')]=_0x20e0b4[_0x3127('0x17')];if(_0x20e0b4['custom_action_data']){_0x18af45[_0x3127('0x13')]['channelData']['CustomActionData']=_0x20e0b4['custom_action_data'];}}logger['info'](JSON[_0x3127('0x19')](_0x18af45));return rp(_0x18af45);});};