[asterisk-commits] branch oej/multiparking - r8279 in /team/oej/multiparking: ./ channels/ inclu...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Jan 19 12:23:36 MST 2006


Author: oej
Date: Thu Jan 19 13:23:33 2006
New Revision: 8279

URL: http://svn.digium.com/view/asterisk?rev=8279&view=rev
Log:
- Add a parkinglot setting to ast_channel
- Enabling this for users and peers in sip.conf and chan_sip
Todo:
- use this in res_features :-)

This is to solve the issue when the callee transfers a call and wants
the call to be parked in her parkinglot, not in the callers parkinglot.
Since we now have multiple parkinglots in one call with two channels,
we have to handle different parkinglots for caller and callee. I can no
longer avoid changing ast_channel, sorry.


Modified:
    team/oej/multiparking/channels/chan_sip.c
    team/oej/multiparking/cli.c
    team/oej/multiparking/include/asterisk/channel.h

Modified: team/oej/multiparking/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_sip.c?rev=8279&r1=8278&r2=8279&view=diff
==============================================================================
--- team/oej/multiparking/channels/chan_sip.c (original)
+++ team/oej/multiparking/channels/chan_sip.c Thu Jan 19 13:23:33 2006
@@ -430,8 +430,10 @@
 static int dumphistory = 0;				/*!< Dump history to verbose before destroying SIP dialog */
 
 static char global_musicclass[MAX_MUSICCLASS] = "";	/*!< Global music on hold class */
+
 #define DEFAULT_REALM	"asterisk"
 static char global_realm[MAXHOSTNAMELEN] = DEFAULT_REALM; 	/*!< Default realm */
+static char default_parkinglot[AST_MAX_EXTENSION];	/*!< Default parking lot */
 static char regcontext[AST_MAX_CONTEXT] = "";		/*!< Context for auto-extensions */
 
 #define DEFAULT_EXPIRY 900				/*!< Expire slowly */
@@ -620,6 +622,7 @@
 		AST_STRING_FIELD(tohost);	/*!< Host we should put in the "to" field */
 		AST_STRING_FIELD(language);	/*!< Default language for this call */
 		AST_STRING_FIELD(musicclass);	/*!< Music on Hold class */
+		AST_STRING_FIELD(parkinglot);	/*!< Default parking lot */
 		AST_STRING_FIELD(rdnis);	/*!< Referring DNIS */
 		AST_STRING_FIELD(theirtag);	/*!< Their tag */
 		AST_STRING_FIELD(username);	/*!< [user] name */
@@ -737,6 +740,7 @@
 	char accountcode[AST_MAX_ACCOUNT_CODE];	/* Account code */
 	char language[MAX_LANGUAGE];	/*!< Default language for this user */
 	char musicclass[MAX_MUSICCLASS];/*!< Music on Hold class */
+	char parkinglot[AST_MAX_EXTENSION];/*!< Default parking lot */
 	char useragent[256];		/*!< User agent in SIP request */
 	struct ast_codec_pref prefs;	/*!< codec prefs */
 	ast_group_t callgroup;		/*!< Call group */
@@ -779,6 +783,7 @@
 	char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox setting for MWI checks */
 	char language[MAX_LANGUAGE];	/*!<  Default language for prompts */
 	char musicclass[MAX_MUSICCLASS];/*!<  Music on Hold class */
+	char parkinglot[AST_MAX_EXTENSION];/*!< Default parking lot */
 	char useragent[256];		/*!<  User agent in SIP request (saved from registration) */
 	struct ast_codec_pref prefs;	/*!<  codec prefs */
 	int lastmsgssent;
@@ -2832,6 +2837,8 @@
 		ast_copy_string(tmp->language, i->language, sizeof(tmp->language));
 	if (!ast_strlen_zero(i->musicclass))
 		ast_copy_string(tmp->musicclass, i->musicclass, sizeof(tmp->musicclass));
+	if (!ast_strlen_zero(i->parkinglot))
+		ast_copy_string(tmp->parkinglot, i->parkinglot, sizeof(tmp->parkinglot));
 	i->owner = tmp;
 	ast_mutex_lock(&usecnt_lock);
 	usecnt++;
@@ -3166,6 +3173,7 @@
 	ast_copy_flags(p, &global_flags, SIP_FLAGS_TO_COPY);
 	/* Assign default music on hold class */
 	ast_string_field_set(p, musicclass, global_musicclass);
+	ast_string_field_set(p, parkinglot, default_parkinglot);
 	p->capability = global_capability;
 	if ((ast_test_flag(p, SIP_DTMF) == SIP_DTMF_RFC2833) || (ast_test_flag(p, SIP_DTMF) == SIP_DTMF_AUTO))
 		p->noncodeccapability |= AST_RTP_DTMF;
@@ -7135,6 +7143,7 @@
 			ast_string_field_set(p, accountcode, user->accountcode);
 			ast_string_field_set(p, language, user->language);
 			ast_string_field_set(p, musicclass, user->musicclass);
+			ast_string_field_set(p, parkinglot, user->parkinglot);
 			p->amaflags = user->amaflags;
 			p->callgroup = user->callgroup;
 			p->pickupgroup = user->pickupgroup;
@@ -8297,6 +8306,7 @@
 	ast_cli(fd, "  Progress inband:        %s\n", (ast_test_flag(&global_flags, SIP_PROG_INBAND) == SIP_PROG_INBAND_NEVER) ? "Never" : (ast_test_flag(&global_flags, SIP_PROG_INBAND) == SIP_PROG_INBAND_NO) ? "No" : "Yes" );
 	ast_cli(fd, "  Language:               %s\n", ast_strlen_zero(default_language) ? "(Defaults to English)" : default_language);
 	ast_cli(fd, "  Musicclass:             %s\n", global_musicclass);
+	ast_cli(fd, "  Parkinglot:             %s\n", default_parkinglot);
 	ast_cli(fd, "  Voice Mail Extension:   %s\n", global_vmexten);
 
 	
@@ -11943,6 +11953,7 @@
 	strcpy(user->context, default_context);
 	strcpy(user->language, default_language);
 	strcpy(user->musicclass, global_musicclass);
+	strcpy(user->parkinglot, default_parkinglot);
 	for (; v; v = v->next) {
 		if (handle_common_options(&userflags, &mask, v))
 			continue;
@@ -11978,6 +11989,8 @@
 			ast_copy_string(user->language, v->value, sizeof(user->language));
 		} else if (!strcasecmp(v->name, "musicclass") || !strcasecmp(v->name, "musiconhold")) {
 			ast_copy_string(user->musicclass, v->value, sizeof(user->musicclass));
+		} else if (!strcasecmp(v->name, "parkinglot")) {
+			ast_copy_string(user->parkinglot, v->value, sizeof(user->parkinglot));
 		} else if (!strcasecmp(v->name, "accountcode")) {
 			ast_copy_string(user->accountcode, v->value, sizeof(user->accountcode));
 		} else if (!strcasecmp(v->name, "call-limit")) {
@@ -12025,6 +12038,7 @@
 	strcpy(peer->subscribecontext, default_subscribecontext);
 	strcpy(peer->language, default_language);
 	strcpy(peer->musicclass, global_musicclass);
+	strcpy(peer->parkinglot, default_parkinglot);
 	peer->addr.sin_port = htons(DEFAULT_SIP_PORT);
 	peer->addr.sin_family = AF_INET;
 	peer->capability = global_capability;
@@ -12097,6 +12111,7 @@
 	strcpy(peer->vmexten, global_vmexten);
 	strcpy(peer->language, default_language);
 	strcpy(peer->musicclass, global_musicclass);
+	strcpy(peer->parkinglot, default_parkinglot);
 	ast_copy_flags(peer, &global_flags, SIP_USEREQPHONE);
 	peer->secret[0] = '\0';
 	peer->md5secret[0] = '\0';
@@ -12227,6 +12242,8 @@
 			ast_copy_string(peer->accountcode, v->value, sizeof(peer->accountcode));
 		} else if (!strcasecmp(v->name, "musiconhold")) {
 			ast_copy_string(peer->musicclass, v->value, sizeof(peer->musicclass));
+		} else if (!strcasecmp(v->name, "parkinglot")) {
+			ast_copy_string(peer->parkinglot, v->value, sizeof(peer->parkinglot));
 		} else if (!strcasecmp(v->name, "mailbox")) {
 			ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox));
 		} else if (!strcasecmp(v->name, "vmexten")) {
@@ -12350,6 +12367,7 @@
 	global_notifyringing = 1;
 	ast_copy_string(global_realm, DEFAULT_REALM, sizeof(global_realm));
 	ast_copy_string(global_musicclass, "default", sizeof(global_musicclass));
+	default_parkinglot[0] = '\0';
 	ast_copy_string(default_callerid, DEFAULT_CALLERID, sizeof(default_callerid));
 	memset(&outboundproxyip, 0, sizeof(outboundproxyip));
 	outboundproxyip.sin_port = htons(DEFAULT_SIP_PORT);
@@ -12444,6 +12462,8 @@
 			global_notifyringing = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "musicclass") || !strcasecmp(v->name, "musiconhold")) {
 			ast_copy_string(global_musicclass, v->value, sizeof(global_musicclass));
+		} else if (!strcasecmp(v->name, "parkinglot")) {
+			ast_copy_string(default_parkinglot, v->value, sizeof(default_parkinglot));
 		} 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/multiparking/cli.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/cli.c?rev=8279&r1=8278&r2=8279&view=diff
==============================================================================
--- team/oej/multiparking/cli.c (original)
+++ team/oej/multiparking/cli.c Thu Jan 19 13:23:33 2006
@@ -738,7 +738,10 @@
 		"   Pickup Group: %d\n"
 		"    Application: %s\n"
 		"           Data: %s\n"
-		"    Blocking in: %s\n",
+		"    Blocking in: %s\n"
+		" -- Settings --\n"
+		"     Musicclass: %s\n"
+		"     Parkinglot: %s\n",
 		c->name, c->type, c->uniqueid,
 		(c->cid.cid_num ? c->cid.cid_num : "(N/A)"),
 		(c->cid.cid_name ? c->cid.cid_name : "(N/A)"),
@@ -751,7 +754,9 @@
 		cdrtime, c->_bridge ? c->_bridge->name : "<none>", ast_bridged_channel(c) ? ast_bridged_channel(c)->name : "<none>", 
 		c->context, c->exten, c->priority, c->callgroup, c->pickupgroup, ( c->appl ? c->appl : "(N/A)" ),
 		( c-> data ? (!ast_strlen_zero(c->data) ? c->data : "(Empty)") : "(None)"),
-		(ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"));
+		(ast_test_flag(c, AST_FLAG_BLOCKING) ? c->blockproc : "(Not Blocking)"),
+		c->musicclass, c->parkinglot
+		);
 	
 	if(pbx_builtin_serialize_variables(c,buf,sizeof(buf)))
 		ast_cli(fd,"      Variables:\n%s\n",buf);

Modified: team/oej/multiparking/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/include/asterisk/channel.h?rev=8279&r1=8278&r2=8279&view=diff
==============================================================================
--- team/oej/multiparking/include/asterisk/channel.h (original)
+++ team/oej/multiparking/include/asterisk/channel.h Thu Jan 19 13:23:33 2006
@@ -267,8 +267,13 @@
 
 	/*! Default music class */
 	char musicclass[MAX_MUSICCLASS];
+
+	/*! Default parking lot, if empty, default parking lot  */
+	char parkinglot[AST_MAX_EXTENSION];
+
 	/*! Music State*/
 	void *music_state;
+
 	/*! Current generator data if there is any */
 	void *generatordata;
 	/*! Current active data generator */



More information about the asterisk-commits mailing list