question

Michael Guntner avatar image
Michael Guntner asked Phong Vu answered

How do I get the voicemail transcription using java SDK?

Now that I've got the voicemail body using the ringcentral-pubnub library, how do I use the java SDK to get the voicemail transcription via the URI in the attachments?

sdk
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Phong Vu avatar image
Phong Vu answered

Provided that you are using the RingCentral Java SDK, you can read the transcript file as shown below.

public void read_message_store_voicemail() throws RestException, IOException{
        ListMessagesParameters parameters = new ListMessagesParameters();
        parameters.messageType = new String[] {"VoiceMail"};
        
        var response = restClient.restapi().account().extension().messagestore().list(parameters);
        for (GetMessageInfoResponse record : response.records)
        {
            if (record.attachments != null)
            {
                for (var attachment : record.attachments)
                {
                    var fileName = "./src/test/resources/" + record.attachments[0].id + "_voicemail.txt";
                    if (attachment.type.equals("AudioTranscription"))
                   {
                    var res = restClient.restapi().account().extension().messagestore(record.id).content(attachment.id).get();
                    Path path = Paths.get(fileName);
                    Files.write(path, res);
                    }
                }
            }
        }
    }

Hope this helps.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys