Hope you doing fine. We been using Voximal(Latest) with asterisk 13 on Ubuntu(16.04.2 LTS).
I am trying to call my java web service which returns PCM 8000 stream, this stream we are generating using Amazon polly, then i want to playback the same stream to user over phone strictly using vxml.
First i want to know it's possible to playback the PCM stream using VXML2.1 or CCXML, i search a lot till now no success.
this is my vxml code, just a wild try :)
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1">
<var name="serviceVS" expr="'http://localhost:57144/polly/v1'"/>
<form>
<filled>
<data name="url" srcexpr="serviceVS" method="post" namelist="file"
enctype="multipart/form-data"/>
<assign name="urlToPlay" expr="url.url"/>
<log>
urlToPlay =>
<value expr="urlToPlay"/>
</log>
<audio expr ="urlToPlay"/>
</filled>
</form>
</vxml>
Below is my java code
@RequestMapping(value="/polly/v1", method = {RequestMethod.POST,RequestMethod.GET})
public ResponseEntity<InputStreamResource> pollyEndPoint(@RequestParam("voiceId") String voiceId,
@RequestParam("text")String text,@RequestParam("outputFormat") String outputFormat){
InputStream speechStream= null;
InputStreamResource inputStreamResource=null;
HttpHeaders headers=null;
try{
speechStream=quikWitService.getPollyTextToSpeech(voiceId,text,outputFormat);
inputStreamResource= new InputStreamResource(speechStream);
headers = new HttpHeaders();
headers.add("Content-Type",QuikWitUtils.getAudioFormatContentType(outputFormat));
}
catch(Exception e){
logger.error(e);
logger.debug(e.getStackTrace());
}
return new ResponseEntity<>(inputStreamResource,headers, HttpStatus.OK);
}
If anyone can point me to any articles or any more info, i will feel oblige.
Thanks