[asterisk-commits] oej: branch group/set-tonezone-1.4 r285519 - in /team/group/set-tonezone-1.4:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 8 09:26:42 CDT 2010


Author: oej
Date: Wed Sep  8 09:26:36 2010
New Revision: 285519

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=285519
Log:
Add tonezone support in SIP device configuration

Modified:
    team/group/set-tonezone-1.4/apps/app_dumpchan.c
    team/group/set-tonezone-1.4/channels/chan_sip.c
    team/group/set-tonezone-1.4/configs/sip.conf.sample

Modified: team/group/set-tonezone-1.4/apps/app_dumpchan.c
URL: http://svnview.digium.com/svn/asterisk/team/group/set-tonezone-1.4/apps/app_dumpchan.c?view=diff&rev=285519&r1=285518&r2=285519
==============================================================================
--- team/group/set-tonezone-1.4/apps/app_dumpchan.c (original)
+++ team/group/set-tonezone-1.4/apps/app_dumpchan.c Wed Sep  8 09:26:36 2010
@@ -46,6 +46,7 @@
 #include "asterisk/utils.h"
 #include "asterisk/lock.h"
 #include "asterisk/utils.h"
+#include "asterisk/indications.h"
 
 static char *app = "DumpChan";
 static char *synopsis = "Dump Info About The Calling Channel";
@@ -91,6 +92,8 @@
 			 "NativeFormat=       %s\n"
 			 "WriteFormat=        %s\n"
 			 "ReadFormat=         %s\n"
+			 "Language=           %s\n"
+			 "Tone zone=          %s\n"
 			 "1stFileDescriptor=  %d\n"
 			 "Framesin=           %d %s\n"
 			 "Framesout=          %d %s\n"
@@ -117,6 +120,8 @@
 			 ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->nativeformats),
 			 ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->writeformat),
 			 ast_getformatname_multiple(formatbuf, sizeof(formatbuf), c->readformat),
+			 S_OR(c->language, "(N/A)"),
+			 c->zone ? c->zone->country : "(N/A)",
 			 c->fds[0], c->fin & ~DEBUGCHAN_FLAG, (c->fin & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "",
 			 c->fout & ~DEBUGCHAN_FLAG, (c->fout & DEBUGCHAN_FLAG) ? " (DEBUGGED)" : "", (long)c->whentohangup,
 			 hour,

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=285519&r1=285518&r2=285519
==============================================================================
--- team/group/set-tonezone-1.4/channels/chan_sip.c (original)
+++ team/group/set-tonezone-1.4/channels/chan_sip.c Wed Sep  8 09:26:36 2010
@@ -140,6 +140,7 @@
 #include "asterisk/utils.h"
 #include "asterisk/file.h"
 #include "asterisk/astobj.h"
+#include "asterisk/indications.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/stringfields.h"
@@ -1001,6 +1002,7 @@
 	long branch;				/*!< The branch identifier of this session */
 	long invite_branch;			/*!< The branch used when we sent the initial INVITE */
 	char tag[11];				/*!< Our tag for this session */
+	struct tone_zone *zone;			/*!< Default tone zone for this user */
 	int sessionid;				/*!< SDP Session ID */
 	int sessionversion;			/*!< SDP Session Version */
 	unsigned int portinuri:1;		/*!< Non zero if a port has been specified, will also disable srv lookups */
@@ -1126,6 +1128,7 @@
 	struct ast_variable *chanvars;	/*!< Variables to set for channel created by user */
 	int maxcallbitrate;		/*!< Maximum Bitrate for a video call */
 	int autoframing;
+	struct tone_zone *zone;		/*!< Default tone zone for this user */
 };
 
 /*! \brief Structure for SIP peer data, we place calls to peers if registered  or fixed IP address (host) */
@@ -1190,6 +1193,7 @@
 	struct sip_pvt *mwipvt;		/*!<  Subscription for MWI */
 	int lastmsg;
 	int autoframing;
+	struct tone_zone *zone;		/*!< Default tone zone for this user */
 };
 
 
@@ -3077,6 +3081,7 @@
 		ast_string_field_set(dialog, fromuser, peer->fromuser);
 	if (!ast_strlen_zero(peer->language))
 		ast_string_field_set(dialog, language, peer->language);
+	dialog->zone = peer->zone;
 	dialog->maxtime = peer->maxms;
 	dialog->callgroup = peer->callgroup;
 	dialog->pickupgroup = peer->pickupgroup;
@@ -4396,6 +4401,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));
@@ -10312,6 +10318,7 @@
 			ast_string_field_set(p, language, user->language);
 			ast_string_field_set(p, mohsuggest, user->mohsuggest);
 			ast_string_field_set(p, mohinterpret, user->mohinterpret);
+			p->zone = user->zone;
 			p->allowtransfer = user->allowtransfer;
 			p->amaflags = user->amaflags;
 			p->callgroup = user->callgroup;
@@ -10447,6 +10454,7 @@
 				ast_string_field_set(p, peermd5secret, peer->md5secret);
 				ast_string_field_set(p, language, peer->language);
 				ast_string_field_set(p, accountcode, peer->accountcode);
+				p->zone = peer->zone;
 				p->amaflags = peer->amaflags;
 				p->callgroup = peer->callgroup;
 				p->pickupgroup = peer->pickupgroup;
@@ -11256,6 +11264,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));
@@ -11347,6 +11356,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));
@@ -11443,6 +11453,7 @@
 		ast_cli(fd, "  MD5Secret    : %s\n", ast_strlen_zero(user->md5secret)?"<Not set>":"<Set>");
 		ast_cli(fd, "  Context      : %s\n", user->context);
 		ast_cli(fd, "  Language     : %s\n", user->language);
+		ast_cli(fd, "  Tonezone     : %s\n", user->zone ? user->zone->country : "<Not set>");
 		if (!ast_strlen_zero(user->accountcode))
 			ast_cli(fd, "  Accountcode  : %s\n", user->accountcode);
 		ast_cli(fd, "  AMA flags    : %s\n", ast_cdr_flags2str(user->amaflags));
@@ -17945,6 +17956,13 @@
 			user->pickupgroup = ast_get_group(v->value);
 		} else if (!strcasecmp(v->name, "language")) {
 			ast_copy_string(user->language, v->value, sizeof(user->language));
+		} 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 {
+				user->zone = new_zone;
+			}
 		} else if (!strcasecmp(v->name, "mohinterpret") 
 			|| !strcasecmp(v->name, "musicclass") || !strcasecmp(v->name, "musiconhold")) {
 			ast_copy_string(user->mohinterpret, v->value, sizeof(user->mohinterpret));
@@ -18242,6 +18260,13 @@
 				ast_copy_string(peer->username, v->value, sizeof(peer->username));
 			} else if (!strcasecmp(v->name, "language")) {
 				ast_copy_string(peer->language, v->value, sizeof(peer->language));
+			} 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 {
+					peer->zone = new_zone;
+				}
 			} else if (!strcasecmp(v->name, "regexten")) {
 				ast_copy_string(peer->regexten, v->value, sizeof(peer->regexten));
 			} else if (!strcasecmp(v->name, "amaflags")) {

Modified: team/group/set-tonezone-1.4/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/group/set-tonezone-1.4/configs/sip.conf.sample?view=diff&rev=285519&r1=285518&r2=285519
==============================================================================
--- team/group/set-tonezone-1.4/configs/sip.conf.sample (original)
+++ team/group/set-tonezone-1.4/configs/sip.conf.sample Wed Sep  8 09:26:36 2010
@@ -563,6 +563,7 @@
 ; maxcallbitrate              maxcallbitrate
 ; rfc2833compensate           mailbox
 ; t38pt_usertpsource          username
+; tonezone                    tonezone		; Default Tone zone (see indications.conf) for calls created by this device
 ;                             fromdomain
 ;                             regexten
 ;                             fromuser




More information about the asterisk-commits mailing list