Built motion from commit (unavailable).|2.2.0
[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 _0xad0d=['ProjectName','ndagenerate_audio','channelData','audio/wav','info','stringify','request-promise','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','extension','text','Bearer\x20','project','body'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0xad0d,0x172));var _0xdad0=function(_0x201457,_0xede44b){_0x201457=_0x201457-0x0;var _0x2a61ea=_0xad0d[_0x201457];return _0x2a61ea;};'use strict';var rp=require(_0xdad0('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0xdad0('0x1'));module[_0xdad0('0x2')]=function(_0x3c3588,_0x5ebba1){var _0x74a59a={'method':_0xdad0('0x3'),'uri':url[_0xdad0('0x4')](_0x5ebba1[_0xdad0('0x5')],_0xdad0('0x6')),'form':{'grant_type':_0xdad0('0x7'),'username':_0x5ebba1[_0xdad0('0x8')],'password':_0x5ebba1['password']},'json':!![]};return rp(_0x74a59a)['then'](function(_0x55a795){var _0x2508dc={'method':'POST','uri':url[_0xdad0('0x4')](_0x5ebba1[_0xdad0('0x9')],_0xdad0('0xa')),'body':{'type':_0xdad0('0xb'),'channelId':_0xdad0('0xc'),'conversation':{'id':_0x3c3588[_0xdad0('0xd')]},'from':{'id':_0x3c3588[_0xdad0('0xe')],'name':_0x3c3588['calleridname']},'recipient':{'id':_0x3c3588['dnid'],'name':_0x3c3588[_0xdad0('0xf')]},'text':_0x5ebba1[_0xdad0('0x10')],'channelData':{}},'headers':{'Authorization':_0xdad0('0x11')+_0x55a795['access_token']},'json':!![]};if(_0x5ebba1[_0xdad0('0x12')]){_0x2508dc[_0xdad0('0x13')]['channelData'][_0xdad0('0x14')]=_0x5ebba1[_0xdad0('0x12')];}if(_0x5ebba1[_0xdad0('0x15')]=='1'){_0x2508dc[_0xdad0('0x13')][_0xdad0('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xdad0('0x17')};}logger[_0xdad0('0x18')](JSON[_0xdad0('0x19')](_0x2508dc));return rp(_0x2508dc);});};