Skip to main content
Question

How do I get the voicemail transcription using java SDK?

  • February 21, 2020
  • 1 reply
  • 523 views

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?

1 reply

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • 2312 replies
  • February 24, 2020

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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings