[asterisk-commits] oej: branch group/set-tonezone-1.4 r285525 - /team/group/set-tonezone-1.4/cha...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 8 14:51:49 CDT 2010


Author: oej
Date: Wed Sep  8 14:51:44 2010
New Revision: 285525

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=285525
Log:
Adding a global setting as well.

First I did not want to do this, as we have a global setting in indications.conf
but then I thought that one would want a separate default setting in chan_sip
from the default Asteirsk one, and have that as a default for all devices. So I gave up
my resistance. Tough story. Simple patch.

Modified:
    team/group/set-tonezone-1.4/channels/chan_sip.c

Modified: team/group/set-tonezone-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/set-tonezone-1.4/channels/chan_sip.c?view=diff&rev=285525&r1=285524&r2=285525
==============================================================================
--- team/group/set-tonezone-1.4/channels/chan_sip.c (original)
+++ team/group/set-tonezone-1.4/channels/chan_sip.c Wed Sep  8 14:51:44 2010
@@ -541,6 +541,7 @@
                                                     *   a bridged channel on hold */
 static int default_maxcallbitrate;	/*!< Maximum bitrate for call */
 static struct ast_codec_pref default_prefs;		/*!< Default codec prefs */
+static struct tone_zone *default_zone;	/*!< Global tone zone for indications generate by Asterisk (not Dahdi) */
 
 /* Global settings only apply to the channel */
 static int global_directrtpsetup;	/*!< Enable support for Direct RTP setup (no re-invites) */
@@ -4778,6 +4779,7 @@
 	p->subscribed = NONE;
 	p->stateid = -1;
 	p->prefs = default_prefs;		/* Set default codecs for this call */
+	p->zone = default_zone;			/* Set default tone zone */
 
 	if (intended_method != SIP_OPTIONS)	/* Peerpoke has it's own system */
 		p->timer_t1 = 500;	/* Default SIP retransmission timer T1 (RFC 3261) */
@@ -11605,6 +11607,7 @@
 	ast_cli(fd, "  Use ClientCode:         %s\n", ast_test_flag(&global_flags[0], SIP_USECLIENTCODE) ? "Yes" : "No");
 	ast_cli(fd, "  Progress inband:        %s\n", (ast_test_flag(&global_flags[0], SIP_PROG_INBAND) == SIP_PROG_INBAND_NEVER) ? "Never" : (ast_test_flag(&global_flags[0], SIP_PROG_INBAND) == SIP_PROG_INBAND_NO) ? "No" : "Yes" );
 	ast_cli(fd, "  Language:               %s\n", S_OR(default_language, "(Defaults to English)"));
+	ast_cli(fd, "  Tone zone:              %s\n", default_zone != NULL ? default_zone->country : "<Not set>");
 	ast_cli(fd, "  MOH Interpret:          %s\n", default_mohinterpret);
 	ast_cli(fd, "  MOH Suggest:            %s\n", default_mohsuggest);
 	ast_cli(fd, "  Voice Mail Extension:   %s\n", default_vmexten);
@@ -17909,6 +17912,7 @@
 	user->maxcallbitrate = default_maxcallbitrate;
 	user->autoframing = global_autoframing;
 	user->prefs = default_prefs;
+	user->zone = default_zone;
 	/* set default context */
 	strcpy(user->context, default_context);
 	strcpy(user->language, default_language);
@@ -18048,6 +18052,7 @@
 	peer->pickupgroup = 0;
 	peer->maxms = default_qualify;
 	peer->prefs = default_prefs;
+	peer->zone = default_zone;
 }
 
 /*! \brief Create temporary peer (used in autocreatepeer mode) */
@@ -18550,6 +18555,7 @@
 	default_language[0] = '\0';
 	default_fromdomain[0] = '\0';
 	default_qualify = DEFAULT_QUALIFY;
+	default_zone = NULL;
 	default_maxcallbitrate = DEFAULT_MAX_CALL_BITRATE;
 	ast_copy_string(default_mohinterpret, DEFAULT_MOHINTERPRET, sizeof(default_mohinterpret));
 	ast_copy_string(default_mohsuggest, DEFAULT_MOHSUGGEST, sizeof(default_mohsuggest));
@@ -18668,6 +18674,13 @@
 			ast_copy_string(default_mohinterpret, v->value, sizeof(default_mohinterpret));
 		} else if (!strcasecmp(v->name, "mohsuggest")) {
 			ast_copy_string(default_mohsuggest, v->value, sizeof(default_mohsuggest));
+		} else if (!strcasecmp(v->name, "tonezone")) {
+			struct tone_zone *new_zone;
+			if (!(new_zone = ast_get_indication_zone(v->value))) {
+				ast_log(LOG_ERROR, "Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n", v->value);
+			} else {
+				default_zone = new_zone;
+			}
 		} else if (!strcasecmp(v->name, "language")) {
 			ast_copy_string(default_language, v->value, sizeof(default_language));
 		} else if (!strcasecmp(v->name, "regcontext")) {




More information about the asterisk-commits mailing list