[asterisk-commits] branch oej/test-this-branch r11014 - in /team/oej/test-this-branch: ./ apps/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Feb 24 07:32:51 MST 2006


Author: oej
Date: Fri Feb 24 08:32:35 2006
New Revision: 11014

URL: http://svn.digium.com/view/asterisk?rev=11014&view=rev
Log:
Adding Multiparking branch. Please continue testing!


Modified:
    team/oej/test-this-branch/README.test-this-branch
    team/oej/test-this-branch/apps/app_dumpchan.c
    team/oej/test-this-branch/channels/chan_iax2.c
    team/oej/test-this-branch/channels/chan_sip.c
    team/oej/test-this-branch/channels/chan_zap.c
    team/oej/test-this-branch/cli.c
    team/oej/test-this-branch/configs/features.conf.sample
    team/oej/test-this-branch/configs/iax.conf.sample
    team/oej/test-this-branch/configs/sip.conf.sample
    team/oej/test-this-branch/file.c
    team/oej/test-this-branch/include/asterisk/channel.h
    team/oej/test-this-branch/res/res_features.c

Modified: team/oej/test-this-branch/README.test-this-branch
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/README.test-this-branch?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/README.test-this-branch (original)
+++ team/oej/test-this-branch/README.test-this-branch Fri Feb 24 08:32:35 2006
@@ -22,6 +22,7 @@
 - sipregister: A new registration architecture (rizzo, oej #5834)
 - subscribemwi: Support for SIP subscription of MWI notification (oej #6390)
 - iptos: New IPtos support, separate audio and signalling (#6355)
+- multiparking: Multiple parking lots (#6113)
 
 And the following stand-alone patches
 - New CLI commands for global variables (oej, #6506)
@@ -32,7 +33,6 @@
 
 Coming here soon:
 - metermaids: Subscription support for parking lots (#5779)
-- multiparking: Multiple parking lots (#6113)
 
 
 All of these exist in the bug tracker. Please report your findings

Modified: team/oej/test-this-branch/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_dumpchan.c?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_dumpchan.c (original)
+++ team/oej/test-this-branch/apps/app_dumpchan.c Fri Feb 24 08:32:35 2006
@@ -85,6 +85,7 @@
 			 "CallerID=           %s\n"
 			 "CallerIDName=       %s\n"
 			 "DNIDDigits=         %s\n"
+			 "Parkinglot=         %s\n"
 			 "State=              %s (%d)\n"
 			 "Rings=              %d\n"
 			 "NativeFormat=       %d\n"
@@ -109,6 +110,7 @@
 			 (c->cid.cid_num ? c->cid.cid_num : "(N/A)"),
 			 (c->cid.cid_name ? c->cid.cid_name : "(N/A)"),
 			 (c->cid.cid_dnid ? c->cid.cid_dnid : "(N/A)" ),
+			 c->parkinglot,
 			 ast_state2str(c->_state),
 			 c->_state,
 			 c->rings,

Modified: team/oej/test-this-branch/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_iax2.c?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_iax2.c (original)
+++ team/oej/test-this-branch/channels/chan_iax2.c Fri Feb 24 08:32:35 2006
@@ -26,6 +26,8 @@
  * \arg \ref Config_iax
  *
  * \ingroup channel_drivers
+ * 
+ * \todo Implement musicclass settings for IAX2 devices
  */
 
 #include <stdlib.h>
@@ -144,6 +146,7 @@
 static const char tdesc[] = "Inter Asterisk eXchange Driver (Ver 2)";
 
 static char context[80] = "default";
+static char default_parkinglot[AST_MAX_EXTENSION];
 
 static char language[MAX_LANGUAGE] = "";
 static char regcontext[AST_MAX_CONTEXT] = "";
@@ -282,6 +285,7 @@
 	int authmethods;
 	int encmethods;
 	char accountcode[AST_MAX_ACCOUNT_CODE];
+	char parkinglot[AST_MAX_EXTENSION];		/*!< Default parkinglot for device */
 	char inkeys[80];				/*!< Key(s) this user can use to authenticate to us */
 	char language[MAX_LANGUAGE];
 	int amaflags;
@@ -306,6 +310,7 @@
 	char regexten[AST_MAX_EXTENSION];		/*!< Extension to register (if regcontext is used) */
 	char peercontext[AST_MAX_EXTENSION];		/*!< Context to pass to peer */
 	char mailbox[AST_MAX_EXTENSION];		/*!< Mailbox */
+	char parkinglot[AST_MAX_EXTENSION];		/*!< Default parkinglot for device */
 	struct ast_codec_pref prefs;
 	struct ast_dnsmgr_entry *dnsmgr;		/*!< DNS refresh manager */
 	struct sockaddr_in addr;
@@ -588,6 +593,7 @@
 	int calling_pres;
 	char dproot[AST_MAX_EXTENSION];
 	char accountcode[AST_MAX_ACCOUNT_CODE];
+	char parkinglot[AST_MAX_EXTENSION];		/*!< Default parkinglot for device */
 	int amaflags;
 	struct iax2_dpcache *dpentries;
 	struct ast_variable *vars;
@@ -1104,6 +1110,7 @@
 			iaxs[x]->amaflags = amaflags;
 			ast_copy_flags(iaxs[x], (&globalflags), IAX_NOTRANSFER | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);	
 			ast_copy_string(iaxs[x]->accountcode, accountcode, sizeof(iaxs[x]->accountcode));
+			ast_copy_string(iaxs[x]->parkinglot, default_parkinglot, sizeof(iaxs[x]->parkinglot));
 		} else {
 			ast_log(LOG_WARNING, "Out of resources\n");
 			ast_mutex_unlock(&iaxsl[x]);
@@ -1935,6 +1942,7 @@
 		ast_cli(fd, "  * Name       : %s\n", peer->name);
 		ast_cli(fd, "  Secret       : %s\n", ast_strlen_zero(peer->secret)?"<Not set>":"<Set>");
 		ast_cli(fd, "  Context      : %s\n", peer->context);
+		ast_cli(fd, "  Parking lot  : %s\n", peer->parkinglot);
 		ast_cli(fd, "  Mailbox      : %s\n", peer->mailbox);
 		ast_cli(fd, "  Dynamic      : %s\n", ast_test_flag(peer, IAX_DYNAMIC) ? "Yes":"No");
 		ast_cli(fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
@@ -3428,6 +3436,8 @@
 		tmp->cid.cid_tns = i->calling_tns;
 		if (!ast_strlen_zero(i->accountcode))
 			ast_string_field_set(tmp, accountcode, i->accountcode);
+		if (!ast_strlen_zero(i->parkinglot))
+			ast_copy_string(tmp->parkinglot, i->parkinglot, sizeof(tmp->parkinglot));
 		if (i->amaflags)
 			tmp->amaflags = i->amaflags;
 		ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
@@ -4869,6 +4879,8 @@
 		}
 		if (!ast_strlen_zero(user->accountcode))
 			ast_copy_string(iaxs[callno]->accountcode, user->accountcode, sizeof(iaxs[callno]->accountcode));
+		if (!ast_strlen_zero(user->parkinglot))
+			ast_copy_string(iaxs[callno]->parkinglot, user->parkinglot, sizeof(iaxs[callno]->parkinglot));
 		if (user->amaflags)
 			iaxs[callno]->amaflags = user->amaflags;
 		if (!ast_strlen_zero(user->language))
@@ -8403,6 +8415,10 @@
 				ast_set_flag(user, IAX_HASCALLERID);	
 			} else if (!strcasecmp(v->name, "accountcode")) {
 				ast_copy_string(user->accountcode, v->value, sizeof(user->accountcode));
+			} else if (!strcasecmp(v->name, "parkinglot")) {
+	 			ast_copy_string(default_parkinglot, v->value, sizeof(default_parkinglot));
+			} else if (!strcasecmp(v->name, "parkinglot")) {
+				ast_copy_string(user->parkinglot, v->value, sizeof(user->parkinglot));
 			} else if (!strcasecmp(v->name, "language")) {
 				ast_copy_string(user->language, v->value, sizeof(user->language));
 			} else if (!strcasecmp(v->name, "amaflags")) {
@@ -8603,6 +8619,8 @@
 #ifdef SO_NO_CHECK
 	nochecksums = 0;
 #endif
+	/* Reset default parking lot */
+	default_parkinglot[0] = '\0';
 
 	min_reg_expire = IAX_DEFAULT_REG_EXPIRE;
 	max_reg_expire = IAX_DEFAULT_REG_EXPIRE;

Modified: team/oej/test-this-branch/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_sip.c?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_sip.c (original)
+++ team/oej/test-this-branch/channels/chan_sip.c Fri Feb 24 08:32:35 2006
@@ -426,6 +426,7 @@
 static char regcontext[AST_MAX_CONTEXT];		/*!< Context for auto-extensions */
 static char global_useragent[AST_MAX_EXTENSION];	/*!< Useragent for the SIP channel */
 static int allow_external_domains;	/*!< Accept calls to external SIP domains? */
+static char default_parkinglot[AST_MAX_EXTENSION];	/*!< Default parking lot */
 static int global_callevents;		/*!< Whether we send manager events or not */
 static int global_t1min;		/*!< T1 roundtrip time minimum */
 
@@ -663,6 +664,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(redircause);	/*!< Referring cause */
 		AST_STRING_FIELD(theirtag);	/*!< Their tag */
@@ -787,6 +789,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 */
@@ -830,6 +833,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;
@@ -2012,6 +2016,8 @@
 	}
 	if (!ast_strlen_zero(peer->fromdomain))
 		ast_string_field_set(r, fromdomain, peer->fromdomain);
+	if (!ast_strlen_zero(peer->parkinglot))
+		ast_string_field_set(r, parkinglot, peer->parkinglot);
 	if (!ast_strlen_zero(peer->fromuser))
 		ast_string_field_set(r, fromuser, peer->fromuser);
 	r->maxtime = peer->maxms;
@@ -2985,6 +2991,8 @@
 		ast_string_field_set(tmp, language, i->language);
 	if (!ast_strlen_zero(i->musicclass))
 		ast_string_field_set(tmp, musicclass, i->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++;
@@ -3331,6 +3339,7 @@
 		ast_string_field_set(p, callid, callid);
 	/* Assign default music on hold class */
 	ast_string_field_set(p, musicclass, default_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;
@@ -7410,6 +7419,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;
@@ -8286,6 +8296,7 @@
 		}
 		ast_cli(fd, "  Context      : %s\n", peer->context);
 		ast_cli(fd, "  Subscr.Cont. : %s\n", ast_strlen_zero(peer->subscribecontext)?"<Not set>":peer->subscribecontext);
+		ast_cli(fd, "  Parking lot  : %s\n", peer->parkinglot);
 		ast_cli(fd, "  Language     : %s\n", peer->language);
 		if (!ast_strlen_zero(peer->accountcode))
 			ast_cli(fd, "  Accountcode  : %s\n", peer->accountcode);
@@ -8597,8 +8608,8 @@
 	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", default_musicclass);
+	ast_cli(fd, "  Parkinglot:             %s\n", default_parkinglot);
 	ast_cli(fd, "  Voice Mail Extension:   %s\n", default_vmexten);
-
 	
 	if (realtimepeers || realtimeusers) {
 		ast_cli(fd, "\nRealtime SIP Settings:\n");
@@ -9615,6 +9626,8 @@
 		snprintf(buf, len, "%d", peer->inUse);
 	} else  if (!strcasecmp(colname, "useragent")) {
 		ast_copy_string(buf, peer->useragent, len);
+	} else  if (!strcasecmp(colname, "parkinglot")) {
+		ast_copy_string(buf, peer->parkinglot, len);
 	} else  if (!strcasecmp(colname, "mailbox")) {
 		ast_copy_string(buf, peer->mailbox, len);
 	} else  if (!strcasecmp(colname, "context")) {
@@ -9668,7 +9681,8 @@
 	"- status                Status (if qualify=yes).\n"
 	"- regexten              Registration extension\n"
 	"- limit                 Call limit (call-limit)\n"
-	"- curcalls              Current amount of calls \n"
+	"- curcalls              Current amount of calls\n"
+	"- parkinglot            Parking lot used for this peer\n"
 	"                        Only available if call-limit is set\n"
 	"- language              Default language for peer\n"
 	"- useragent             Current user agent id for peer\n"
@@ -12254,6 +12268,7 @@
 	strcpy(user->context, default_context);
 	strcpy(user->language, default_language);
 	strcpy(user->musicclass, default_musicclass);
+	strcpy(user->parkinglot, default_parkinglot);
 	for (; v; v = v->next) {
 		if (handle_common_options(&userflags, &mask, v))
 			continue;
@@ -12289,6 +12304,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")) {
@@ -12338,6 +12355,7 @@
 	strcpy(peer->subscribecontext, default_subscribecontext);
 	strcpy(peer->language, default_language);
 	strcpy(peer->musicclass, default_musicclass);
+	strcpy(peer->parkinglot, default_parkinglot);
 	peer->addr.sin_port = htons(DEFAULT_SIP_PORT);
 	peer->addr.sin_family = AF_INET;
 	peer->defaddr.sin_family = AF_INET;
@@ -12561,6 +12579,8 @@
 			ast_copy_string(peer->accountcode, v->value, sizeof(peer->accountcode));
 		} else if (!strcasecmp(v->name, "musicclass") || !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, "subscribemwi")) {
@@ -12704,6 +12724,7 @@
 	ast_copy_string(global_useragent, DEFAULT_USERAGENT, sizeof(global_useragent));
 	ast_copy_string(default_notifymime, DEFAULT_NOTIFYMIME, sizeof(default_notifymime));
 	ast_copy_string(global_realm, DEFAULT_REALM, sizeof(global_realm));
+	default_parkinglot[0] = '\0';
 	ast_copy_string(default_callerid, DEFAULT_CALLERID, sizeof(default_callerid));
 	compactheaders = DEFAULT_COMPACTHEADERS;
 	global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT;
@@ -12810,6 +12831,8 @@
 			global_notifyringing = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "musicclass") || !strcasecmp(v->name, "musiconhold")) {
 			ast_copy_string(default_musicclass, v->value, sizeof(default_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/test-this-branch/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_zap.c?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_zap.c (original)
+++ team/oej/test-this-branch/channels/chan_zap.c Fri Feb 24 08:32:35 2006
@@ -228,6 +228,7 @@
 
 static char language[MAX_LANGUAGE] = "";
 static char musicclass[MAX_MUSICCLASS] = "";
+static char parkinglot[AST_MAX_EXTENSION] = "";		/*!< Default parking lot for this channel */
 static char progzone[10]= "";
 
 static int usedistinctiveringdetection = 0;
@@ -642,6 +643,7 @@
 	char exten[AST_MAX_EXTENSION];
 	char language[MAX_LANGUAGE];
 	char musicclass[MAX_MUSICCLASS];
+	char parkinglot[AST_MAX_EXTENSION];		/*!< Parking lot for this channel */
 #ifdef PRI_ANI
 	char cid_ani[AST_MAX_EXTENSION];
 #endif
@@ -5288,6 +5290,8 @@
 			ast_string_field_set(tmp, language, i->language);
 		if (!ast_strlen_zero(i->musicclass))
 			ast_string_field_set(tmp, musicclass, i->musicclass);
+		if (!ast_strlen_zero(i->parkinglot))
+			ast_copy_string(tmp->parkinglot, i->parkinglot, sizeof(tmp->parkinglot));
 		if (!i->owner)
 			i->owner = tmp;
 		if (!ast_strlen_zero(i->accountcode))
@@ -7492,9 +7496,10 @@
 		}
 		tmp->canpark = canpark;
 		tmp->transfer = transfer;
-		ast_copy_string(tmp->defcontext,context,sizeof(tmp->defcontext));
+		ast_copy_string(tmp->defcontext, context,sizeof(tmp->defcontext));
 		ast_copy_string(tmp->language, language, sizeof(tmp->language));
 		ast_copy_string(tmp->musicclass, musicclass, sizeof(tmp->musicclass));
+		ast_copy_string(tmp->parkinglot, parkinglot, sizeof(tmp->parkinglot));
 		ast_copy_string(tmp->context, context, sizeof(tmp->context));
 		ast_copy_string(tmp->cid_num, cid_num, sizeof(tmp->cid_num));
 		tmp->cid_ton = 0;
@@ -10816,6 +10821,8 @@
 			ast_copy_string(progzone, v->value, sizeof(progzone));
 		} else if (!strcasecmp(v->name, "musiconhold") || !strcasecmp(v->name, "musicclass")) {
 			ast_copy_string(musicclass, v->value, sizeof(musicclass));
+		} else if (!strcasecmp(v->name, "parkinglot")) {
+			ast_copy_string(parkinglot, v->value, sizeof(parkinglot));
 		} else if (!strcasecmp(v->name, "stripmsd")) {
 			stripmsd = atoi(v->value);
 		} else if (!strcasecmp(v->name, "jitterbuffers")) {

Modified: team/oej/test-this-branch/cli.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/cli.c?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/cli.c (original)
+++ team/oej/test-this-branch/cli.c Fri Feb 24 08:32:35 2006
@@ -734,7 +734,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->tech->type, c->uniqueid,
 		(c->cid.cid_num ? c->cid.cid_num : "(N/A)"),
 		(c->cid.cid_name ? c->cid.cid_name : "(N/A)"),
@@ -747,7 +750,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/test-this-branch/configs/features.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/configs/features.conf.sample?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/configs/features.conf.sample (original)
+++ team/oej/test-this-branch/configs/features.conf.sample Fri Feb 24 08:32:35 2006
@@ -3,9 +3,10 @@
 ;
 
 [general]
-parkext => 700			; What ext. to dial to park
-parkpos => 701-720		; What extensions to park calls on
-context => parkedcalls		; Which context parked calls are in
+parkext => 700			; What ext. to dial to park	(all parking lots)
+parkpos => 701-720		; What extensions to park calls on (default parking lot)
+context => parkedcalls		; Which context parked calls are in (default parking lot)
+;findslot => next		; Continue to the 'next' parking space. Defaults to 'first' available (default parking lot)
 ;parkingtime => 45		; Number of seconds a call can be parked for 
 				; (default is 45 seconds)
 ;transferdigittimeout => 3	; Number of seconds to wait between digits when transfering a call
@@ -17,10 +18,10 @@
 ;xfersound = beep		; to indicate an attended transfer is complete
 ;xferfailsound = beeperr	; to indicate a failed transfer
 ;adsipark = yes			; if you want ADSI parking announcements
-;findslot => next		; Continue to the 'next' parking space. Defaults to 'first' available
 ;pickupexten = *8		; Configure the pickup extension.  Default is *8
 ;featuredigittimeout = 500	; Max time (ms) between digits for 
 				; feature activation.  Default is 500
+
 
 
 [featuremap]
@@ -34,3 +35,13 @@
 						;callee if #9 was pressed
 ;pauseMonitor   => #1,caller,Pausemonitor	;Pause monitoring on channel
 ;unpauseMonitor => #3,caller,UnPauseMonitor	;Unpause monitoring on channel
+
+;*** Define another parking lot
+;
+; To use it set the channel variable PARKINGLOT
+; either in the dialplan or with the setvar option in the channel configuration
+;
+;[edvina]
+;context => edvinapark
+;parkpos => 800-850
+;findslot => next

Modified: team/oej/test-this-branch/configs/iax.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/configs/iax.conf.sample?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/configs/iax.conf.sample (original)
+++ team/oej/test-this-branch/configs/iax.conf.sample Fri Feb 24 08:32:35 2006
@@ -275,6 +275,10 @@
 ;rtignoreexpire=yes		; When reading a peer from Realtime, if the peer's registration
 				; has expired based on its registration interval, used the stored
 				; address information regardless. (yes|no)
+
+;parkinglot=edvina		; Default parkinglot for IAX peers and users
+				; This can also be configured per device
+				; Parkinglots are defined in features.conf
 
 ; Guest sections for unauthenticated connection attempts.  Just specify an
 ; empty secret, or provide no secret section.

Modified: team/oej/test-this-branch/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/configs/sip.conf.sample?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/configs/sip.conf.sample (original)
+++ team/oej/test-this-branch/configs/sip.conf.sample Fri Feb 24 08:32:35 2006
@@ -76,6 +76,9 @@
 ;allow=ilbc			; 
 ;musicclass=default		; Sets the default music on hold class for all SIP calls
 				; This may also be set for individual users/peers
+;parkinglot=plaza		; Sets the default parking lot for call parking
+				; This may also be set for individual users/peers
+				; Parkinglots are configured in features.conf
 ;language=en			; Default language setting for all users/peers
 				; This may also be set for individual users/peers
 ;relaxdtmf=yes			; Relax dtmf handling

Modified: team/oej/test-this-branch/file.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/file.c?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/file.c (original)
+++ team/oej/test-this-branch/file.c Fri Feb 24 08:32:35 2006
@@ -53,46 +53,46 @@
 #include "asterisk/linkedlists.h"
 
 struct ast_format {
-	/*! Name of format */
+	/* Name of format */
 	char name[80];
-	/*! Extensions (separated by | if more than one) 
-	    this format can read.  First is assumed for writing (e.g. .mp3) */
+	/* Extensions (separated by | if more than one) 
+	   this format can read.  First is assumed for writing (e.g. .mp3) */
 	char exts[80];
-	/*! Format of frames it uses/provides (one only) */
+	/* Format of frames it uses/provides (one only) */
 	int format;
-	/*! Open an input stream, and start playback */
+	/* Open an input stream, and start playback */
 	struct ast_filestream * (*open)(FILE * f);
-	/*! Open an output stream, of a given file descriptor and comment it appropriately if applicable */
+	/* Open an output stream, of a given file descriptor and comment it appropriately if applicable */
 	struct ast_filestream * (*rewrite)(FILE *f, const char *comment);
-	/*! Write a frame to a channel */
+	/* Write a frame to a channel */
 	int (*write)(struct ast_filestream *, struct ast_frame *);
-	/*! seek num samples into file, whence(think normal seek) */
+	/* seek num samples into file, whence(think normal seek) */
 	int (*seek)(struct ast_filestream *, off_t offset, int whence);
-	/*! trunc file to current position */
+	/* trunc file to current position */
 	int (*trunc)(struct ast_filestream *fs);
-	/*! tell current position */
+	/* tell current position */
 	off_t (*tell)(struct ast_filestream *fs);
-	/*! Read the next frame from the filestream (if available) and report when to get next one
+	/* Read the next frame from the filestream (if available) and report when to get next one
 		(in samples) */
 	struct ast_frame * (*read)(struct ast_filestream *, int *whennext);
-	/*! Close file, and destroy filestream structure */
+	/* Close file, and destroy filestream structure */
 	void (*close)(struct ast_filestream *);
-	/*! Retrieve file comment */
+	/* Retrieve file comment */
 	char * (*getcomment)(struct ast_filestream *);
-	/*! Link */
+	/* Link */
 	AST_LIST_ENTRY(ast_format) list;
 };
 
 struct ast_filestream {
-	/*! Everybody reserves a block of AST_RESERVED_POINTERS pointers for us */
+	/* Everybody reserves a block of AST_RESERVED_POINTERS pointers for us */
 	struct ast_format *fmt;
 	int flags;
 	mode_t mode;
 	char *filename;
 	char *realfilename;
-	/*! Video file stream */
+	/* Video file stream */
 	struct ast_filestream *vfs;
-	/*! Transparently translate from another format -- just once */
+	/* Transparently translate from another format -- just once */
 	struct ast_trans_pvt *trans;
 	struct ast_tranlator_pvt *tr;
 	int lastwriteformat;

Modified: team/oej/test-this-branch/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/include/asterisk/channel.h?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/include/asterisk/channel.h (original)
+++ team/oej/test-this-branch/include/asterisk/channel.h Fri Feb 24 08:32:35 2006
@@ -293,8 +293,13 @@
 	/*! File descriptor for channel -- Drivers will poll on these file descriptors, so at least one must be non -1.  */
 	int fds[AST_MAX_FDS];			
 
+
+	/*! 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 */

Modified: team/oej/test-this-branch/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/res/res_features.c?rev=11014&r1=11013&r2=11014&view=diff
==============================================================================
--- team/oej/test-this-branch/res/res_features.c (original)
+++ team/oej/test-this-branch/res/res_features.c Fri Feb 24 08:32:35 2006
@@ -14,6 +14,22 @@
  * This program is free software, distributed under the terms of
  * the GNU General Public License Version 2. See the LICENSE file
  * at the top of the source tree.
+ */
+
+/*----------------- BRANCH NOTE *------------------------------ 
+ * This code is under development 
+ *
+ * Input is appreciated, e-mail to oej at edvina.net
+ *
+ *	Goal:
+ *	 To implement multiple parking lots, so that if you
+ *	 run a virtual PBX with many customers in the same
+ * 	 Asterisk, you can set up multiple parking lots
+ *	 Or one for each group in your company
+ * 	 And maybe a special VIP parking lot for the boss :-)
+ *
+ *	Plase add test reviews to the bug tracker
+ *	http://bugs.digium.com/view.php?id=6113
  */
 
 /*! \file
@@ -67,34 +83,50 @@
 #define FREE free
 #endif
 
-#define DEFAULT_PARK_TIME 45000
-#define DEFAULT_TRANSFER_DIGIT_TIMEOUT 3000
+#define DEFAULT_PARK_TIME 45000				/*!< Default parking time */
+#define DEFAULT_TRANSFER_DIGIT_TIMEOUT 3000		
 #define DEFAULT_FEATURE_DIGIT_TIMEOUT 500
+#define DEFAULT_PARKINGLOT "default"			/*!< Default parking lot */
 
 #define AST_MAX_WATCHERS 256
 
 static char *parkedcall = "ParkedCall";
 
-static int parkingtime = DEFAULT_PARK_TIME; 		/*!< No more than 45 seconds parked before you do something with them */
-static char parking_con[AST_MAX_EXTENSION];		/*!< Context for which parking is made accessible */
-static char parking_con_dial[AST_MAX_EXTENSION];	/*!< Context for dialback for parking (KLUDGE) */
-static char parking_ext[AST_MAX_EXTENSION];		/*!< Extension you type to park the call */
+static int parkingtime = DEFAULT_PARK_TIME;		/*!< No more than 45 seconds parked before you do something with them */
 static char pickup_ext[AST_MAX_EXTENSION];		/*!< Call pickup extension */
-static int parking_start;				/*!< First available extension for parking */
-static int parking_stop;				/*!< Last available extension for parking */
-
+
+/* This is used in many modules, so for now it's the same for all parking lots */
+static char parking_ext[AST_MAX_EXTENSION] = "700";	/*!< Extension you type to park the call */
+
+/* Default sounds */
 static char courtesytone[256];				/*!< Courtesy tone */
-static int parkedplay = 0;				/*!< Who to play the courtesy tone to */
 static char xfersound[256];				/*!< Call transfer sound */
 static char xferfailsound[256];				/*!< Call transfer failure sound */
 
-static int parking_offset;
-static int parkfindnext;
-
-static int adsipark;
-
-static int transferdigittimeout;
-static int featuredigittimeout;
+static int parkedplay = 0;				/*!< Who to play the courtesy tone to */
+
+/*! \brief Structure for parking lots in a linked list. */
+struct ast_parkinglot {
+	char name[AST_MAX_EXTENSION];			/*!< Name for this lot (used in other configs) */
+	char parking_con[AST_MAX_EXTENSION];		/*!< Context for which parking is made accessible */
+	char parking_con_dial[AST_MAX_EXTENSION];	/*!< Context for dialback for parking (KLUDGE) */
+	int parking_start;				/*!< First available extension for parking */
+	int parking_stop;				/*!< Last available extension for parking */
+	int parking_offset;
+	int parkfindnext;
+	int parkingtime;				/*!< Default parking time */
+	struct parkeduser *occupiedlots;
+	AST_LIST_ENTRY(ast_parkinglot) list;		/*!< List entry */
+};
+
+static AST_LIST_HEAD_STATIC(parkinglots, ast_parkinglot);
+
+struct ast_parkinglot *default_parkinglot;
+
+static int adsipark = 0;
+
+static int transferdigittimeout = DEFAULT_TRANSFER_DIGIT_TIMEOUT;
+static int featuredigittimeout = DEFAULT_FEATURE_DIGIT_TIMEOUT;
 
 static char *registrar = "res_features";		/*!< Registrar for operations */
 
@@ -111,7 +143,7 @@
 
 static char *synopsis2 = "Park yourself";
 
-static char *descrip2 = "Park(exten):"
+static char *descrip2 = "Park():"
 "Used to park yourself (typically in combination with a supervised\n"
 "transfer to know the parking space). This application is always\n"
 "registered internally and does not need to be explicitly added\n"
@@ -121,6 +153,7 @@
 static struct ast_app *monitor_app = NULL;
 static int monitor_ok = 1;
 
+/*! \brief Structure to handle one parked user */ 
 struct parkeduser {
 	struct ast_channel *chan;
 	struct timeval start;
@@ -134,15 +167,17 @@
 	char peername[1024];
 	unsigned char moh_trys;
 	struct parkeduser *next;
+	struct ast_parkinglot *parkinglot;
 };
 
-static struct parkeduser *parkinglot;
-
+
+/*!  Lock for parking */
 AST_MUTEX_DEFINE_STATIC(parking_lock);
 
 static pthread_t parking_thread;
 
 LOCAL_USER_DECL;
+
 
 char *ast_parking_ext(void)
 {
@@ -161,6 +196,11 @@
 	struct ast_channel *peer;
 };
 
+/* Forward declarations */
+int ast_park_call_full(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout, struct ast_parkinglot *parkinglot);
+struct ast_parkinglot *find_parkinglot(const char *name);
+
+/*! If GOTO_ON_BLINDXFR is set, transferer in a blind transfer will be sent there. */
 static void check_goto_on_transfer(struct ast_channel *chan) 
 {
 	struct ast_channel *xferchan;
@@ -197,7 +237,6 @@
 static void *ast_bridge_call_thread(void *data) 
 {
 	struct ast_bridge_thread_obj *tobj = data;
-
 	tobj->chan->appl = "Transferred Call";
 	tobj->chan->data = (char *) tobj->peer->name;
 	tobj->peer->appl = "Transferred Call";
@@ -211,6 +250,7 @@
 		ast_cdr_setdestchan(tobj->peer->cdr, tobj->chan->name);
 	}
 
+
 	ast_bridge_call(tobj->peer, tobj->chan, &tobj->bconfig);
 	ast_hangup(tobj->chan);
 	ast_hangup(tobj->peer);
@@ -220,6 +260,7 @@
 	return NULL;
 }
 
+
 static void ast_bridge_call_thread_launch(void *data) 
 {
 	pthread_t thread;
@@ -234,8 +275,6 @@
 	pthread_setschedparam(thread, SCHED_RR, &sched);
 }
 
-
-
 static int adsi_announce_park(struct ast_channel *chan, int parkingnum)
 {
 	int res;
@@ -252,24 +291,58 @@
 	return adsi_print(chan, message, justify, 1);
 }
 
+/*! \brief Find parking lot name from channel */
+static char *findparkinglotname(struct ast_channel *chan)
+{
+	char *temp, *parkinglot;
+
+	/* Check if the channel has a parking lot */
+	if (!ast_strlen_zero(chan->parkinglot))
+		parkinglot = chan->parkinglot;
+
+	/* Channel variables override everything */
+
+	if ((temp  = pbx_builtin_getvar_helper(chan, "PARKINGLOT")))
+		return temp;
+
+	return parkinglot;
+}
+
 /*! \brief Park a call 
  	We put the user in the parking list, then wake up the parking thread to be sure it looks
 	after these channels too */
-int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout)
+int ast_park_call_full(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout, struct ast_parkinglot *parkinglot)
 {
 	struct parkeduser *pu, *cur;
-	int i,x,parking_range;
+	int i, x, parking_range;
 	char exten[AST_MAX_EXTENSION];
 	struct ast_context *con;
+	const char *parkinglotname;
+	
+
+
+	parkinglotname = findparkinglotname(peer);
+
+	if (parkinglotname) {
+		if (option_debug)
+			ast_log(LOG_DEBUG, "---------**--------- Found chanvar Parkinglot: %s\n", parkinglotname);
+		parkinglot = find_parkinglot(parkinglotname);	
+	}
+	if (!parkinglot)
+		parkinglot = default_parkinglot;
+
+	if (option_debug)
+		ast_log(LOG_DEBUG, "---------**--------- Parkinglot: %s\n", parkinglot->name);
+
 	
 	if (!(pu = ast_calloc(1, sizeof(*pu)))) {
 		return -1;
 	}
 	ast_mutex_lock(&parking_lock);
-	parking_range = parking_stop - parking_start+1;
+	parking_range = parkinglot->parking_stop - parkinglot->parking_start + 1;
 	for (i = 0; i < parking_range; i++) {
-		x = (i + parking_offset) % parking_range + parking_start;
-		cur = parkinglot;
+		x = (i + parkinglot->parking_offset) % parking_range + parkinglot->parking_start;
+		cur = parkinglot->occupiedlots;
 		while(cur) {
 			if (cur->parkingnum == x) 
 				break;
@@ -280,17 +353,19 @@
 	}
 
 	if (!(i < parking_range)) {
-		ast_log(LOG_WARNING, "No more parking spaces\n");
+		ast_log(LOG_WARNING, "No more parking spaces in parking lot \"%s\"\n", parkinglot->name);
 		free(pu);
 		ast_mutex_unlock(&parking_lock);
 		return -1;
 	}
-	if (parkfindnext) 
-		parking_offset = x - parking_start + 1;
+	if (parkinglot->parkfindnext) 
+		parkinglot->parking_offset = x - parkinglot->parking_start + 1;
+
 	chan->appl = "Parked Call";
 	chan->data = NULL; 
 
 	pu->chan = chan;
+
 	/* Start music on hold */
 	if (chan != peer) {
 		ast_indicate(pu->chan, AST_CONTROL_HOLD);
@@ -298,13 +373,17 @@
 	}
 	pu->start = ast_tvnow();
 	pu->parkingnum = x;
+	pu->parkinglot = parkinglot;
+
 	if (timeout > 0)
 		pu->parkingtime = timeout;
 	else
 		pu->parkingtime = parkingtime;
+
 	if (extout)
 		*extout = x;
-	if (peer) 
+
+	if (peer) 	/* Parking channel */
 		ast_copy_string(pu->peername, peer->name, sizeof(pu->peername));
 
 	/* Remember what had been dialed, so that if the parking
@@ -321,8 +400,8 @@
 		pu->priority = chan->macropriority;
 	else
 		pu->priority = chan->priority;
-	pu->next = parkinglot;
-	parkinglot = pu;
+	pu->next = parkinglot->occupiedlots;
+	parkinglot->occupiedlots = pu;
 	/* If parking a channel directly, don't quiet yet get parking running on it */
 	if (peer == chan) 
 		pu->notquiteyet = 1;
@@ -330,34 +409,31 @@
 	/* Wake up the (presumably select()ing) thread */
 	pthread_kill(parking_thread, SIGURG);
 	if (option_verbose > 1) 
-		ast_verbose(VERBOSE_PREFIX_2 "Parked %s on %d. Will timeout back to extension [%s] %s, %d in %d seconds\n", pu->chan->name, pu->parkingnum, pu->context, pu->exten, pu->priority, (pu->parkingtime/1000));
+		ast_verbose(VERBOSE_PREFIX_2 "Parked %s on %d (lot %s). Will timeout back to extension [%s] %s, %d in %d seconds\n", pu->chan->name, pu->parkingnum, parkinglot->name, pu->context, pu->exten, pu->priority, (pu->parkingtime/1000));
 
 	manager_event(EVENT_FLAG_CALL, "ParkedCall",
 		"Exten: %d\r\n"
 		"Channel: %s\r\n"
+		"Parkinglot: %s\r\n"
 		"From: %s\r\n"
 		"Timeout: %ld\r\n"
 		"CallerID: %s\r\n"
 		"CallerIDName: %s\r\n"
-		,pu->parkingnum, pu->chan->name, peer->name
+		,pu->parkingnum, pu->chan->name, pu->parkinglot->name, peer->name
 		,(long)pu->start.tv_sec + (long)(pu->parkingtime/1000) - (long)time(NULL)
 		,(pu->chan->cid.cid_num ? pu->chan->cid.cid_num : "<unknown>")
 		,(pu->chan->cid.cid_name ? pu->chan->cid.cid_name : "<unknown>")
 		);
 
-	if (peer) {
-		if (adsipark && adsi_available(peer)) {
+	if (peer && adsipark && adsi_available(peer)) {
 			adsi_announce_park(peer, pu->parkingnum);
-		}
-		if (adsipark && adsi_available(peer)) {
 			adsi_unload_session(peer);
-		}
-	}
-	con = ast_context_find(parking_con);
+	}
+	con = ast_context_find(parkinglot->parking_con);
 	if (!con) {
-		con = ast_context_create(NULL, parking_con, registrar);
+		con = ast_context_create(NULL, parkinglot->parking_con, registrar);
 		if (!con) {
-			ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parking_con);
+			ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parkinglot->parking_con);
 		}
 	}
 	if (con) {
@@ -373,6 +449,11 @@
 		pthread_kill(parking_thread, SIGURG);
 	}
 	return 0;
+}
+
+int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout)
+{
+	return ast_park_call_full(chan, peer, timeout, extout, NULL);
 }
 
 int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int timeout, int *extout)
@@ -1070,7 +1151,8 @@
 	
 	if ((chan = ast_request(type, format, data, &cause))) {
 		ast_set_callerid(chan, cid_num, cid_name, cid_num);
-		ast_channel_inherit_variables(caller, chan);	
+		ast_channel_inherit_variables(caller, chan);
+		
 		if (!ast_call(chan, data, timeout)) {
 			struct timeval started;
 			int x, len = 0;
@@ -1451,6 +1533,7 @@
 	return res;
 }
 
+/*--- do_parking_thred: Take care of parked calls and unpark them if needed */
 static void *do_parking_thread(void *ignore)
 {
 	int ms, tms, max;
@@ -1461,6 +1544,7 @@
 	char *peername,*cp;
 	char returnexten[AST_MAX_EXTENSION];
 	struct ast_context *con;
+	struct ast_parkinglot *curlot;
 	int x;
 	fd_set rfds, efds;
 	fd_set nrfds, nefds;
@@ -1472,152 +1556,154 @@
 		max = -1;
 		ast_mutex_lock(&parking_lock);
 		pl = NULL;
-		pu = parkinglot;
-		FD_ZERO(&nrfds);
-		FD_ZERO(&nefds);
-		while(pu) {
-			if (pu->notquiteyet) {
-				/* Pretend this one isn't here yet */
-				pl = pu;
-				pu = pu->next;
-				continue;
-			}
-			tms = ast_tvdiff_ms(ast_tvnow(), pu->start);

[... 848 lines stripped ...]


More information about the asterisk-commits mailing list