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"));
}
}
- 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.
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");
<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>
<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>
}
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;