add json escape; test with endpoint=foo\ bar@host

whoops, pushed to the wrong remote master. Anyway... haven't deployed that yet, need to do so before merging.

It seems that endpoints like "foo\ bar@host/resource" make the current code generate invalid JSON for dominant speaker events.