Built motion from commit 00bf23f6.|2.6.16
[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 _0x7d98=['ndagenerate_audio','AudioOutputSettings','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','ndauth_url','password','then','resolve','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName'];(function(_0x161bd5,_0x3bbc97){var _0x560baf=function(_0x34ad65){while(--_0x34ad65){_0x161bd5['push'](_0x161bd5['shift']());}};_0x560baf(++_0x3bbc97);}(_0x7d98,0xe7));var _0x87d9=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0x7d98[_0x15fc7a];return _0x3aa9f4;};'use strict';var rp=require(_0x87d9('0x0'));var url=require('url');var logger=require(_0x87d9('0x1'))(_0x87d9('0x2'));module[_0x87d9('0x3')]=function(_0xbee750,_0x47cceb){var _0x417ed2={'method':_0x87d9('0x4'),'uri':url['resolve'](_0x47cceb[_0x87d9('0x5')],'/token'),'form':{'grant_type':'password','username':_0x47cceb['username'],'password':_0x47cceb[_0x87d9('0x6')]},'json':!![]};return rp(_0x417ed2)[_0x87d9('0x7')](function(_0x2dc542){var _0x5f2693={'method':_0x87d9('0x4'),'uri':url[_0x87d9('0x8')](_0x47cceb[_0x87d9('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x47cceb[_0x87d9('0xa')]||_0x87d9('0xb'),'channelId':_0x87d9('0xc'),'conversation':{'id':_0xbee750[_0x87d9('0xd')]},'from':{'id':_0xbee750[_0x87d9('0xe')],'name':_0xbee750[_0x87d9('0xf')]},'recipient':{'id':_0xbee750[_0x87d9('0x10')],'name':_0xbee750[_0x87d9('0x11')]},'text':_0x47cceb[_0x87d9('0x12')],'channelData':{}},'headers':{'Authorization':_0x87d9('0x13')+_0x2dc542[_0x87d9('0x14')]},'json':!![]};if(_0x47cceb[_0x87d9('0x15')]){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x18')]=_0x47cceb[_0x87d9('0x15')];}if(_0x47cceb[_0x87d9('0x19')]=='1'){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x47cceb['custom_action']){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x1b')]=_0x47cceb['custom_action'];if(_0x47cceb['custom_action_data']){_0x5f2693[_0x87d9('0x16')][_0x87d9('0x17')][_0x87d9('0x1c')]=_0x47cceb[_0x87d9('0x1d')];}}logger[_0x87d9('0x1e')](JSON[_0x87d9('0x1f')](_0x5f2693));return rp(_0x5f2693);});};