Correctly generate SDP message from JS object
Fixes a bunch of parsing and generation bugs