Skip to content

Commit

Permalink
Merge branch 'telnyx/telephony/development' into telnyx/telephony/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Elhodred committed Feb 13, 2024
2 parents 61fe418 + 79b1e1f commit c459bd4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/mod/endpoints/mod_sofia/mod_sofia.h
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ struct sofia_profile {
sofia_gateway_t *gateways;
sofia_gateway_t *next_check_gateway_ptr;
unsigned int gateway_reg_max_cps;
unsigned int gateway_shutdown_reg_max_cps;
unsigned int gateway_unreg_max_yield_ms;
//su_home_t *home;
switch_hash_t *chat_hash;
Expand Down
6 changes: 4 additions & 2 deletions src/mod/endpoints/mod_sofia/sofia.c
Original file line number Diff line number Diff line change
Expand Up @@ -3672,7 +3672,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
/* Mark all gateways as deleted and set REG_STATE_UNREGISTER state on REG gateways */
sofia_glue_del_every_gateway(profile);
/* This prevent doing batch request for reg check */
profile->gateway_reg_max_cps = 0;
profile->gateway_reg_max_cps = profile->gateway_shutdown_reg_max_cps;
/* First call will unregister and set state to DOWN so a gateway is ready for deletion */
sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL));
sofia_sub_check_gateway(profile, switch_epoch_time_now(NULL));
Expand Down Expand Up @@ -3981,7 +3981,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag,

switch_mutex_lock(mod_sofia_globals.hash_mutex);
if ((gp = switch_core_hash_find(mod_sofia_globals.gateway_hash, name)) && (gp = switch_core_hash_find(mod_sofia_globals.gateway_hash, pkey)) && !gp->deleted) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring duplicate gateway '%s'\n", name);
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring duplicate gateway '%s'\n", name);
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
free(pkey);
goto skip;
Expand Down Expand Up @@ -5860,6 +5860,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
profile->max_auth_validity = atoi(val);
} else if (!strcasecmp(var, "gateway-reg-max-cps")) {
profile->gateway_reg_max_cps = atoi(val);
} else if (!strcasecmp(var, "gateway-shutdown-reg-max-cps")) {
profile->gateway_shutdown_reg_max_cps = atoi(val);
} else if (!strcasecmp(var, "auth-require-user")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_AUTH_REQUIRE_USER);
Expand Down
4 changes: 4 additions & 0 deletions src/mod/endpoints/mod_sofia/sofia_reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2747,6 +2747,10 @@ void sofia_reg_handle_sip_r_register(int status,
if (!sofia_test_flag(gateway, REG_FLAG_REGISTERED)) {
sofia_set_flag(gateway, REG_FLAG_REGISTERED);
}
if (gateway->status != SOFIA_GATEWAY_UP) {
gateway->status = SOFIA_GATEWAY_UP;
gateway->uptime = switch_time_now();
}
gateway->state = REG_STATE_REGISTER;
break;
case 100:
Expand Down

0 comments on commit c459bd4

Please sign in to comment.