Repository navigation
Decode the channel data in an outbound socket's connect reply - #20
Closed
henrikbjorn wants to merge 3 commits into
Closed
henrikbjorn wants to merge 3 commits into
henrikbjorn wants to merge 3 commits into
Conversation
FreeSWITCH URL-encodes the channel data it sends in reply to connect, as it does in event bodies. Response parses reply headers without decoding, so the first snapshot of every outbound session held raw values: route_plan as %7B%22type%22..., and +45... numbers as %2B45.... Later CHANNEL_DATA and execute-complete updates go through the event body and were decoded, so the bug showed only in values read before a verb ran. Response#decoded_headers decodes the values, and Outbound#run_session uses it for the connect reply only. Other replies' headers are not encoded.
FreeSWITCH URL-encodes exactly two things on the event socket, both with switch_event_serialize(..., SWITCH_TRUE): an event's header values (text/event-plain) and the channel data in the connect reply. Everything else (command/reply, api/response, log/data, disconnect notices) is written raw. Response decoded the header lines of any body, so a literal %2B in a log line would have come out as +. Bodies are now decoded only for text/event-plain.
A reply that FreeSWITCH builds from a whole event carries Event-Name; its reply to connect is the channel data (Event-Name: CHANNEL_DATA). Response now URL-decodes the headers of such a reply, so the outbound listener no longer has to know which reply to decode, and decoded_headers goes.
This was referenced Oct 1, 2026
Member
Author
|
Folded into #25, which collects these changes in one PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make librevox URL-decode exactly what FreeSWITCH URL-encodes, and nothing else.
FreeSWITCH encodes values in two places on the event socket, both written with
switch_event_serialize(…, SWITCH_TRUE), which runsswitch_url_encodeon every header value (v1.10.12):text/event-plainbody: the event's headerscommand/replytoconnect: the channel data, in the reply's headerscommand/reply(Reply-Text,Job-UUID)api/response,log/data,text/disconnect-notice,auth/requestThe changes:
route_planas%7B%22type%22…and+45…numbers as%2B45….Responsenow recognizes a reply that FreeSWITCH built from a whole event: it carriesEvent-Name, and theconnectreply isEvent-Name: CHANNEL_DATA. It decodes that reply's headers, so no caller has to know which reply it was.Responsedecoded the header lines of any body, so a literal%2Bin a log line or a reply came out as+. Bodies are now decoded only fortext/event-plain.Reply headers stay raw, as before. FreeSWITCH's own C client (
esl.c) URL-decodes every header value of every message, but that is a shortcut on its side: FreeSWITCH doesn't encode those headers, and decoding them would corrupt a literal%xx.Tests:
route_planand a%2Bnumber in the connect reply come out decoded, and so does any reply carryingEvent-Name.log/databody and a reply body with a literal%2Bstay raw.Stacked on #19.