twilio/OpenVBX — Issue #196: whitespace at start of xml body, causing error with twilio
Author: kalin
Created: 2012-02-26 06:05:01+00:00
State: open

My installation of OpenVBX is inserting an extra newline character at the front of the xml body response

> post '/twiml/start/voice/8', :called => 8775799038

```
=> "\n\nhttp://phone.mysite.com/twiml/applet/voice/8/b3286f"
```

This output was consistent with a 1.2.1 installation done with dreamhost's one-click installer, and a freshly downloaded copy of the current master branch.

Twilio's debugger gives the following error

```
Error on line 2 of document : The processing instruction target matching "[xX][mM][lL]" is not allowed. Please ensure that the response body is a valid XML document.
```

We didn't change anything on the server installation, so I'm assuming that OpenVBX has been producing xml with an extra newline at the beginning for a while, and that something on Twilio's side has changed which is causing the error. We have been getting errors since February 20th.

I tried to poke around the code and trimming the whitespace from the body of the response, but wasn't able to find where the extra newline was being added. I'm hoping that one of the core developers can shed some light on this.