unable to parse fax envelope

  • 1
  • Article
  • Updated 2 years ago
When POSTing from vb, I get the error "unable to parse fax envelope". The POST payload looks exactly the same as the one I am sending from the REST client which works fine.

It took a while to realize that I should only use Line Feeds "Chr(10)" and not Carriage Returns "Chr(13)" !!!

I searched this site looking for an answer, but I guess no one else had run into this problem before. 

Hopefully, this will save the next person some time.
Photo of Orchard Medical Center

Orchard Medical Center

  • 130 Points 100 badge 2x thumb
  • amused

Posted 2 years ago

  • 1
Photo of Benjamin Dean

Benjamin Dean

  • 8,602 Points 5k badge 2x thumb
Windows VS Linux newlines is always a problem for systems which are sensitive to these types of nuances.

Thanks a TON for sharing your VB experience. I will tag this post respectively.

I've also converted this to an article.

You are welcomed to submit a Pull Request to the RingCentral FAQ repository on Github (to include this in the official FAQ) if you would be interested.
https://github.com/ringcentral/ringce...

Thanks!
(Edited)
Photo of Clear

Clear

  • 100 Points 100 badge 2x thumb
I also had this issue as my c# classes are in PascalCase, and Newtonsoft serializer output this:
{
  "To": [
    {
      "PhoneNumber": "16461231234"
    }
  ],
  "FaxResolution": "High"
}
in addition with the CRLF.

I fixed this by using this in my FaxRequestBody class:

public string ToJsonString()
        {
            string json = JsonConvert.SerializeObject(this, 
                                                      Formatting.None, // so there's no CRLF
                                                      new JsonSerializerSettings
                                                      {
                                                          NullValueHandling = NullValueHandling.Ignore, //this so nulls are not shown
                                                          ContractResolver = new CamelCasePropertyNamesContractResolver() //this so PhoneNumber property is output as phoneNumber
                                                      });
            return json;
        }
 
(Edited)