From 9abb9bb3a0cc4e27b09a4855a241bc694df69e59 Mon Sep 17 00:00:00 2001 From: Howell Yan <1726474652@qq.com> Date: Sun, 15 Oct 2023 21:59:26 +0800 Subject: [PATCH 1/4] feat: specify rtp ip by variable --- src/mod/endpoints/mod_sofia/mod_sofia.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index f58bb40ac0..f05bea20dd 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5026,6 +5026,12 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session sofia_glue_attach_private(nsession, profile, tech_pvt, dest); + // specify rtp ip by variable + if (!zstr(switch_event_get_header(var_event, "rtp_ip_v4"))) { + tech_pvt->mparams.rtpip4 = switch_core_strdup(profile->pool, switch_event_get_header(var_event, "rtp_ip_v4")); + tech_pvt->mparams.rtpip = tech_pvt->mparams.rtpip4; + } + if (tech_pvt->local_url) { switch_channel_set_variable(nchannel, "sip_local_url", tech_pvt->local_url); if (profile->pres_type) { From 536feccfa0e7216f24831d89559bc644c0bcf32f Mon Sep 17 00:00:00 2001 From: Howell Yan <1726474652@qq.com> Date: Mon, 16 Oct 2023 21:45:07 +0800 Subject: [PATCH 2/4] Update mod_sofia.c --- src/mod/endpoints/mod_sofia/mod_sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index f05bea20dd..dff5d2e2c1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5027,7 +5027,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session sofia_glue_attach_private(nsession, profile, tech_pvt, dest); // specify rtp ip by variable - if (!zstr(switch_event_get_header(var_event, "rtp_ip_v4"))) { + if (!zstr(tech_pvt->mparams) && !zstr(switch_event_get_header(var_event, "rtp_ip_v4"))) { tech_pvt->mparams.rtpip4 = switch_core_strdup(profile->pool, switch_event_get_header(var_event, "rtp_ip_v4")); tech_pvt->mparams.rtpip = tech_pvt->mparams.rtpip4; } From d7fc2c1c64d050a661f1137ca2642e44d283cb88 Mon Sep 17 00:00:00 2001 From: Howell Yan <1726474652@qq.com> Date: Mon, 16 Oct 2023 21:57:02 +0800 Subject: [PATCH 3/4] Update mod_sofia.c --- src/mod/endpoints/mod_sofia/mod_sofia.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index dff5d2e2c1..12a21c3f2d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5027,10 +5027,10 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session sofia_glue_attach_private(nsession, profile, tech_pvt, dest); // specify rtp ip by variable - if (!zstr(tech_pvt->mparams) && !zstr(switch_event_get_header(var_event, "rtp_ip_v4"))) { - tech_pvt->mparams.rtpip4 = switch_core_strdup(profile->pool, switch_event_get_header(var_event, "rtp_ip_v4")); - tech_pvt->mparams.rtpip = tech_pvt->mparams.rtpip4; - } + // if (!zstr(tech_pvt->mparams) && !zstr(switch_event_get_header(var_event, "rtp_ip_v4"))) { + // tech_pvt->mparams.rtpip4 = switch_core_strdup(profile->pool, switch_event_get_header(var_event, "rtp_ip_v4")); + // tech_pvt->mparams.rtpip = tech_pvt->mparams.rtpip4; + // } if (tech_pvt->local_url) { switch_channel_set_variable(nchannel, "sip_local_url", tech_pvt->local_url); From 30c21a891f9c70f9c58122a1d03aa03fedf25243 Mon Sep 17 00:00:00 2001 From: Howell Date: Mon, 16 Oct 2023 22:41:34 +0800 Subject: [PATCH 4/4] [mod_sofia] specify rtp ip by variable --- src/mod/endpoints/mod_sofia/mod_sofia.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 12a21c3f2d..586d6358b1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5026,12 +5026,12 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session sofia_glue_attach_private(nsession, profile, tech_pvt, dest); - // specify rtp ip by variable - // if (!zstr(tech_pvt->mparams) && !zstr(switch_event_get_header(var_event, "rtp_ip_v4"))) { - // tech_pvt->mparams.rtpip4 = switch_core_strdup(profile->pool, switch_event_get_header(var_event, "rtp_ip_v4")); - // tech_pvt->mparams.rtpip = tech_pvt->mparams.rtpip4; - // } - + // specify rtp ip by variable + if (switch_true(switch_event_get_header(var_event, "rtp_ip_v4"))) { + tech_pvt->mparams.rtpip4 = switch_core_strdup(profile->pool, switch_event_get_header(var_event, "rtp_ip_v4")); + tech_pvt->mparams.rtpip = tech_pvt->mparams.rtpip4; + } + if (tech_pvt->local_url) { switch_channel_set_variable(nchannel, "sip_local_url", tech_pvt->local_url); if (profile->pres_type) {