[asterisk-commits] oej: branch oej/set-sip-tonezone-1.8 r383027 - in /team/oej/set-sip-tonezone-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 13 10:29:27 CDT 2013


Author: oej
Date: Wed Mar 13 10:29:23 2013
New Revision: 383027

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383027
Log:
Set tonezone for 1.8

Modified:
    team/oej/set-sip-tonezone-1.8/channels/chan_sip.c
    team/oej/set-sip-tonezone-1.8/channels/sip/include/sip.h
    team/oej/set-sip-tonezone-1.8/configs/sip.conf.sample
    team/oej/set-sip-tonezone-1.8/include/asterisk/indications.h

Modified: team/oej/set-sip-tonezone-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/set-sip-tonezone-1.8/channels/chan_sip.c?view=diff&rev=383027&r1=383026&r2=383027
==============================================================================
--- team/oej/set-sip-tonezone-1.8/channels/chan_sip.c (original)
+++ team/oej/set-sip-tonezone-1.8/channels/chan_sip.c Wed Mar 13 10:29:23 2013
@@ -264,6 +264,7 @@
 #include "asterisk/cel.h"
 #include "asterisk/data.h"
 #include "asterisk/aoc.h"
+#include "asterisk/indications.h"
 #include "sip/include/sip.h"
 #include "sip/include/globals.h"
 #include "sip/include/config_parser.h"
@@ -691,6 +692,7 @@
 static char default_engine[256];                   /*!< Default RTP engine */
 static int default_maxcallbitrate;                 /*!< Maximum bitrate for call */
 static struct ast_codec_pref default_prefs;        /*!< Default codec prefs */
+static char default_zone[MAX_TONEZONE_COUNTRY];        /*!< Default tone zone for channels created from the SIP driver */
 static unsigned int default_transports;            /*!< Default Transports (enum sip_transport) that are acceptable */
 static unsigned int default_primary_transport;     /*!< Default primary Transport (enum sip_transport) for outbound connections to devices */
 /*@}*/
@@ -5684,6 +5686,7 @@
 	ref_proxy(dialog, obproxy_get(dialog, peer));
 	dialog->callgroup = peer->callgroup;
 	dialog->pickupgroup = peer->pickupgroup;
+	ast_copy_string(dialog->zone, peer->zone, sizeof(dialog->zone));
 	dialog->allowtransfer = peer->allowtransfer;
 	dialog->jointnoncodeccapability = dialog->noncodeccapability;
 
@@ -7567,6 +7570,11 @@
 		tmp->amaflags = i->amaflags;
 	if (!ast_strlen_zero(i->language))
 		ast_string_field_set(tmp, language, i->language);
+ 	if (!ast_strlen_zero(i->zone)) {
+ 		if (!(tmp->zone = ast_get_indication_zone(i->zone))) {
+ 			ast_log(LOG_ERROR, "Unknown country code '%s' for tonezone. Check indications.conf for available country codes.\n", i->zone);
+ 		} 
+ 	}
 	i->owner = tmp;
 	ast_module_ref(ast_module_info->self);
 	ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
@@ -8120,6 +8128,7 @@
 	p->session_modify = TRUE;
 	p->stimer = NULL;
 	p->prefs = default_prefs;		/* Set default codecs for this call */
+	ast_copy_string(p->zone, default_zone, sizeof(p->zone));
 	p->maxforwards = sip_cfg.default_max_forwards;
 
 	if (intended_method != SIP_OPTIONS) {	/* Peerpoke has it's own system */
@@ -16646,6 +16655,7 @@
 		p->pickupgroup = peer->pickupgroup;
 		p->capability = peer->capability;
 		p->prefs = peer->prefs;
+ 		ast_copy_string(p->zone, peer->zone, sizeof(p->zone));
 		p->jointcapability = peer->capability;
  		if (peer->maxforwards > 0) {
 			p->maxforwards = peer->maxforwards;
@@ -18068,6 +18078,7 @@
 		ast_cli(fd, "  Context      : %s\n", peer->context);
 		ast_cli(fd, "  Subscr.Cont. : %s\n", S_OR(peer->subscribecontext, "<Not set>") );
 		ast_cli(fd, "  Language     : %s\n", peer->language);
+		ast_cli(fd, "  Tonezone     : %s\n", peer->zone[0] != '\0' ? peer->zone : "<Not set>");
 		if (!ast_strlen_zero(peer->accountcode))
 			ast_cli(fd, "  Accountcode  : %s\n", peer->accountcode);
 		ast_cli(fd, "  AMA flags    : %s\n", ast_cdr_flags2str(peer->amaflags));
@@ -18182,6 +18193,7 @@
 		astman_append(s, "MD5SecretExist: %s\r\n", ast_strlen_zero(peer->md5secret)?"N":"Y");
 		astman_append(s, "Context: %s\r\n", peer->context);
 		astman_append(s, "Language: %s\r\n", peer->language);
+		astman_append(s, "ToneZone: %s\r\n", peer->zone[0] != '\0' ? peer->zone : "<Not set>");
 		if (!ast_strlen_zero(peer->accountcode))
 			astman_append(s, "Accountcode: %s\r\n", peer->accountcode);
 		astman_append(s, "AMAflags: %s\r\n", ast_cdr_flags2str(peer->amaflags));
@@ -18348,6 +18360,7 @@
 		if (!ast_strlen_zero(user->accountcode))
 			ast_cli(a->fd, "  Accountcode  : %s\n", user->accountcode);
 		ast_cli(a->fd, "  AMA flags    : %s\n", ast_cdr_flags2str(user->amaflags));
+		ast_cli(a->fd, "  Tonezone     : %s\n", user->zone[0] != '\0' ? user->zone : "<Not set>");
 		ast_cli(a->fd, "  Transfer mode: %s\n", transfermode2str(user->allowtransfer));
 		ast_cli(a->fd, "  MaxCallBR    : %d kbps\n", user->maxcallbitrate);
 		ast_cli(a->fd, "  CallingPres  : %s\n", ast_describe_caller_presentation(user->callingpres));
@@ -18830,6 +18843,7 @@
 	ast_cli(a->fd, "  Use ClientCode:         %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_USECLIENTCODE)));
 	ast_cli(a->fd, "  Progress inband:        %s\n", (ast_test_flag(&global_flags[0], SIP_PROG_INBAND) == SIP_PROG_INBAND_NEVER) ? "Never" : (AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_PROG_INBAND) != SIP_PROG_INBAND_NO)));
 	ast_cli(a->fd, "  Language:               %s\n", default_language);
+	ast_cli(a->fd, "  Tone zone:              %s\n", default_zone[0] != '\0' ? default_zone : "<Not set>");
 	ast_cli(a->fd, "  MOH Interpret:          %s\n", default_mohinterpret);
 	ast_cli(a->fd, "  MOH Suggest:            %s\n", default_mohsuggest);
 	ast_cli(a->fd, "  Voice Mail Extension:   %s\n", default_vmexten);
@@ -27828,6 +27842,7 @@
 	peer->pickupgroup = 0;
 	peer->maxms = default_qualify;
 	peer->prefs = default_prefs;
+	ast_string_field_set(peer, zone, default_zone);
 	peer->stimer.st_mode_oper = global_st_mode;	/* Session-Timers */
 	peer->stimer.st_ref = global_st_refresher;
 	peer->stimer.st_min_se = global_min_se;
@@ -28188,6 +28203,13 @@
 						deprecation_warning = 0;
 					}
 					peer->deprecated_username = 1;
+				}
+			} else if (!strcasecmp(v->name, "tonezone")) {
+				struct ast_tone_zone *new_zone;
+				if (!(new_zone = ast_get_indication_zone(v->value))) {
+					ast_log(LOG_ERROR, "Unknown country code '%s' for tonezone in device [%s] at line %d. Check indications.conf for available country codes.\n", v->value, peer->name, v->lineno);
+				} else {
+					ast_string_field_set(peer, zone, v->value);
 				}
 			} else if (!strcasecmp(v->name, "language")) {
 				ast_string_field_set(peer, language, v->value);
@@ -28826,6 +28848,7 @@
 	default_fromdomain[0] = '\0';
 	default_fromdomainport = 0;
 	default_qualify = DEFAULT_QUALIFY;
+	default_zone[0] = '\0';
 	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));
@@ -29030,6 +29053,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 ast_tone_zone *new_zone;
+			if (!(new_zone = ast_get_indication_zone(v->value))) {
+				ast_log(LOG_ERROR, "Unknown country code '%s' for tonezone in [general] at line %d. Check indications.conf for available country codes.\n", v->value, v->lineno);
+			} else {
+				ast_copy_string(default_zone, v->value, sizeof(default_zone));
+			}
 		} else if (!strcasecmp(v->name, "language")) {
 			ast_copy_string(default_language, v->value, sizeof(default_language));
 		} else if (!strcasecmp(v->name, "regcontext")) {

Modified: team/oej/set-sip-tonezone-1.8/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/set-sip-tonezone-1.8/channels/sip/include/sip.h?view=diff&rev=383027&r1=383026&r2=383027
==============================================================================
--- team/oej/set-sip-tonezone-1.8/channels/sip/include/sip.h (original)
+++ team/oej/set-sip-tonezone-1.8/channels/sip/include/sip.h Wed Mar 13 10:29:23 2013
@@ -32,6 +32,7 @@
 #include "asterisk/channel.h"
 #include "asterisk/app.h"
 #include "asterisk/astobj.h"
+#include "asterisk/indications.h"
 
 #ifndef FALSE
 #define FALSE    0
@@ -1068,6 +1069,7 @@
 	unsigned int stalenonce:1;          /*!< Marks the current nonce as responded too */
 	unsigned int ongoing_reinvite:1;    /*!< There is a reinvite in progress that might need to be cleaned up */
 	char lastmsg[256];                  /*!< Last Message sent/received */
+	char zone[MAX_TONEZONE_COUNTRY];        /*!< Default tone zone for this call */
 	int amaflags;                       /*!< AMA Flags */
 	uint32_t pendinginvite; /*!< Any pending INVITE or state NOTIFY (in subscribe pvt's) ? (seqno of this) */
 	uint32_t glareinvite;      /*!< A invite received while a pending invite is already present is stored here.  Its seqno is the
@@ -1241,6 +1243,7 @@
 	int lastmsgssent;
 	unsigned int sipoptions;        /*!<  Supported SIP options */
 	struct ast_flags flags[3];      /*!<  SIP_ flags */
+	char zone[MAX_TONEZONE_COUNTRY];        /*!< Default tone zone for this user */
 
 	/*! Mailboxes that this peer cares about */
 	AST_LIST_HEAD_NOLOCK(, sip_mailbox) mailboxes;

Modified: team/oej/set-sip-tonezone-1.8/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/oej/set-sip-tonezone-1.8/configs/sip.conf.sample?view=diff&rev=383027&r1=383026&r2=383027
==============================================================================
--- team/oej/set-sip-tonezone-1.8/configs/sip.conf.sample (original)
+++ team/oej/set-sip-tonezone-1.8/configs/sip.conf.sample Wed Mar 13 10:29:23 2013
@@ -1165,6 +1165,7 @@
 ; timerb
 ; qualifyfreq
 ; t38pt_usertpsource
+; tonezone              ; Default Tone zone (see indications.conf) for calls created by this device
 ; contactpermit         ; Limit what a host may register as (a neat trick
 ; contactdeny           ; is to register at the same IP as a SIP provider,
 ;                       ; then call oneself, and get redirected to that

Modified: team/oej/set-sip-tonezone-1.8/include/asterisk/indications.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/set-sip-tonezone-1.8/include/asterisk/indications.h?view=diff&rev=383027&r1=383026&r2=383027
==============================================================================
--- team/oej/set-sip-tonezone-1.8/include/asterisk/indications.h (original)
+++ team/oej/set-sip-tonezone-1.8/include/asterisk/indications.h Wed Mar 13 10:29:23 2013
@@ -29,6 +29,8 @@
 #include "asterisk/astobj2.h"
 #include "asterisk/utils.h"
 #include "asterisk/data.h"
+
+#define MAX_TONEZONE_COUNTRY 16
 
 /*!
  * \brief Description of a tone
@@ -72,7 +74,7 @@
  */
 struct ast_tone_zone {
 	/*! \brief Country code that this set of tones is for */
-	char country[16];
+	char country[MAX_TONEZONE_COUNTRY];
 	/*! 
 	 * \brief Text description of the given country.
 	 *




More information about the asterisk-commits mailing list