mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 05:02:10 +00:00
FS-4681 --resolve
This commit is contained in:
@@ -204,18 +204,20 @@ struct str_node {
|
||||
struct str_node *next;
|
||||
};
|
||||
|
||||
SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_name, const char *var_val, switch_call_cause_t cause)
|
||||
SWITCH_DECLARE(uint32_t) switch_core_session_hupall_matching_var_ans(const char *var_name, const char *var_val, switch_call_cause_t cause,
|
||||
switch_hup_type_t type)
|
||||
{
|
||||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
switch_core_session_t *session;
|
||||
switch_memory_pool_t *pool;
|
||||
struct str_node *head = NULL, *np;
|
||||
uint32_t r = 0;
|
||||
|
||||
switch_core_new_memory_pool(&pool);
|
||||
|
||||
if (!var_val)
|
||||
return;
|
||||
return r;
|
||||
|
||||
switch_mutex_lock(runtime.session_hash_mutex);
|
||||
for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
|
||||
@@ -223,10 +225,13 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
|
||||
if (val) {
|
||||
session = (switch_core_session_t *) val;
|
||||
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
|
||||
np = switch_core_alloc(pool, sizeof(*np));
|
||||
np->str = switch_core_strdup(pool, session->uuid_str);
|
||||
np->next = head;
|
||||
head = np;
|
||||
int ans = switch_channel_test_flag(switch_core_session_get_channel(session), CF_ANSWERED);
|
||||
if ((ans && (type & SHT_ANSWERED)) || (!ans && (type & SHT_UNANSWERED))) {
|
||||
np = switch_core_alloc(pool, sizeof(*np));
|
||||
np->str = switch_core_strdup(pool, session->uuid_str);
|
||||
np->next = head;
|
||||
head = np;
|
||||
}
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
}
|
||||
@@ -239,6 +244,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
|
||||
if (switch_channel_up_nosig(session->channel) &&
|
||||
(this_val = switch_channel_get_variable(session->channel, var_name)) && (!strcmp(this_val, var_val))) {
|
||||
switch_channel_hangup(session->channel, cause);
|
||||
r++;
|
||||
}
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
@@ -246,6 +252,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
|
||||
|
||||
switch_core_destroy_memory_pool(&pool);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user