[asterisk-commits] oej: branch group/set-tonezone-trunk r285743 - in /team/group/set-tonezone-tr...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 9 15:08:15 CDT 2010


Author: oej
Date: Thu Sep  9 15:08:04 2010
New Revision: 285743

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=285743
Log:
Forwardport of my work with tonezones in sip

Modified:
    team/group/set-tonezone-trunk/channels/chan_sip.c
    team/group/set-tonezone-trunk/channels/sip/include/sip.h
    team/group/set-tonezone-trunk/configs/sip.conf.sample

Modified: team/group/set-tonezone-trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/set-tonezone-trunk/channels/chan_sip.c?view=diff&rev=285743&r1=285742&r2=285743
==============================================================================
--- team/group/set-tonezone-trunk/channels/chan_sip.c (original)
+++ team/group/set-tonezone-trunk/channels/chan_sip.c Thu Sep  9 15:08:04 2010
@@ -263,6 +263,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"
@@ -685,6 +686,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 struct ast_tone_zone *default_zone;        /*!< Global tone zone for indications generate by Asterisk (not Dahdi) */
 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 */
 /*@}*/
@@ -4882,6 +4884,7 @@
 	ref_proxy(dialog, obproxy_get(dialog, peer));
 	dialog->callgroup = peer->callgroup;
 	dialog->pickupgroup = peer->pickupgroup;
+	dialog->zone = peer->zone;
 	dialog->allowtransfer = peer->allowtransfer;
 	dialog->jointnoncodeccapability = dialog->noncodeccapability;
 	dialog->rtptimeout = peer->rtptimeout;
@@ -6604,6 +6607,7 @@
 		tmp->amaflags = i->amaflags;
 	if (!ast_strlen_zero(i->language))
 		ast_string_field_set(tmp, language, i->language);
+	tmp->zone = i->zone;
 	i->owner = tmp;
 	ast_module_ref(ast_module_info->self);
 	ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
@@ -7089,6 +7093,7 @@
 	p->session_modify = TRUE;
 	p->stimer = NULL;
 	p->prefs = default_prefs;		/* Set default codecs for this call */
+	p->zone = default_zone;                 /* Set default tone zone */
 	p->maxforwards = sip_cfg.default_max_forwards;
 
 	if (intended_method != SIP_OPTIONS) {	/* Peerpoke has it's own system */
@@ -14942,6 +14947,7 @@
 		p->pickupgroup = peer->pickupgroup;
 		p->capability = peer->capability;
 		p->prefs = peer->prefs;
+		p->zone = peer->zone;
 		p->jointcapability = peer->capability;
  		if (peer->maxforwards > 0) {
 			p->maxforwards = peer->maxforwards;
@@ -16245,6 +16251,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 != NULL ? peer->zone->country : "<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));
@@ -16359,6 +16366,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 ? peer->zone->country : "<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));
@@ -16522,6 +16530,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 ? user->zone->country : "<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));
@@ -16967,6 +16976,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 != NULL ? default_zone->country : "<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);
@@ -25494,6 +25504,7 @@
 	peer->pickupgroup = 0;
 	peer->maxms = default_qualify;
 	peer->prefs = default_prefs;
+	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;
@@ -25857,6 +25868,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. Check indications.conf for available country codes.\n", v->value);
+				} else {
+					peer->zone = new_zone;
 				}
 			} else if (!strcasecmp(v->name, "language")) {
 				ast_string_field_set(peer, language, v->value);
@@ -26457,6 +26475,7 @@
 	default_fromdomain[0] = '\0';
 	default_fromdomainport = 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));
@@ -26655,6 +26674,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. 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")) {

Modified: team/group/set-tonezone-trunk/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/group/set-tonezone-trunk/channels/sip/include/sip.h?view=diff&rev=285743&r1=285742&r2=285743
==============================================================================
--- team/group/set-tonezone-trunk/channels/sip/include/sip.h (original)
+++ team/group/set-tonezone-trunk/channels/sip/include/sip.h Thu Sep  9 15:08:04 2010
@@ -24,6 +24,7 @@
 
 #include "asterisk.h"
 
+#include "asterisk/indications.h"
 #include "asterisk/stringfields.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/strings.h"
@@ -1000,6 +1001,7 @@
 	struct t38properties t38;             /*!< T38 settings */
 	struct ast_sockaddr udptlredirip;     /*!< Where our T.38 UDPTL should be going if not to us */
 	struct ast_udptl *udptl;              /*!< T.38 UDPTL session */
+	struct ast_tone_zone *zone;               /*!< Default tone zone for this dialog */
 	int callingpres;                      /*!< Calling presentation */
 	int expiry;                         /*!< How long we take to expire */
 	int sessionversion;                 /*!< SDP Session Version */
@@ -1187,6 +1189,7 @@
 	struct sip_auth *auth;          /*!< Realm authentication list */
 	int amaflags;                   /*!< AMA Flags (for billing) */
 	int callingpres;                /*!< Calling id presentation */
+	struct ast_tone_zone *zone;         /*!< Default tone zone for this device */
 	int inUse;                      /*!< Number of calls in use */
 	int inRinging;                  /*!< Number of calls ringing */
 	int onHold;                     /*!< Peer has someone on hold */

Modified: team/group/set-tonezone-trunk/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/group/set-tonezone-trunk/configs/sip.conf.sample?view=diff&rev=285743&r1=285742&r2=285743
==============================================================================
--- team/group/set-tonezone-trunk/configs/sip.conf.sample (original)
+++ team/group/set-tonezone-trunk/configs/sip.conf.sample Thu Sep  9 15:08:04 2010
@@ -295,6 +295,8 @@
                                 ; Parkinglots are configured in features.conf
 ;language=en                    ; Default language setting for all users/peers
                                 ; This may also be set for individual users/peers
+;tonezone=se			; Setting the tonezone for new calls (see indications.conf)
+                                ; This may also be set for individual devices
 ;relaxdtmf=yes                  ; Relax dtmf handling
 ;trustrpid = no                 ; If Remote-Party-ID should be trusted
 ;sendrpid = yes                 ; If Remote-Party-ID should be sent (defaults to no)
@@ -1038,6 +1040,7 @@
 ; trustrpid
 ; progressinband
 ; promiscredir
+; tonezone
 ; useclientcode
 ; accountcode
 ; setvar




More information about the asterisk-commits mailing list