mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-20 11:43:52 +00:00
Make chan_h323 respect packetization settings and fix small reload issue.
Previously, packetization settings were ignored and now they are not. A new config option 'autoframing' has been added to mirror the way chan_sip handles it. Turning on the autoframing option (available both as a global option or per peer) overrides the local settings with the remote packetization settings. Testing was performed with varying packetization levels with the following codecs: ulaw, alaw, gsm, and g729. Also, an unrelated config reload issue has been fixed in the case of the config file not changing. (closes issue #12415) Reported by: pj Patches: 2009012200_h323packetization.diff.txt uploaded by mvanbaak (license 7), modified by me git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189993 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1251,6 +1251,8 @@ static int update_common_options(struct ast_variable *v, struct call_options *op
|
||||
|
||||
if (!strcasecmp(v->name, "allow")) {
|
||||
ast_parse_allow_disallow(&options->prefs, &options->capability, v->value, 1);
|
||||
} else if (!strcasecmp(v->name, "autoframing")) {
|
||||
options->autoframing = ast_true(v->value);
|
||||
} else if (!strcasecmp(v->name, "disallow")) {
|
||||
ast_parse_allow_disallow(&options->prefs, &options->capability, v->value, 0);
|
||||
} else if (!strcasecmp(v->name, "dtmfmode")) {
|
||||
@@ -2450,8 +2452,15 @@ static void set_peer_capabilities(unsigned call_reference, const char *token, in
|
||||
ast_debug(1, "prefs[%d]=%s:%d\n", i, (prefs->order[i] ? ast_getformatname(1 << (prefs->order[i]-1)) : "<none>"), prefs->framing[i]);
|
||||
}
|
||||
}
|
||||
if (pvt->rtp)
|
||||
ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, &pvt->peer_prefs);
|
||||
if (pvt->rtp) {
|
||||
if (pvt->options.autoframing) {
|
||||
ast_debug(2, "Autoframing option set, using peer's packetization settings\n");
|
||||
ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, &pvt->peer_prefs);
|
||||
} else {
|
||||
ast_debug(2, "Autoframing option not set, ignoring peer's packetization settings\n");
|
||||
ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, &pvt->options.prefs);
|
||||
}
|
||||
}
|
||||
}
|
||||
ast_mutex_unlock(&pvt->lock);
|
||||
}
|
||||
@@ -2475,8 +2484,15 @@ static void set_local_capabilities(unsigned call_reference, const char *token)
|
||||
ast_mutex_unlock(&pvt->lock);
|
||||
h323_set_capabilities(token, capability, dtmfmode, &prefs, pref_codec);
|
||||
|
||||
if (h323debug)
|
||||
if (h323debug) {
|
||||
int i;
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (!prefs.order[i])
|
||||
break;
|
||||
ast_debug(1, "local prefs[%d]=%s:%d\n", i, (prefs.order[i] ? ast_getformatname(1 << (prefs.order[i]-1)) : "<none>"), prefs.framing[i]);
|
||||
}
|
||||
ast_debug(1, "Capabilities for connection %s is set\n", token);
|
||||
}
|
||||
}
|
||||
|
||||
static void remote_hold(unsigned call_reference, const char *token, int is_hold)
|
||||
@@ -2838,7 +2854,7 @@ static int reload_config(int is_reload)
|
||||
return 0;
|
||||
}
|
||||
ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
|
||||
if ((cfg = ast_config_load(config, config_flags))) {
|
||||
if ((cfg = ast_config_load(config, config_flags)) == CONFIG_STATUS_FILEINVALID) {
|
||||
ast_log(LOG_ERROR, "Config file %s is in an invalid format. Aborting.\n", config);
|
||||
ast_config_destroy(ucfg);
|
||||
return 0;
|
||||
@@ -2878,6 +2894,7 @@ static int reload_config(int is_reload)
|
||||
global_options.holdHandling = 0;
|
||||
global_options.capability = GLOBAL_CAPABILITY;
|
||||
global_options.bridge = 1; /* Do native bridging by default */
|
||||
global_options.autoframing = 0;
|
||||
strcpy(default_context, "default");
|
||||
h323_signalling_port = 1720;
|
||||
gatekeeper_disable = 1;
|
||||
|
Reference in New Issue
Block a user