Skip to content

[mod_sofia] Pass api_on_ prefix to switch_channel_api_on in sofia_glue_set_extra_headers - #3131

Open
jacky-w-j-li wants to merge 1 commit into
signalwire:masterfrom
jacky-w-j-li:fix-sofia-execute-on-sip-prefix-api-on
Open

[mod_sofia] Pass api_on_ prefix to switch_channel_api_on in sofia_glue_set_extra_headers#3131
jacky-w-j-li wants to merge 1 commit into
signalwire:masterfrom
jacky-w-j-li:fix-sofia-execute-on-sip-prefix-api-on

Conversation

@jacky-w-j-li

Copy link
Copy Markdown

sofia_glue_set_extra_headers() built a single execute_on_<prefix>prefix variable name and passed it to both switch_channel_execute_on() and switch_channel_api_on().

Both functions match channel variables by prefix (strncasecmp(var, variable_prefix, strlen(variable_prefix)) in src/switch_channel.c), so switch_channel_api_on() also matched the execute_on_* variables and ran their values a second time as API commands. API commands have no session context, so scripts invoked this way saw a NULL session, and any logic in an execute_on_sip_ph_prefix / execute_on_sip_rh_prefix (and other SIP header prefix) hook ran twice per SIP message.

Build the api_on_<prefix>prefix variable name before calling switch_channel_api_on(), matching the pattern already used for execute_on_sip_extra_headers / api_on_sip_extra_headers just below.

Resolves: #3005

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FreeSWITCH Bug Report: execute_on_sip_ph_prefix Hook Triggers API Execution Without Session

1 participant