nvisibleinc / go-ari-proxy

Asterisk REST Interface proxy system written in Go
Apache License 2.0
31 stars 17 forks source link

ari_body: why are all double quotes escaped? #34

Open hekmekk opened 6 years ago

hekmekk commented 6 years ago

When comparing events from asterisk and go-ari-proxy, one can see that the proxy formats the asterisk event as a string, which makes deserializing pretty hard:

asterisk event:

{"type":"StasisStart","timestamp":"2017-11-30T14:37:15.796+0100","application":"foo","asterisk_id":"aa:00:00:36:fa:ca","channel":{"id":"1512049035.123","dialplan":{"context":"default","exten":"1000","priority":2},"name":"PJSIP/1001-00000061","connected":{"name":"","number":""},"state":"Ring","creationtime":"2017-11-30T14:37:15.794+0100","caller":{"name":"","number":"1001"},"accountcode":"","language":"en"},"args":[]}

go-ari-proxy:

{"server_id":"good_server","timestamp":"2017-11-30T14:37:15.796635341+01:00","type":"StasisStart","ari_body":"{\"type\":\"StasisStart\",\"timestamp\":\"2017-11-30T14:37:15.796+0100\",\"application\":\"foo\",\"asterisk_id\":\"aa:00:00:36:fa:ca\",\"channel\":{\"id\":\"1512049035.123\",\"dialplan\":{\"context\":\"default\",\"exten\":\"1000\",\"priority\":2},\"name\":\"PJSIP/1001-00000061\",\"connected\":{\"name\":\"\",\"number\":\"\"},\"state\":\"Ring\",\"creationtime\":\"2017-11-30T14:37:15.794+0100\",\"caller\":{\"name\":\"\",\"number\":\"1001\"},\"accountcode\":\"\",\"language\":\"en\"},\"args\":[]}"}

Is there a reason why this is so or is this merely a bug?

leifmadsen commented 6 years ago

@Marquis42 can you take a look at this and comment / fix?