<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19495">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span></span><br></pre><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: return all codecs on a re-INVITE without SDP<br><br>Currently chan_pjsip on receiving a re-INVITE without SDP will only<br>return the codecs that are previously negotiated and not offering<br>all enabled codecs.<br><br>This causes interoperability issues with different equipment (e.g.<br>from Cisco) for some of our customers and probably also in other<br>scenarios involving 3PCC infrastructure.<br><br>According to RFC 3261, section 14.2 we SHOULD return all codecs<br>on a re-INVITE without SDP<br><br>The PR proposes a new parameter to configure this behaviour:<br>all_codecs_on_empty_reinvite. It includes the code, documentation,<br>alembic migrations, CHANGES file and example configuration additions.<br><br>ASTERISK-30193 #close<br><br>Change-Id: I69763708d5039d512f391e296ee8a4d43a1e2148<br>---<br>M configs/samples/pjsip.conf.sample<br>A contrib/ast-db-manage/config/versions/ccf795ee535f_all_codecs_on_empty_reinvite.py<br>A doc/CHANGES-staging/res_pjsip_all_codecs_on_empty_reinvite_option.txt<br>M include/asterisk/res_pjsip.h<br>M res/res_pjsip/config_global.c<br>M res/res_pjsip/pjsip_config.xml<br>M res/res_pjsip_session.c<br>7 files changed, 157 insertions(+), 12 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample</span><br><span>index 6fbdb8b..b6a9cd0 100644</span><br><span>--- a/configs/samples/pjsip.conf.sample</span><br><span>+++ b/configs/samples/pjsip.conf.sample</span><br><span>@@ -1336,6 +1336,13 @@</span><br><span> ; creating an implicit subscription (see RFC 4488).</span><br><span> ; (default: "yes")</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+;all_codecs_on_empty_reinvite=yes</span><br><span style="color: hsl(120, 100%, 40%);">+ ; On reception of a re-INVITE without SDP Asterisk will send an SDP</span><br><span style="color: hsl(120, 100%, 40%);">+ ; offer in the 200 OK response containing all configured codecs on the</span><br><span style="color: hsl(120, 100%, 40%);">+ ; endpoint, instead of simply those that have already been negotiated.</span><br><span style="color: hsl(120, 100%, 40%);">+ ; RFC 3261 specifies this as a SHOULD requirement.</span><br><span style="color: hsl(120, 100%, 40%);">+ ; (default: "no")</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> ;allow_sending_180_after_183=yes ; Allow Asterisk to send 180 Ringing to an endpoint</span><br><span> ; after 183 Session Progress has been send.</span><br><span> ; If disabled Asterisk will instead send only a</span><br><span>diff --git a/contrib/ast-db-manage/config/versions/ccf795ee535f_all_codecs_on_empty_reinvite.py b/contrib/ast-db-manage/config/versions/ccf795ee535f_all_codecs_on_empty_reinvite.py</span><br><span>new file mode 100644</span><br><span>index 0000000..125684f</span><br><span>--- /dev/null</span><br><span>+++ b/contrib/ast-db-manage/config/versions/ccf795ee535f_all_codecs_on_empty_reinvite.py</span><br><span>@@ -0,0 +1,37 @@</span><br><span style="color: hsl(120, 100%, 40%);">+"""all_codecs_on_empty_reinvite</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Revision ID: ccf795ee535f</span><br><span style="color: hsl(120, 100%, 40%);">+Revises: 539f68bede2c</span><br><span style="color: hsl(120, 100%, 40%);">+Create Date: 2022-09-28 09:14:36.709781</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+"""</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# revision identifiers, used by Alembic.</span><br><span style="color: hsl(120, 100%, 40%);">+revision = 'ccf795ee535f'</span><br><span style="color: hsl(120, 100%, 40%);">+down_revision = '417c0247fd7e'</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+from alembic import op</span><br><span style="color: hsl(120, 100%, 40%);">+import sqlalchemy as sa</span><br><span style="color: hsl(120, 100%, 40%);">+from sqlalchemy.dialects.postgresql import ENUM</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+AST_BOOL_NAME = 'ast_bool_values'</span><br><span style="color: hsl(120, 100%, 40%);">+# We'll just ignore the n/y and f/t abbreviations as Asterisk does not write</span><br><span style="color: hsl(120, 100%, 40%);">+# those aliases.</span><br><span style="color: hsl(120, 100%, 40%);">+AST_BOOL_VALUES = [ '0', '1',</span><br><span style="color: hsl(120, 100%, 40%);">+ 'off', 'on',</span><br><span style="color: hsl(120, 100%, 40%);">+ 'false', 'true',</span><br><span style="color: hsl(120, 100%, 40%);">+ 'no', 'yes' ]</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+def upgrade():</span><br><span style="color: hsl(120, 100%, 40%);">+ ############################# Enums ##############################</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # ast_bool_values has already been created, so use postgres enum object</span><br><span style="color: hsl(120, 100%, 40%);">+ # type to get around "already created" issue - works okay with mysql</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ op.add_column('ps_globals', sa.Column('all_codecs_on_empty_reinvite', ast_bool_values))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+def downgrade():</span><br><span style="color: hsl(120, 100%, 40%);">+ if op.get_context().bind.dialect.name == 'mssql':</span><br><span style="color: hsl(120, 100%, 40%);">+ op.drop_constraint('ck_ps_globals_all_codecs_on_empty_reinvite_ast_bool_values', 'ps_globals')</span><br><span style="color: hsl(120, 100%, 40%);">+ op.drop_column('ps_globals', 'all_codecs_on_empty_reinvite')</span><br><span>diff --git a/doc/CHANGES-staging/res_pjsip_all_codecs_on_empty_reinvite_option.txt b/doc/CHANGES-staging/res_pjsip_all_codecs_on_empty_reinvite_option.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..99eccbb</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/res_pjsip_all_codecs_on_empty_reinvite_option.txt</span><br><span>@@ -0,0 +1,8 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: res_pjsip</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+A new option named "all_codecs_on_empty_reinvite" has been added to the</span><br><span style="color: hsl(120, 100%, 40%);">+global section. When this option is enabled, on reception of a re-INVITE</span><br><span style="color: hsl(120, 100%, 40%);">+without SDP, Asterisk will send an SDP offer in the 200 OK response containing</span><br><span style="color: hsl(120, 100%, 40%);">+all configured codecs on the endpoint, instead of simply those that have</span><br><span style="color: hsl(120, 100%, 40%);">+already been negotiated. RFC 3261 specifies this as a SHOULD requirement.</span><br><span style="color: hsl(120, 100%, 40%);">+The default value is "off".</span><br><span>\ No newline at end of file</span><br><span>diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h</span><br><span>index 743b19f..d207297 100644</span><br><span>--- a/include/asterisk/res_pjsip.h</span><br><span>+++ b/include/asterisk/res_pjsip.h</span><br><span>@@ -3902,4 +3902,11 @@</span><br><span> */</span><br><span> struct pjsip_param *ast_sip_pjsip_uri_get_other_param(pjsip_uri *uri, const pj_str_t *param_str);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Retrieve the system setting 'all_codecs_on_empty_reinvite'.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \retval non zero if we should return all codecs on empty re-INVITE</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+unsigned int ast_sip_get_all_codecs_on_empty_reinvite(void);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #endif /* _RES_PJSIP_H */</span><br><span>diff --git a/res/res_pjsip/config_global.c b/res/res_pjsip/config_global.c</span><br><span>index 4620c3f..5a71b48 100644</span><br><span>--- a/res/res_pjsip/config_global.c</span><br><span>+++ b/res/res_pjsip/config_global.c</span><br><span>@@ -54,6 +54,7 @@</span><br><span> #define DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION 0</span><br><span> #define DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER TASKPROCESSOR_OVERLOAD_TRIGGER_GLOBAL</span><br><span> #define DEFAULT_NOREFERSUB 1</span><br><span style="color: hsl(120, 100%, 40%);">+#define DEFAULT_ALL_CODECS_ON_EMPTY_REINVITE 0</span><br><span> </span><br><span> /*!</span><br><span> * \brief Cached global config object</span><br><span>@@ -119,6 +120,8 @@</span><br><span> enum ast_sip_taskprocessor_overload_trigger overload_trigger;</span><br><span> /*! Nonzero if norefersub is to be sent in Supported header */</span><br><span> unsigned int norefersub;</span><br><span style="color: hsl(120, 100%, 40%);">+ /*! Nonzero if we should return all codecs on empty re-INVITE */</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int all_codecs_on_empty_reinvite;</span><br><span> };</span><br><span> </span><br><span> static void global_destructor(void *obj)</span><br><span>@@ -537,6 +540,21 @@</span><br><span> return norefersub;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+unsigned int ast_sip_get_all_codecs_on_empty_reinvite(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int all_codecs_on_empty_reinvite;</span><br><span style="color: hsl(120, 100%, 40%);">+ struct global_config *cfg;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg = get_global_cfg();</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return DEFAULT_ALL_CODECS_ON_EMPTY_REINVITE;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ all_codecs_on_empty_reinvite = cfg->all_codecs_on_empty_reinvite;</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(cfg, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+ return all_codecs_on_empty_reinvite;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static int overload_trigger_handler(const struct aco_option *opt,</span><br><span> struct ast_variable *var, void *obj)</span><br><span> {</span><br><span>@@ -744,6 +762,9 @@</span><br><span> ast_sorcery_object_field_register(sorcery, "global", "norefersub",</span><br><span> DEFAULT_NOREFERSUB ? "yes" : "no",</span><br><span> OPT_YESNO_T, 1, FLDSET(struct global_config, norefersub));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sorcery_object_field_register(sorcery, "global", "all_codecs_on_empty_reinvite",</span><br><span style="color: hsl(120, 100%, 40%);">+ DEFAULT_ALL_CODECS_ON_EMPTY_REINVITE ? "yes" : "no",</span><br><span style="color: hsl(120, 100%, 40%);">+ OPT_BOOL_T, 1, FLDSET(struct global_config, all_codecs_on_empty_reinvite));</span><br><span> </span><br><span> if (ast_sorcery_instance_observer_add(sorcery, &observer_callbacks_global)) {</span><br><span> return -1;</span><br><span>diff --git a/res/res_pjsip/pjsip_config.xml b/res/res_pjsip/pjsip_config.xml</span><br><span>index 9e3b17d..7ef3c30 100644</span><br><span>--- a/res/res_pjsip/pjsip_config.xml</span><br><span>+++ b/res/res_pjsip/pjsip_config.xml</span><br><span>@@ -2435,6 +2435,15 @@</span><br><span> </para></span><br><span> </description></span><br><span> </configOption></span><br><span style="color: hsl(120, 100%, 40%);">+ <configOption name="all_codecs_on_empty_reinvite" default="no"></span><br><span style="color: hsl(120, 100%, 40%);">+ <synopsis>If we should return all codecs on re-INVITE without SDP</synopsis></span><br><span style="color: hsl(120, 100%, 40%);">+ <description><para></span><br><span style="color: hsl(120, 100%, 40%);">+ On reception of a re-INVITE without SDP Asterisk will send an SDP</span><br><span style="color: hsl(120, 100%, 40%);">+ offer in the 200 OK response containing all configured codecs on the</span><br><span style="color: hsl(120, 100%, 40%);">+ endpoint, instead of simply those that have already been negotiated.</span><br><span style="color: hsl(120, 100%, 40%);">+ RFC 3261 specifies this as a SHOULD requirement.</span><br><span style="color: hsl(120, 100%, 40%);">+ </para></description></span><br><span style="color: hsl(120, 100%, 40%);">+ </configOption></span><br><span> </configObject></span><br><span> </configFile></span><br><span> </configInfo></span><br><span>diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c</span><br><span>index fa3d813..c5890e0 100644</span><br><span>--- a/res/res_pjsip_session.c</span><br><span>+++ b/res/res_pjsip_session.c</span><br><span>@@ -102,7 +102,7 @@</span><br><span> char stream_type[1];</span><br><span> };</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static struct pjmedia_sdp_session *create_local_sdp(pjsip_inv_session *inv, struct ast_sip_session *session, const pjmedia_sdp_session *offer);</span><br><span style="color: hsl(120, 100%, 40%);">+static struct pjmedia_sdp_session *create_local_sdp(pjsip_inv_session *inv, struct ast_sip_session *session, const pjmedia_sdp_session *offer, const unsigned int ignore_active_stream_topology);</span><br><span> </span><br><span> static int sdp_handler_list_hash(const void *obj, int flags)</span><br><span> {</span><br><span>@@ -1631,7 +1631,7 @@</span><br><span> pjmedia_sdp_neg_get_active_local(inv_session->neg, &previous_sdp);</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- SCOPE_EXIT_RTN_VALUE(create_local_sdp(inv_session, session, previous_sdp));</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_RTN_VALUE(create_local_sdp(inv_session, session, previous_sdp, 0));</span><br><span> }</span><br><span> </span><br><span> static void set_from_header(struct ast_sip_session *session)</span><br><span>@@ -2556,7 +2556,7 @@</span><br><span> pjmedia_sdp_neg_set_remote_offer(inv_session->pool, inv_session->neg, previous_offer);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- new_answer = create_local_sdp(inv_session, session, previous_offer);</span><br><span style="color: hsl(120, 100%, 40%);">+ new_answer = create_local_sdp(inv_session, session, previous_offer, 0);</span><br><span> if (!new_answer) {</span><br><span> ast_log(LOG_WARNING, "Could not create a new local SDP answer for channel '%s'\n",</span><br><span> ast_channel_name(session->channel));</span><br><span>@@ -2850,7 +2850,7 @@</span><br><span> pjmedia_sdp_session *offer;</span><br><span> SCOPE_ENTER(1, "%s\n", ast_sip_session_get_name(session));</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(offer = create_local_sdp(session->inv_session, session, NULL))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!(offer = create_local_sdp(session->inv_session, session, NULL, 0))) {</span><br><span> pjsip_inv_terminate(session->inv_session, 500, PJ_FALSE);</span><br><span> SCOPE_EXIT_RTN_VALUE(-1, "Couldn't create offer\n");</span><br><span> }</span><br><span>@@ -4028,10 +4028,10 @@</span><br><span> goto end;</span><br><span> }</span><br><span> /* We are creating a local SDP which is an answer to their offer */</span><br><span style="color: hsl(0, 100%, 40%);">- local = create_local_sdp(invite->session->inv_session, invite->session, sdp_info->sdp);</span><br><span style="color: hsl(120, 100%, 40%);">+ local = create_local_sdp(invite->session->inv_session, invite->session, sdp_info->sdp, 0);</span><br><span> } else {</span><br><span> /* We are creating a local SDP which is an offer */</span><br><span style="color: hsl(0, 100%, 40%);">- local = create_local_sdp(invite->session->inv_session, invite->session, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ local = create_local_sdp(invite->session->inv_session, invite->session, NULL, 0);</span><br><span> }</span><br><span> </span><br><span> /* If we were unable to create a local SDP terminate the session early, it won't go anywhere */</span><br><span>@@ -5103,7 +5103,7 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static struct pjmedia_sdp_session *create_local_sdp(pjsip_inv_session *inv, struct ast_sip_session *session, const pjmedia_sdp_session *offer)</span><br><span style="color: hsl(120, 100%, 40%);">+static struct pjmedia_sdp_session *create_local_sdp(pjsip_inv_session *inv, struct ast_sip_session *session, const pjmedia_sdp_session *offer, const unsigned int ignore_active_stream_topology)</span><br><span> {</span><br><span> static const pj_str_t STR_IN = { "IN", 2 };</span><br><span> static const pj_str_t STR_IP4 = { "IP4", 3 };</span><br><span>@@ -5136,11 +5136,19 @@</span><br><span> /* We've encountered a situation where we have been told to create a local SDP but noone has given us any indication</span><br><span> * of what kind of stream topology they would like. We try to not alter the current state of the SDP negotiation</span><br><span> * by using what is currently negotiated. If this is unavailable we fall back to what is configured on the endpoint.</span><br><span style="color: hsl(120, 100%, 40%);">+ * We will also do this if wanted by the ignore_active_stream_topology flag.</span><br><span> */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "no information about stream topology received\n");</span><br><span> ast_stream_topology_free(session->pending_media_state->topology);</span><br><span style="color: hsl(0, 100%, 40%);">- if (session->active_media_state->topology) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (session->active_media_state->topology && !ignore_active_stream_topology) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "using existing topology\n");</span><br><span> session->pending_media_state->topology = ast_stream_topology_clone(session->active_media_state->topology);</span><br><span> } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ignore_active_stream_topology) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "fall back to endpoint configuration - ignore active stream topolog\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "fall back to endpoint configuration\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> session->pending_media_state->topology = ast_stream_topology_clone(session->endpoint->media.topology);</span><br><span> }</span><br><span> if (!session->pending_media_state->topology) {</span><br><span>@@ -5274,7 +5282,7 @@</span><br><span> SCOPE_EXIT_RTN("%s: handle_incoming_sdp failed\n", ast_sip_session_get_name(session));</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if ((answer = create_local_sdp(inv, session, offer))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if ((answer = create_local_sdp(inv, session, offer, 0))) {</span><br><span> pjsip_inv_set_sdp_answer(inv, answer);</span><br><span> SCOPE_EXIT_RTN("%s: Set SDP answer\n", ast_sip_session_get_name(session));</span><br><span> }</span><br><span>@@ -5287,6 +5295,7 @@</span><br><span> const pjmedia_sdp_session *previous_sdp = NULL;</span><br><span> pjmedia_sdp_session *offer;</span><br><span> int i;</span><br><span style="color: hsl(120, 100%, 40%);">+ unsigned int ignore_active_stream_topology = 0;</span><br><span> </span><br><span> /* We allow PJSIP to produce an SDP if no channel is present. This may result</span><br><span> * in an incorrect SDP occurring, but if no channel is present then we are in</span><br><span>@@ -5294,8 +5303,24 @@</span><br><span> * produce an SDP doesn't need to worry about a channel being present or not,</span><br><span> * just in case.</span><br><span> */</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_ENTER(3, "%s\n", ast_sip_session_get_name(session));</span><br><span> if (!session->channel) {</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_RTN("%s: No channel\n", ast_sip_session_get_name(session));</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Some devices send a re-INVITE offer with empty SDP. Asterisk by default return</span><br><span style="color: hsl(120, 100%, 40%);">+ * an answer with the current used codecs, which is not strictly compliant to RFC</span><br><span style="color: hsl(120, 100%, 40%);">+ * 3261 (SHOULD requirement). So we detect this condition and include all</span><br><span style="color: hsl(120, 100%, 40%);">+ * configured codecs in the answer if the workaround is activated.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (inv->invite_tsx && inv->state == PJSIP_INV_STATE_CONFIRMED</span><br><span style="color: hsl(120, 100%, 40%);">+ && inv->invite_tsx->method.id == PJSIP_INVITE_METHOD) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "re-INVITE\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ if (inv->invite_tsx->role == PJSIP_ROLE_UAS && !pjmedia_sdp_neg_was_answer_remote(inv->neg)</span><br><span style="color: hsl(120, 100%, 40%);">+ && ast_sip_get_all_codecs_on_empty_reinvite()) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "no codecs in re-INIVTE, include all codecs in the answer\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ ignore_active_stream_topology = 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> </span><br><span> if (inv->neg) {</span><br><span>@@ -5306,9 +5331,13 @@</span><br><span> }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- offer = create_local_sdp(inv, session, previous_sdp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ignore_active_stream_topology) {</span><br><span style="color: hsl(120, 100%, 40%);">+ offer = create_local_sdp(inv, session, NULL, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ offer = create_local_sdp(inv, session, previous_sdp, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> if (!offer) {</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_RTN("%s: create offer failed\n", ast_sip_session_get_name(session));</span><br><span> }</span><br><span> </span><br><span> ast_queue_unhold(session->channel);</span><br><span>@@ -5354,6 +5383,7 @@</span><br><span> }</span><br><span> </span><br><span> *p_offer = offer;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_RTN("%s: offer created\n", ast_sip_session_get_name(session));</span><br><span> }</span><br><span> </span><br><span> static void session_inv_on_media_update(pjsip_inv_session *inv, pj_status_t status)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19495">change 19495</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/19495"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 20 </div>
<div style="display:none"> Gerrit-Change-Id: I69763708d5039d512f391e296ee8a4d43a1e2148 </div>
<div style="display:none"> Gerrit-Change-Number: 19495 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Henning Westerholt <hw@gilawa.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>