Voicemail Message Retrieval

  • 1
  • Problem
  • Updated 2 weeks ago
I have a Production API successfully retrieving message (sms, voicemails, faxes) data and we are storing that information in our database.

Now, we attempting to take the message id and attachment id and using it to retrieve the voicemail and we are getting this error.

{ "errorCode" : "CMN-102", "message" : "Resource for parameter [messageId] is not found", "errors" : [ { "errorCode" : "CMN-102", "message" : "Resource for parameter [messageId] is not found", "parameterName" : "messageId" } ], "parameterName" : "messageId" } 


I am wondering if since the voicemail is coming in on our production phone number if attempting to access it with our sandbox phone number (and credentials) while testing is causing the "resource not found."  I doubt it, but I need to ask.

Any other insight into what is causing this error would be helpful.

Our API endpoint is (pound symbols will replace actual variables in Coldfusion:

https://platform.devtest.ringcentral.com/restapi/v1.0/account/#setOwnerId#/extension/#setOwnerId#/message-store/#messageId#/content/#attachment_Id#

Thanks,

Jason
Photo of Jason

Jason

  • 450 Points 250 badge 2x thumb

Posted 2 weeks ago

  • 1
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,298 Points 5k badge 2x thumb
You cannot access production resource with sandbox credentials.
Photo of Jason

Jason

  • 450 Points 250 badge 2x thumb
So, you are telling me I cannot test my code in retrieving a voicemail attachment in SandBox?  I have to do it in Production?

I just want to confirm, because it may create unnecessary errors on the production side.
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,238 Points 5k badge 2x thumb
You said "I am wondering if since the voicemail is coming in on our production phone number if attempting to access it with our sandbox phone number (and credentials)"

You can generate the voicemail in sandbox and access it in sandbox..  Sandbox env and production env are separated.
Photo of Jason

Jason

  • 450 Points 250 badge 2x thumb
Ok, what is causing this error:

{ "errorCode" : "CMN-102", "message" : "Resource for parameter [messageId] is not found", "errors" : [ { "errorCode" : "CMN-102", "message" : "Resource for parameter [messageId] is not found", "parameterName" : "messageId" } ], "parameterName" : "messageId" } 
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,238 Points 5k badge 2x thumb
It simply means that messageId is not found on RingCentral server. Where did you get the messageId?
Photo of Jason

Jason

  • 450 Points 250 badge 2x thumb
Message Id was parsed from a JSON string by a Reading Messages method created from your API.

Now, since you cannot leave a voicemail on Sandbox number for testing (I tried), I called our Production line and left a test message.

Then, I downloaded the message data through JSON and stored it on my server.  From what I can tell, it does not matter how you download the information (Sandbox or Production) because that information is unchanged.  

However, my concern is that if I left the voicemail on the Production phone number and trying to access the voicemail with Sandbox, then it may not work.  Maybe that is why I am getting the Message Id is not found.

If I can't retrieve a Production number voicemail with Sandbox, then how would I test my voicemail retrieval code in Sandbox...it seems to me I would have to test it on Production which would create errors on the Production side.

Please confirm that.
Photo of Jason

Jason

  • 450 Points 250 badge 2x thumb
Also, I can still access my Sandbox credentials when making changes to my Application with SMS Sending and Getting Messages.  Those two methods still work on SandBox.
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,238 Points 5k badge 2x thumb
Then how to reproduce the issue you reported? Do you mean you get messageId from sandbox and try to download it with production credentials?
Photo of Jason

Jason

  • 450 Points 250 badge 2x thumb
Ok..let's forget about Production versus Sandbox.
Photo of Jason

Jason

  • 450 Points 250 badge 2x thumb
I didn't get a response from my request above, so I went ahead and tested my code on production and it appears to retrieve the voicemail.

The problem is the documentation says that the file is audio/x-wav.

https://developer.ringcentral.com/api-docs/latest/index.html?section=RefMessages.html#!#MessageAttac...

However, the JSON get messages method returns audio/mpeg and my code checks the mime-type and it also says audio-mpeg.

However, when I write the file as an .mp3, the file is invalid.  

Suggestions please since the documentation is wrong.

Jason
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,278 Points 5k badge 2x thumb
Some are wav files while some are mp3 files.

You can configure it in service web so that all future files will be in a single format.

However, when I write the file as an .mp3, the file is invalid.  

How do you know that file is invalid and how do you download the binary and save it as a file?  Could you please post sample code?
Photo of Jason

Jason

  • 450 Points 250 badge 2x thumb
I use Coldfusion, but if you read what is going on, it's pretty easily to understand:

<cfif sandBoxStatus> <!--- SandBox--->
SANDBOX MODE<BR>
<cfset base_url = "https://platform.devtest.ringcentral.com"; />
<cfelse>
<!--- Production--->
<cfset base_url = "https://platform.ringcentral.com"; />
</cfif>

<cfset authorization = setTokenType & " " & setAccessToken />

<cfset voicemail_url = "/restapi/v1.0/account/#setOwnerId#/extension/#setOwnerId#/message-store/#messageId#/content/#attachment_Id#" />

<cfset final_url = base_url & voicemail_url />

<cfhttp
    method="get"
    url="#final_url#"
    resolveurl="no"
    getasbinary="yes"
    path="#getDirectory#\temp\" 
    file="#attachment_Id#.mp3"
>

<cfhttpparam type="header" name="authorization" value="#authorization#">

</cfhttp>

When the file is stored on the directly and path specific in the CFHTTP tag and I attempt to access it, it says it is an invalid file.


You can configure it in service web so that all future files will be in a single format.

How do you do this?
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,278 Points 5k badge 2x thumb
Try to save it as wav and see if it's still invalid. Just want to narrow down the problem: it could be an extension(mp3 vs wav) issue or it could be some coding issue (wrong way to read and save binary.)
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,278 Points 5k badge 2x thumb
> How do you do this?

Forgot the details. I will get back to you later.
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,278 Points 5k badge 2x thumb
In order to change default voicemail format, you can contact RC support. There seems no way for you to change it yourself.

By default it is mp3. But some accounts with long history might have different settings.