Built motion from commit 42801a18.|2.6.28
[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 _0xc964=['resolve','ndauth_url','/token','password','username','then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','callerid','calleridname','dnid','text','project','body','channelData','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','stringify','request-promise','url','agi','exports'];(function(_0x530f37,_0x5a058d){var _0x76632a=function(_0x3c42ae){while(--_0x3c42ae){_0x530f37['push'](_0x530f37['shift']());}};_0x76632a(++_0x5a058d);}(_0xc964,0x7e));var _0x4c96=function(_0x167ae3,_0x546b82){_0x167ae3=_0x167ae3-0x0;var _0x1c2abb=_0xc964[_0x167ae3];return _0x1c2abb;};'use strict';var rp=require(_0x4c96('0x0'));var url=require(_0x4c96('0x1'));var logger=require('../../../../../config/logger')(_0x4c96('0x2'));module[_0x4c96('0x3')]=function(_0x90fbb1,_0x591daa){var _0x2777bb={'method':'POST','uri':url[_0x4c96('0x4')](_0x591daa[_0x4c96('0x5')],_0x4c96('0x6')),'form':{'grant_type':_0x4c96('0x7'),'username':_0x591daa[_0x4c96('0x8')],'password':_0x591daa[_0x4c96('0x7')]},'json':!![]};return rp(_0x2777bb)[_0x4c96('0x9')](function(_0x493618){var _0x19ed76={'method':_0x4c96('0xa'),'uri':url[_0x4c96('0x4')](_0x591daa['ndassistant_url'],_0x4c96('0xb')),'body':{'type':_0x591daa[_0x4c96('0xc')]||'message','channelId':'Nda','conversation':{'id':_0x90fbb1['uniqueid']},'from':{'id':_0x90fbb1[_0x4c96('0xd')],'name':_0x90fbb1[_0x4c96('0xe')]},'recipient':{'id':_0x90fbb1[_0x4c96('0xf')],'name':_0x90fbb1['extension']},'text':_0x591daa[_0x4c96('0x10')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x493618['access_token']},'json':!![]};if(_0x591daa[_0x4c96('0x11')]){_0x19ed76[_0x4c96('0x12')][_0x4c96('0x13')]['ProjectName']=_0x591daa['project'];}if(_0x591daa[_0x4c96('0x14')]=='1'){_0x19ed76[_0x4c96('0x12')][_0x4c96('0x13')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x4c96('0x15')};}if(_0x591daa[_0x4c96('0x16')]){_0x19ed76[_0x4c96('0x12')][_0x4c96('0x13')][_0x4c96('0x17')]=_0x591daa[_0x4c96('0x16')];if(_0x591daa[_0x4c96('0x18')]){_0x19ed76['body'][_0x4c96('0x13')]['CustomActionData']=_0x591daa[_0x4c96('0x18')];}}logger['info'](JSON[_0x4c96('0x19')](_0x19ed76));return rp(_0x19ed76);});};