diff options
author | jpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-22 19:23:49 +0000 |
---|---|---|
committer | jpeeler <jpeeler@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-04-22 19:23:49 +0000 |
commit | 6215cb1a97487a063be3e47b793715193780b037 (patch) | |
tree | 9dbf0884a1d572ace0052f7e0a4b7d232096cc47 /channels/chan_h323.c | |
parent | 81019545c2427f8d7d882681d3ec3833e13ee02f (diff) |
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: http://svn.digium.com/svn/asterisk/trunk@189993 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_h323.c')
-rw-r--r-- | channels/chan_h323.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 3f56fc29d..616b8f6a9 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -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; |