forked from Mirrors/freeswitch
[mod_sofia] Multiple identity headers are partially implemented and duplicating the Identity header should not be allowed.
This commit is contained in:
parent
792eee44d0
commit
9cc7c2d581
|
@ -6350,7 +6350,8 @@ SWITCH_STANDARD_APP(sofia_stir_shaken_vs_function)
|
|||
stir_shaken_cert_t *cert = NULL;
|
||||
stir_shaken_error_t stir_error = { 0 };
|
||||
switch_status_t claim_status = SWITCH_STATUS_FALSE;
|
||||
const char *identity_header = switch_channel_get_variable(channel, "sip_h_identity");
|
||||
/* sip_identity channel variable is an ARRAY, we support only first identity for now */
|
||||
const char *identity_header = switch_channel_get_variable_dup(channel, "sip_identity", SWITCH_TRUE, 0);
|
||||
const char *attestation = NULL;
|
||||
int orig_is_tn = 0;
|
||||
switch_bool_t hangup_on_fail = switch_true(switch_channel_get_variable(channel, "sip_stir_shaken_vs_hangup_on_fail"));
|
||||
|
|
|
@ -11500,9 +11500,6 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
|
|||
}
|
||||
}
|
||||
|
||||
if (sip->sip_identity && sip->sip_identity->id_value) {
|
||||
switch_channel_set_variable(channel, "sip_h_identity", sip->sip_identity->id_value);
|
||||
}
|
||||
if (sip->sip_date && sip->sip_date->d_time > 0) {
|
||||
// This INVITE has a SIP Date header.
|
||||
// sofia-sip stores the Date header value in sip_date->d_time as seconds since January 1, 1900 0:00:00.
|
||||
|
|
|
@ -1144,7 +1144,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
|||
identity = identity_to_free = sofia_stir_shaken_as_create_identity_header(tech_pvt->session, stir_shaken_attest, cid_num, dest);
|
||||
}
|
||||
if (!identity) {
|
||||
identity = switch_channel_get_variable(channel, "sip_h_identity");
|
||||
/* sip_identity channel variable is an ARRAY, we support only first identity for now */
|
||||
identity = switch_channel_get_variable_dup(channel, "sip_identity", SWITCH_TRUE, 0);
|
||||
}
|
||||
if (!date) {
|
||||
date = switch_channel_get_variable(channel, "sip_h_date");
|
||||
|
|
|
@ -145,8 +145,8 @@
|
|||
<context name="default">
|
||||
<extension name="two">
|
||||
<condition field="destination_number" expression="^\+15553332901$">
|
||||
<action application="log" data="${sip_h_identity}"/>
|
||||
<action application="hash" data="insert/realm/identity_check/${sip_h_identity}"/>
|
||||
<action application="log" data="${sip_identity}"/>
|
||||
<action application="hash" data="insert/realm/identity_check/${sip_identity}"/>
|
||||
<action application="answer"/>
|
||||
<action application="park"/>
|
||||
</condition>
|
||||
|
|
|
@ -145,8 +145,8 @@
|
|||
<context name="default">
|
||||
<extension name="two">
|
||||
<condition field="destination_number" expression="^\+15553332901$">
|
||||
<action application="log" data="${sip_h_identity}"/>
|
||||
<action application="hash" data="insert/realm/identity_check/${sip_h_identity}"/>
|
||||
<action application="log" data="${sip_identity}"/>
|
||||
<action application="hash" data="insert/realm/identity_check/${sip_identity}"/>
|
||||
<action application="answer"/>
|
||||
<action application="park"/>
|
||||
</condition>
|
||||
|
|
|
@ -113,6 +113,20 @@ FST_CORE_BEGIN("./conf")
|
|||
}
|
||||
FST_TEARDOWN_END()
|
||||
|
||||
FST_SESSION_BEGIN(test_var_array)
|
||||
{
|
||||
const char *identity;
|
||||
|
||||
switch_channel_add_variable_var_check(fst_channel, "sip_identity", "test", SWITCH_FALSE, SWITCH_STACK_PUSH);
|
||||
identity = switch_channel_get_variable_dup(fst_channel, "sip_identity", SWITCH_TRUE, 0);
|
||||
fst_check_string_equals(identity, "test");
|
||||
|
||||
switch_channel_add_variable_var_check(fst_channel, "sip_identity", "test2", SWITCH_FALSE, SWITCH_STACK_PUSH);
|
||||
identity = switch_channel_get_variable_dup(fst_channel, "sip_identity", SWITCH_TRUE, 0);
|
||||
fst_check_string_equals(identity, "test");
|
||||
}
|
||||
FST_SESSION_END()
|
||||
|
||||
FST_TEST_BEGIN(originate_test_external_id)
|
||||
{
|
||||
switch_core_session_t *session = NULL;
|
||||
|
|
Loading…
Reference in New Issue