[mod_sofia] Add db-spin-up-wait-ms profile parameter.

This commit is contained in:
Dmitry Ukolov 2022-10-06 13:15:41 +04:00 committed by GitHub
parent 9c7c77e259
commit c6452cc8da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -239,6 +239,9 @@
<!-- Or, if you have PGSQL support, you can use that --> <!-- Or, if you have PGSQL support, you can use that -->
<!--<param name="odbc-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />--> <!--<param name="odbc-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitch user=freeswitch password='' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />-->
<!-- By default each profile will give the database 1000 ms to spin-up on load -->
<!--<param name="db-spin-up-wait-ms" value="1000" />-->
<!--Uncomment to set all inbound calls to no media mode--> <!--Uncomment to set all inbound calls to no media mode-->
<!--<param name="inbound-bypass-media" value="true"/>--> <!--<param name="inbound-bypass-media" value="true"/>-->

View File

@ -727,6 +727,7 @@ struct sofia_profile {
uint32_t max_recv_requests_per_second; uint32_t max_recv_requests_per_second;
uint32_t rtp_timeout_sec; uint32_t rtp_timeout_sec;
uint32_t rtp_hold_timeout_sec; uint32_t rtp_hold_timeout_sec;
uint32_t db_spin_up_wait_ms;
char *odbc_dsn; char *odbc_dsn;
char *pre_trans_execute; char *pre_trans_execute;
char *post_trans_execute; char *post_trans_execute;

View File

@ -4650,6 +4650,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_2; profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_2;
profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_3; profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_3;
profile->tls_timeout = 300; profile->tls_timeout = 300;
profile->db_spin_up_wait_ms = 1000;
profile->mflags = MFLAG_REFER | MFLAG_REGISTER; profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
profile->server_rport_level = 1; profile->server_rport_level = 1;
profile->client_rport_level = 1; profile->client_rport_level = 1;
@ -4788,6 +4789,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
} }
} else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) { } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
profile->odbc_dsn = switch_core_strdup(profile->pool, val); profile->odbc_dsn = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "db-spin-up-wait-ms") && !zstr(val)) {
profile->db_spin_up_wait_ms = atoi(val);
} else if (!strcasecmp(var, "db-pre-trans-execute") && !zstr(val)) { } else if (!strcasecmp(var, "db-pre-trans-execute") && !zstr(val)) {
profile->pre_trans_execute = switch_core_strdup(profile->pool, val); profile->pre_trans_execute = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "db-post-trans-execute") && !zstr(val)) { } else if (!strcasecmp(var, "db-post-trans-execute") && !zstr(val)) {
@ -6351,7 +6354,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
launch_sofia_profile_thread(profile); launch_sofia_profile_thread(profile);
if (profile->odbc_dsn) { if (profile->odbc_dsn) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Connecting ODBC Profile %s [%s]\n", profile->name, url); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Connecting ODBC Profile %s [%s]\n", profile->name, url);
switch_yield(1000000); switch_yield(profile->db_spin_up_wait_ms * 1000);
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Started Profile %s [%s]\n", profile->name, url); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Started Profile %s [%s]\n", profile->name, url);
} }