Unable to change the control message format

Hello everyone,

when adding a Websocket via External Media, it seems that I cannot set the control message format to be JSON. It always reverts back to plain-text. I’ve downloaded 22.8.0-rc1 which includes chan_websocket.conf thinking that I could set the default to be JSON, but this didn’t work either.

Is this a bug or is there some way for me to set the control message format to JSON from External Media ARI call?

Let me check.

I just tried 22.8.1-rc1 and setting either control_message_format = json in chan_websocket.conf or setting “name”: “transport_data”, “value”: “f(json)” on the externalMedia call worked.

Can you show me your chan_websocket.conf file and your call to externalMedia?

I am using ARI via the node-ari which seems a bit outdated, but I am kinda stuck with it for now. Setting a parameter transport_data: “f(json)” on the .externalMedia()call seems to have done the trick.

However I have a feeling that chan_websocket.conf might not be used at all or I am doing something wrong. I was under the impression that setting control_message_format = json to the configuration file should work everywhere regardless of whether the websocket was created via Dial or via ExternalMedia.

The contents of the chan_websocket.conf are simple. I just updated the sample being added after running make samples to read

[general]
control_message_format = json        ; The format for the control messages sent

I went through chan_websocket.c and I think global_cfg might not initialized.

I tried setting the control_message_format to something different (i.e.control_message_format=test) expecting some sort of warning or error which I saw there were in the source but none was logged.

I didn’t have much time to thoroughly go through the source code so I might be complete off.

It looks like the sample documentation is incorrect. It should be under a “global” section and not “general”.

Ah crap, yeah. It should be “global”. I’ll fix the sample.