Author Message
liu159
Joined: Jan 19, 2015
Messages: 96
Offline
Hi,

I noticed that in EDPTester/TesterRESTService.java,

It takes a parameter "fileUri" from REST service as the announcement uri for the audio that get played when a user picks up the call.

What if I want to put the audio file under src/main/webapp/resources/wav folder, and get the audio file by using relative path (/resources/wav/abc.wav) in the java class ?

How can I do that ?

Cause right now I hardcoded the file URI to the java class like this : "https://serverIP/services/myEdpSnap-in/resources/wav/abc.wav".

However, if we move to another server, we have to change the code and recompile the project ... That doesn't make sense...

DipeshGandhi2 [Avatar]

Joined: Nov 14, 2011
Messages: 35
Offline
The "file://" refers to audio file located on AMS server, relative to file storage root /opt/avaya/app/localmedia/

There are all together four methods supported for PlayItem.

- Content Store: "cstore://welcome?ns=announcements&cg=greetings"
This uri scheme is based on the Avaya Media Server (AMS) content-id (welcome), namespace (announcements) and content group (greetings) parameters. This requires an administrator who is logged into the AMS management web page to add the namespace, content group and content-id or name of the media file to the AMS content store.
- File URI: "file://welcome.wav";
- Http(s) URI: "http://www.mycompany.com/announcements/greetings/welcome.wav";
- TTS text string: "Welcome to my company."

The relative path file URI for wav contained within snap-in is not supported. What you could do instead is form Http(s) URI to the relative wav file in your snap-in. One way this can be achieved is by injecting UriInfo within REST class (e.g. TesterRESTService).

@Context UriInfo uriInfo

This will give you base HTTP(S) URI and you can append the "resources/wav/<wav-file>" to build the complete URI. Then pass the newly formed URI into PlayItem.setSource



Thanks,
Dipesh


Dipesh Gandhi Software Engineer, Avaya DevConnect
liu159
Joined: Jan 19, 2015
Messages: 96
Offline
Hi Dipesh,

I tried to use UriInfo in my REST class but there is an URISyntaxException:

Error 500: java.lang.IllegalStateException: java.net.URISyntaxException: Illegal character in hostname at index 11: http://http_backend_443:9080/

Here is my REST class:

@Path("/addParticipantToConf")
public class AddParticipantToConf {
@Context
UriInfo uriInfo;

private final RequestProcessor requestProcessor;
private final Logger logger;

public AddParticipantToConf() {
this(new RequestProcessorImpl(), Logger
.getLogger(AddParticipantToConf.class));
}

AddParticipantToConf(final RequestProcessor requestProcessor,
final Logger logger) {
this.requestProcessor = requestProcessor;
this.logger = logger;
}

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response doPost(final JsonReq json, @Context UriInfo uriInfo) {

logger.finer("doPost: uriInfo: " + uriInfo.getAbsolutePath().toString());

....
}

Any idea about this ?
liu159
Joined: Jan 19, 2015
Messages: 96
Offline
Could anybody take a look at this ?
DipeshGandhi2 [Avatar]

Joined: Nov 14, 2011
Messages: 35
Offline
Hello,

Much apologies for the delayed response. After discussion with development team, there is a sample snap-in bundled with SDK, named Callingpolicies, which demonstrates how to reference announcement packaged within the snap-in. For convenience, I have attached this sample snap-in. Please see PromptAndCollectOperationImpl.java for sample code.


Thank you,
Dipesh
Filename Callingpolicies.zip [Disk] Download

Dipesh Gandhi Software Engineer, Avaya DevConnect
liu159
Joined: Jan 19, 2015
Messages: 96
Offline
Thank you ! It's working !
Go to:   
Mobile view