[asterisk-commits] jpeeler: trunk r114487 - in /trunk: apps/ channels/ configs/ funcs/ include/a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 21 18:42:46 CDT 2008


Author: jpeeler
Date: Mon Apr 21 18:42:45 2008
New Revision: 114487

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114487
Log:
(closes issue #6113)
Reported by: oej
Tested by: jpeeler

This patch implements multiple parking lots for parked calls. The default parkinglot is used by default, however setting the channel variable PARKINGLOT in the dialplan will allow use of any other configured parkinglot. See configs/features.conf.sample for more details on setting up another non-default parkinglot. Also, one can (currently) set the default parkinglot to use in the driver configuration file via the parkinglot option.

Patch initially written by oej, brought up to date and finalized by mvanbaak, and then stabilized and converted to astobj2 by me.


Modified:
    trunk/apps/app_dumpchan.c
    trunk/channels/chan_console.c
    trunk/channels/chan_gtalk.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_jingle.c
    trunk/channels/chan_mgcp.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c
    trunk/channels/chan_unistim.c
    trunk/channels/chan_zap.c
    trunk/configs/features.conf.sample
    trunk/configs/iax.conf.sample
    trunk/configs/sip.conf.sample
    trunk/funcs/func_channel.c
    trunk/include/asterisk/channel.h
    trunk/main/features.c

Modified: trunk/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dumpchan.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/apps/app_dumpchan.c (original)
+++ trunk/apps/app_dumpchan.c Mon Apr 21 18:42:45 2008
@@ -75,6 +75,7 @@
 			"CallerIDName=       %s\n"
 			"DNIDDigits=         %s\n"
 			"RDNIS=              %s\n"
+			"Parkinglot=         %s\n"
 			"Language=           %s\n"
 			"State=              %s (%d)\n"
 			"Rings=              %d\n"
@@ -103,6 +104,7 @@
 			S_OR(c->cid.cid_name, "(N/A)"),
 			S_OR(c->cid.cid_dnid, "(N/A)"),
 			S_OR(c->cid.cid_rdnis, "(N/A)"),
+			c->parkinglot,
 			c->language,
 			ast_state2str(c->_state),
 			c->_state,

Modified: trunk/channels/chan_console.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_console.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/channels/chan_console.c (original)
+++ trunk/channels/chan_console.c Mon Apr 21 18:42:45 2008
@@ -141,6 +141,8 @@
 		AST_STRING_FIELD(mohinterpret);
 		/*! Default language */
 		AST_STRING_FIELD(language);
+		/*! Default parkinglot */
+		AST_STRING_FIELD(parkinglot);
 	);
 	/*! Current channel for this device */
 	struct ast_channel *owner;
@@ -1004,6 +1006,7 @@
 		               "=== ---> CallerID Name:    %s\n"
 		               "=== ---> MOH Interpret:    %s\n"
 		               "=== ---> Language:         %s\n"
+		               "=== ---> Parkinglot:       %s\n"
 		               "=== ---> Muted:            %s\n"
 		               "=== ---> Auto-Answer:      %s\n"
 		               "=== ---> Override Context: %s\n"
@@ -1011,7 +1014,7 @@
 			pvt->name, (pvt == active_pvt) ? "Yes" : "No",
 			pvt->input_device, pvt->output_device, pvt->context,
 			pvt->exten, pvt->cid_num, pvt->cid_name, pvt->mohinterpret,
-			pvt->language, pvt->muted ? "Yes" : "No", pvt->autoanswer ? "Yes" : "No",
+			pvt->language, pvt->parkinglot, pvt->muted ? "Yes" : "No", pvt->autoanswer ? "Yes" : "No",
 			pvt->overridecontext ? "Yes" : "No");
 
 		console_pvt_unlock(pvt);
@@ -1236,6 +1239,7 @@
 		ast_string_field_set(pvt, language, "");
 		ast_string_field_set(pvt, cid_num, "");
 		ast_string_field_set(pvt, cid_name, "");
+		ast_string_field_set(pvt, parkinglot, "");
 	
 		pvt->overridecontext = 0;
 		pvt->autoanswer = 0;
@@ -1248,6 +1252,7 @@
 		ast_string_field_set(pvt, language, globals.language);
 		ast_string_field_set(pvt, cid_num, globals.cid_num);
 		ast_string_field_set(pvt, cid_name, globals.cid_name);
+		ast_string_field_set(pvt, parkinglot, globals.parkinglot);
 
 		pvt->overridecontext = globals.overridecontext;
 		pvt->autoanswer = globals.autoanswer;
@@ -1287,6 +1292,7 @@
 	CV_F("callerid", store_callerid(pvt, value));
 	CV_BOOL("overridecontext", pvt->overridecontext);
 	CV_BOOL("autoanswer", pvt->autoanswer);
+	CV_STRFIELD("parkinglot", pvt, parkinglot);
 
 	if (pvt != &globals) {
 		CV_F("active", set_active(pvt, value))

Modified: trunk/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_gtalk.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/channels/chan_gtalk.c (original)
+++ trunk/channels/chan_gtalk.c Mon Apr 21 18:42:45 2008
@@ -142,6 +142,7 @@
 	int amaflags;			/*!< AMA Flags */
 	char user[AJI_MAX_JIDLEN];
 	char context[AST_MAX_CONTEXT];
+	char parkinglot[AST_MAX_CONTEXT];	/*!<  Parkinglot */
 	char accountcode[AST_MAX_ACCOUNT_CODE];	/*!< Account code */
 	int capability;
 	ast_group_t callgroup;	/*!< Call group */
@@ -1024,6 +1025,8 @@
 		ast_string_field_set(tmp, language, client->language);
 	if (!ast_strlen_zero(client->musicclass))
 		ast_string_field_set(tmp, musicclass, client->musicclass);
+	if (!ast_strlen_zero(client->parkinglot))
+		ast_string_field_set(tmp, parkinglot, client->parkinglot);
 	i->owner = tmp;
 	ast_module_ref(ast_module_info->self);
 	ast_copy_string(tmp->context, client->context, sizeof(tmp->context));
@@ -1794,6 +1797,8 @@
 			ast_parse_allow_disallow(&member->prefs, &member->capability, var->value, 1);
 		else if (!strcasecmp(var->name, "context"))
 			ast_copy_string(member->context, var->value, sizeof(member->context));
+		else if (!strcasecmp(var->name, "parkinglot"))
+			ast_copy_string(member->parkinglot, var->value, sizeof(member->parkinglot));
 #if 0
 		else if (!strcasecmp(var->name, "candidate")) {
 			candidate = gtalk_create_candidate(var->value);
@@ -1832,6 +1837,7 @@
 	char *cat = NULL;
 	struct ast_config *cfg = NULL;
 	char context[AST_MAX_CONTEXT];
+	char parkinglot[AST_MAX_CONTEXT];
 	int allowguest = 1;
 	struct ast_variable *var;
 	struct gtalk *member;
@@ -1864,6 +1870,8 @@
 			ast_parse_allow_disallow(&prefs, &global_capability, var->value, 1);
 		else if (!strcasecmp(var->name, "context"))
 			ast_copy_string(context, var->value, sizeof(context));
+		else if (!strcasecmp(var->name, "parkinglot"))
+			ast_copy_string(parkinglot, var->value, sizeof(parkinglot));
 		else if (!strcasecmp(var->name, "bindaddr")) {
 			if (!(hp = ast_gethostbyname(var->value, &ahp))) {
 				ast_log(LOG_WARNING, "Invalid address: %s\n", var->value);
@@ -1892,6 +1900,7 @@
 				ast_copy_string(member->name, "guest", sizeof(member->name));
 				ast_copy_string(member->user, "guest", sizeof(member->user));
 				ast_copy_string(member->context, context, sizeof(member->context));
+				ast_copy_string(member->parkinglot, parkinglot, sizeof(member->parkinglot));
 				member->allowguest = allowguest;
 				member->prefs = prefs;
 				while (var) {
@@ -1904,6 +1913,9 @@
 					else if (!strcasecmp(var->name, "context"))
 						ast_copy_string(member->context, var->value,
 										sizeof(member->context));
+					else if (!strcasecmp(var->name, "parkinglot"))
+						ast_copy_string(member->parkinglot, var->value,
+										sizeof(member->parkinglot));
 /*  Idea to allow for custom candidates  */
 /*
 					else if (!strcasecmp(var->name, "candidate")) {

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Mon Apr 21 18:42:45 2008
@@ -26,6 +26,8 @@
  * \arg \ref Config_iax
  *
  * \ingroup channel_drivers
+ * 
+ * \todo Implement musicclass settings for IAX2 devices
  */
 
 /*** MODULEINFO
@@ -140,6 +142,7 @@
 
 
 static char context[80] = "default";
+static char default_parkinglot[AST_MAX_CONTEXT];
 
 static char language[MAX_LANGUAGE] = "";
 static char regcontext[AST_MAX_CONTEXT] = "";
@@ -298,6 +301,7 @@
 		AST_STRING_FIELD(language);
 		AST_STRING_FIELD(cid_num);
 		AST_STRING_FIELD(cid_name);
+		AST_STRING_FIELD(parkinglot);           /*!< Default parkinglot for device */
 	);
 	
 	int authmethods;
@@ -333,6 +337,7 @@
 		AST_STRING_FIELD(cid_num);		/*!< Default context (for transfer really) */
 		AST_STRING_FIELD(cid_name);		/*!< Default context (for transfer really) */
 		AST_STRING_FIELD(zonetag);		/*!< Time Zone */
+		AST_STRING_FIELD(parkinglot);   /*!< Default parkinglot for device */
 	);
 	struct ast_codec_pref prefs;
 	struct ast_dnsmgr_entry *dnsmgr;		/*!< DNS refresh manager */
@@ -580,6 +585,8 @@
 		AST_STRING_FIELD(mohsuggest);
 		/*! received OSP token */
 		AST_STRING_FIELD(osptoken);
+		/*! Default parkinglot */
+		AST_STRING_FIELD(parkinglot);
 	);
 	
 	/*! permitted authentication methods */
@@ -1555,6 +1562,7 @@
 			ast_string_field_set(iaxs[x], accountcode, accountcode);
 			ast_string_field_set(iaxs[x], mohinterpret, mohinterpret);
 			ast_string_field_set(iaxs[x], mohsuggest, mohsuggest);
+			ast_string_field_set(iaxs[x], parkinglot, default_parkinglot);
 		} else {
 			ast_log(LOG_WARNING, "Out of resources\n");
 			ast_mutex_unlock(&iaxsl[x]);
@@ -2437,6 +2445,7 @@
 		ast_cli(a->fd, "  * Name       : %s\n", peer->name);
 		ast_cli(a->fd, "  Secret       : %s\n", ast_strlen_zero(peer->secret) ? "<Not set>" : "<Set>");
 		ast_cli(a->fd, "  Context      : %s\n", peer->context);
+ 		ast_cli(a->fd, "  Parking lot  : %s\n", peer->parkinglot);
 		ast_cli(a->fd, "  Mailbox      : %s\n", peer->mailbox);
 		ast_cli(a->fd, "  Dynamic      : %s\n", ast_test_flag(peer, IAX_DYNAMIC) ? "Yes" : "No");
 		ast_cli(a->fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
@@ -3916,6 +3925,8 @@
 	tmp->writeformat = ast_best_codec(capability);
 	tmp->tech_pvt = CALLNO_TO_PTR(i->callno);
 
+	if (!ast_strlen_zero(i->parkinglot))
+		ast_string_field_set(tmp, parkinglot, i->parkinglot);
 	/* Don't use ast_set_callerid() here because it will
 	 * generate a NewCallerID event before the NewChannel event */
 	if (!ast_strlen_zero(i->ani))
@@ -5739,6 +5750,8 @@
 			ast_string_field_set(iaxs[callno], mohinterpret, user->mohinterpret);
 		if (!ast_strlen_zero(user->mohsuggest))
 			ast_string_field_set(iaxs[callno], mohsuggest, user->mohsuggest);
+		if (!ast_strlen_zero(user->parkinglot))
+			ast_string_field_set(iaxs[callno], parkinglot, user->parkinglot);
 		if (user->amaflags)
 			iaxs[callno]->amaflags = user->amaflags;
 		if (!ast_strlen_zero(user->language))
@@ -10421,6 +10434,8 @@
 				ast_string_field_set(user, mohinterpret, v->value);
 			} else if (!strcasecmp(v->name, "mohsuggest")) {
 				ast_string_field_set(user, mohsuggest, v->value);
+			} else if (!strcasecmp(v->name, "parkinglot")) {
+				ast_string_field_set(user, parkinglot, v->value);
 			} else if (!strcasecmp(v->name, "language")) {
 				ast_string_field_set(user, language, v->value);
 			} else if (!strcasecmp(v->name, "amaflags")) {
@@ -10622,6 +10637,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;
@@ -10818,6 +10835,8 @@
 		} else if (!strcasecmp(v->name, "cos")) {
 			if (ast_str2cos(v->value, &cos))
 				ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "parkinglot")) {
+			ast_copy_string(default_parkinglot, v->value, sizeof(default_parkinglot));
 		} else if (!strcasecmp(v->name, "accountcode")) {
 			ast_copy_string(accountcode, v->value, sizeof(accountcode));
 		} else if (!strcasecmp(v->name, "mohinterpret")) {

Modified: trunk/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_jingle.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/channels/chan_jingle.c (original)
+++ trunk/channels/chan_jingle.c Mon Apr 21 18:42:45 2008
@@ -151,6 +151,7 @@
 	int allowguest;
 	char language[MAX_LANGUAGE];	/*!<  Default language for prompts */
 	char musicclass[MAX_MUSICCLASS];	/*!<  Music on Hold class */
+	char parkinglot[AST_MAX_CONTEXT];   /*!< Parkinglot */
 };
 
 struct jingle_container {
@@ -1741,6 +1742,9 @@
 					else if (!strcasecmp(var->name, "context"))
 						ast_copy_string(member->context, var->value,
 										sizeof(member->context));
+					else if (!strcasecmp(var->name, "parkinglot"))
+						ast_copy_string(member->parkinglot, var->value,
+										sizeof(member->parkinglot));
 /*  Idea to allow for custom candidates  */
 /*
 					else if (!strcasecmp(var->name, "candidate")) {

Modified: trunk/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_mgcp.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/channels/chan_mgcp.c (original)
+++ trunk/channels/chan_mgcp.c Mon Apr 21 18:42:45 2008
@@ -143,6 +143,7 @@
 
 static char language[MAX_LANGUAGE] = "";
 static char musicclass[MAX_MUSICCLASS] = "";
+static char parkinglot[AST_MAX_CONTEXT];
 static char cid_num[AST_MAX_EXTENSION] = "";
 static char cid_name[AST_MAX_EXTENSION] = "";
 
@@ -317,6 +318,7 @@
 	char musicclass[MAX_MUSICCLASS];
 	char curtone[80];			/*!< Current tone */
 	char mailbox[AST_MAX_EXTENSION];
+	char parkinglot[AST_MAX_CONTEXT];   /*!< Parkinglot */
 	struct ast_event_sub *mwi_event_sub;
 	ast_group_t callgroup;
 	ast_group_t pickupgroup;
@@ -3685,6 +3687,8 @@
 				}
 			} else if (!strcasecmp(v->name, "musiconhold")) {
 				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, "callgroup")) {
 				cur_callergroup = ast_get_group(v->value);
 			} else if (!strcasecmp(v->name, "pickupgroup")) {
@@ -3748,6 +3752,7 @@
 					ast_copy_string(e->language, language, sizeof(e->language));
 					ast_copy_string(e->musicclass, musicclass, sizeof(e->musicclass));
 					ast_copy_string(e->mailbox, mailbox, sizeof(e->mailbox));
+					ast_copy_string(e->parkinglot, parkinglot, sizeof(e->parkinglot));
 					if (!ast_strlen_zero(e->mailbox)) {
 						char *mailbox, *context;
 						context = mailbox = ast_strdupa(e->mailbox);
@@ -3856,6 +3861,7 @@
 					ast_copy_string(e->language, language, sizeof(e->language));
 					ast_copy_string(e->musicclass, musicclass, sizeof(e->musicclass));
 					ast_copy_string(e->mailbox, mailbox, sizeof(e->mailbox));
+					ast_copy_string(e->parkinglot, parkinglot, sizeof(e->parkinglot));
 					if (!ast_strlen_zero(mailbox)) {
 						ast_verb(3, "Setting mailbox '%s' on %s@%s\n", mailbox, gw->name, e->name);
 					}

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Apr 21 18:42:45 2008
@@ -663,6 +663,7 @@
 static char default_mohinterpret[MAX_MUSICCLASS];  /*!< Global setting for moh class to use when put on hold */
 static char default_mohsuggest[MAX_MUSICCLASS];	   /*!< Global setting for moh class to suggest when putting 
                                                     *   a bridged channel on hold */
+static char default_parkinglot[AST_MAX_CONTEXT]; /*!< Parkinglot */
 static int default_maxcallbitrate;	/*!< Maximum bitrate for call */
 static struct ast_codec_pref default_prefs;		/*!< Default codec prefs */
 
@@ -1219,6 +1220,7 @@
 		AST_STRING_FIELD(rpid);		/*!< Our RPID header */
 		AST_STRING_FIELD(rpid_from);	/*!< Our RPID From header */
 		AST_STRING_FIELD(url);		/*!< URL to be sent with next message to peer */
+		AST_STRING_FIELD(parkinglot);		/*!< Parkinglot */
 	);
 	struct sip_socket socket;		/*!< The socket used for this dialog */
 	unsigned int ocseq;			/*!< Current outgoing seqno */
@@ -1405,6 +1407,7 @@
 	char language[MAX_LANGUAGE];	/*!< Default language for this user */
 	char mohinterpret[MAX_MUSICCLASS];/*!< Music on Hold class */
 	char mohsuggest[MAX_MUSICCLASS];/*!< Music on Hold class */
+	char parkinglot[AST_MAX_CONTEXT];/*!< Parkinglot */
 	char useragent[256];		/*!< User agent in SIP request */
 	struct ast_codec_pref prefs;	/*!< codec prefs */
 	ast_group_t callgroup;		/*!< Call group */
@@ -1474,6 +1477,7 @@
 	char language[MAX_LANGUAGE];	/*!<  Default language for prompts */
 	char mohinterpret[MAX_MUSICCLASS];/*!<  Music on Hold class */
 	char mohsuggest[MAX_MUSICCLASS];/*!<  Music on Hold class */
+	char parkinglot[AST_MAX_CONTEXT];/*!<  Parkinglot */
 	char useragent[256];		/*!<  User agent in SIP request (saved from registration) */
 	struct ast_codec_pref prefs;	/*!<  codec prefs */
 	int lastmsgssent;
@@ -4246,6 +4250,7 @@
 	ast_string_field_set(dialog, tohost, peer->tohost);
 	ast_string_field_set(dialog, fullcontact, peer->fullcontact);
 	ast_string_field_set(dialog, context, peer->context);
+	ast_string_field_set(dialog, parkinglot, peer->parkinglot);
 	dialog->outboundproxy = obproxy_get(dialog, peer);
 	dialog->callgroup = peer->callgroup;
 	dialog->pickupgroup = peer->pickupgroup;
@@ -6076,6 +6081,7 @@
 		p->t38.jointcapability = p->t38.capability;
 	}
 	ast_string_field_set(p, context, default_context);
+	ast_string_field_set(p, parkinglot, default_parkinglot);
 
 
 	/* Add to active dialog list */
@@ -11578,6 +11584,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);
+		ast_string_field_set(p, parkinglot, user->parkinglot);
 		p->allowtransfer = user->allowtransfer;
 		p->amaflags = user->amaflags;
 		p->callgroup = user->callgroup;
@@ -11665,6 +11672,7 @@
 	ast_string_field_set(p, subscribecontext, peer->subscribecontext);
 	ast_string_field_set(p, mohinterpret, peer->mohinterpret);
 	ast_string_field_set(p, mohsuggest, peer->mohsuggest);
+	ast_string_field_set(p, parkinglot, peer->parkinglot);
 	if (peer->callingpres)	/* Peer calling pres setting will override RPID */
 		p->callingpres = peer->callingpres;
 	if (peer->maxms && peer->lastms)
@@ -20484,6 +20492,8 @@
 			user->callgroup = ast_get_group(v->value);
 		} else if (!strcasecmp(v->name, "pickupgroup")) {
 			user->pickupgroup = ast_get_group(v->value);
+		} 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, "mohinterpret")) {
@@ -20861,6 +20871,8 @@
 			ast_copy_string(peer->mohinterpret, v->value, sizeof(peer->mohinterpret));
 		} else if (!strcasecmp(v->name, "mohsuggest")) {
 			ast_copy_string(peer->mohsuggest, v->value, sizeof(peer->mohsuggest));
+		} else if (!strcasecmp(v->name, "parkinglot")) {
+			ast_copy_string(peer->parkinglot, v->value, sizeof(peer->parkinglot));
 		} else if (!strcasecmp(v->name, "mailbox")) {
 			add_peer_mailboxes(peer, v->value);
 		} else if (!strcasecmp(v->name, "subscribemwi")) {

Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Mon Apr 21 18:42:45 2008
@@ -968,6 +968,7 @@
 static char cid_num[AST_MAX_EXTENSION] = "";
 static char cid_name[AST_MAX_EXTENSION] = "";
 static char linelabel[AST_MAX_EXTENSION] ="";
+static char parkinglot[AST_MAX_CONTEXT] ="";
 static int nat = 0;
 static ast_group_t cur_callergroup = 0;
 static ast_group_t cur_pickupgroup = 0;
@@ -1162,6 +1163,7 @@
 	char vmexten[AST_MAX_EXTENSION];
 	char regexten[AST_MAX_EXTENSION];		/* Extension for auto-extensions */
 	char regcontext[AST_MAX_CONTEXT];		/* Context for auto-extensions */
+	char parkinglot[AST_MAX_CONTEXT];		/* Parkinglot for parkedcalls */
 	char mohinterpret[MAX_MUSICCLASS];
 	char mohsuggest[MAX_MUSICCLASS];
 	char lastnumberdialed[AST_MAX_EXTENSION];	/* Last number that was dialed - used for redial */
@@ -3024,6 +3026,8 @@
 				ast_copy_string(linelabel, v->value, sizeof(linelabel));
 			} else if (!strcasecmp(v->name, "setvar")) {
 				chanvars = add_var(v->value, chanvars);
+			} else if ( !strcasecmp(v->name, "parkinglot")) {
+				ast_copy_string(parkinglot, v->value, sizeof(parkinglot));
 			} else if (!strcasecmp(v->name, "speeddial")) {
 				if (!(sd = ast_calloc(1, sizeof(*sd)))) {
 					return NULL;
@@ -3077,6 +3081,7 @@
 					ast_copy_string(l->cid_num, cid_num, sizeof(l->cid_num));
 					ast_copy_string(l->cid_name, cid_name, sizeof(l->cid_name));
 					ast_copy_string(l->label, linelabel, sizeof(l->label));
+					ast_copy_string(l->parkinglot, parkinglot, sizeof(l->parkinglot));
 					ast_copy_string(l->language, language, sizeof(l->language));
 					ast_copy_string(l->mohinterpret, mohinterpret, sizeof(l->mohinterpret));
 					ast_copy_string(l->mohsuggest, mohsuggest, sizeof(l->mohsuggest));

Modified: trunk/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_unistim.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/channels/chan_unistim.c (original)
+++ trunk/channels/chan_unistim.c Mon Apr 21 18:42:45 2008
@@ -404,6 +404,8 @@
 	int amaflags;
 	/*! Codec supported */
 	int capability;
+	/*! Parkinglot */
+	char parkinglot[AST_MAX_CONTEXT];
 	struct unistim_line *next;
 	struct unistim_device *parent;
 };
@@ -5111,6 +5113,8 @@
 			l->pickupgroup = ast_get_group(v->value);
 		else if (!strcasecmp(v->name, "mailbox"))
 			ast_copy_string(l->mailbox, v->value, sizeof(l->mailbox));
+		else if (!strcasecmp(v->name, "parkinglot"))
+			ast_copy_string(l->parkinglot, v->value, sizeof(l->parkinglot));
 		else if (!strcasecmp(v->name, "linelabel"))
 			unquote(linelabel, v->value, sizeof(linelabel) - 1);
 		else if (!strcasecmp(v->name, "extension")) {

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Mon Apr 21 18:42:45 2008
@@ -236,6 +236,8 @@
 
 static char defaultcic[64] = "";
 static char defaultozz[64] = "";
+
+static char parkinglot[AST_MAX_EXTENSION] = "";		/*!< Default parking lot for this channel */
 
 /*! Run this script when the MWI state changes on an FXO line, if mwimonitor is enabled */
 static char mwimonitornotify[PATH_MAX] = "";
@@ -595,6 +597,7 @@
 	char language[MAX_LANGUAGE];
 	char mohinterpret[MAX_MUSICCLASS];
 	char mohsuggest[MAX_MUSICCLASS];
+	char parkinglot[AST_MAX_EXTENSION]; /*!< Parking lot for this channel */
 #if defined(PRI_ANI) || defined(HAVE_SS7)
 	char cid_ani[AST_MAX_EXTENSION];
 #endif
@@ -777,6 +780,7 @@
 			.cid_name = "",
 			.mohinterpret = "default",
 			.mohsuggest = "",
+			.parkinglot = "",
 			.transfertobusy = 1,
 
 			.cid_signalling = CID_SIG_BELL,
@@ -5963,6 +5967,8 @@
 		tmp->callgroup = i->callgroup;
 		tmp->pickupgroup = i->pickupgroup;
 	}
+	if (!ast_strlen_zero(i->parkinglot))
+		ast_string_field_set(tmp, parkinglot, i->parkinglot);
 	if (!ast_strlen_zero(i->language))
 		ast_string_field_set(tmp, language, i->language);
 	if (!i->owner)
@@ -8077,6 +8083,7 @@
 	struct zt_bufferinfo bi;
 #endif
 	struct zt_spaninfo si;
+
 	int res;
 	int span=0;
 	int here = 0;
@@ -8493,6 +8500,7 @@
 		ast_copy_string(tmp->mohsuggest, conf.chan.mohsuggest, sizeof(tmp->mohsuggest));
 		ast_copy_string(tmp->context, conf.chan.context, sizeof(tmp->context));
 		ast_copy_string(tmp->cid_num, conf.chan.cid_num, sizeof(tmp->cid_num));
+		ast_copy_string(tmp->parkinglot, conf.chan.parkinglot, sizeof(tmp->parkinglot));
 		tmp->cid_ton = 0;
 		ast_copy_string(tmp->cid_name, conf.chan.cid_name, sizeof(tmp->cid_name));
 		ast_copy_string(tmp->mailbox, conf.chan.mailbox, sizeof(tmp->mailbox));
@@ -13258,11 +13266,16 @@
 	const char *ringc; /* temporary string for parsing the dring number. */
 	int y;
 	int found_pseudo = 0;
-        char zapchan[MAX_CHANLIST_LEN] = {};
+	char zapchan[MAX_CHANLIST_LEN] = {};
 
 	for (; v; v = v->next) {
 		if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
 			continue;
+
+		/* must have parkinglot in confp before build_channels is called */
+		if (!strcasecmp(v->name, "parkinglot")) {
+			ast_copy_string(confp->chan.parkinglot, v->value, sizeof(confp->chan.parkinglot));
+		}
 
 		/* Create the interface list */
 		if (!strcasecmp(v->name, "channel")
@@ -13424,6 +13437,8 @@
 			ast_copy_string(confp->chan.mohinterpret, v->value, sizeof(confp->chan.mohinterpret));
 		} else if (!strcasecmp(v->name, "mohsuggest")) {
 			ast_copy_string(confp->chan.mohsuggest, v->value, sizeof(confp->chan.mohsuggest));
+		} else if (!strcasecmp(v->name, "parkinglot")) {
+			ast_copy_string(parkinglot, v->value, sizeof(parkinglot));
 		} else if (!strcasecmp(v->name, "stripmsd")) {
 			ast_log(LOG_NOTICE, "Configuration option \"%s\" has been deprecated. Please use dialplan instead\n", v->name);
 			confp->chan.stripmsd = atoi(v->value);

Modified: trunk/configs/features.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/features.conf.sample?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/configs/features.conf.sample (original)
+++ trunk/configs/features.conf.sample Mon Apr 21 18:42:45 2008
@@ -3,10 +3,11 @@
 ;
 
 [general]
-parkext => 700			; What extension to dial to park
-parkpos => 701-720		; What extensions to park calls on. These needs to be
-				; numeric, as Asterisk starts from the start position
+parkext => 700			; What extension to dial to park	(all parking lots)
+parkpos => 701-720		; What extensions to park calls on. (defafult parking lot)
+				; These needs to be numeric, as Asterisk starts from the start position
 				; and increments with one for the next parked call.
+context => parkedcalls		; Which context parked calls are in (default parking lot)
 context => parkedcalls		; Which context parked calls are in
 ;parkingtime => 45		; Number of seconds a call can be parked for 
 				; (default is 45 seconds)
@@ -45,6 +46,7 @@
 ; Note that the DTMF features listed below only work when two channels have answered and are bridged together.
 ; They can not be used while the remote party is ringing or in progress. If you require this feature you can use
 ; chan_local in combination with Answer to accomplish it.
+
 
 [featuremap]
 ;blindxfer => #1		; Blind transfer  (default is #)
@@ -87,6 +89,7 @@
 ;                   channel waits for the feature to complete. If left blank,
 ;                   no music will be played.
 ;
+
 ;
 ; IMPORTANT NOTE: The applicationmap is not intended to be used for all Asterisk
 ;   applications. When applications are used in extensions.conf, they are executed
@@ -108,20 +111,21 @@
 ;unpauseMonitor => #3,self/callee,UnPauseMonitor   ;Allow the callee to unpause monitoring
 ;                                                  ;on their channel
 ;
+;*** Define another parking lot
+;
+; You can set parkinglot with the CHANNEL dialplan function
+; or configure it in the device configuration in the channel
+;
+;[parkinglot_edvina]
+;context => edvinapark
+;parkpos => 800-850
+;findslot => next
+
 ; GROUPS
 ;   Groups are groupings of features defined in [applicationmap]
 ;   that can have their own key mappings.
-;
-;   Groups are defined as a configuration section,
-;   and can be set as part of DYNAMIC_FEATURES in
-;   the same way that a normal feature can... 
-;	etc:	
-;
-;	  Set(DYNAMIC_FEATURES=myGroupName);
 ;
 ; example:
 ; [myGroupName]        ; defines the group named myGroupName
 ; testfeature => #9    ; associates testfeature with the group and the keycode #9
 ; pauseMonitor         ; associates pauseMonitor with the group and the keycode
-;                      ; defined in [applicationmap]
-

Modified: trunk/configs/iax.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/iax.conf.sample?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/configs/iax.conf.sample (original)
+++ trunk/configs/iax.conf.sample Mon Apr 21 18:42:45 2008
@@ -285,6 +285,10 @@
 ;rtignoreregexpire=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: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Mon Apr 21 18:42:45 2008
@@ -195,6 +195,9 @@
 ;
 ;mohsuggest=default
 ;
+;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: trunk/funcs/func_channel.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_channel.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/funcs/func_channel.c (original)
+++ trunk/funcs/func_channel.c Mon Apr 21 18:42:45 2008
@@ -84,6 +84,8 @@
 		locked_copy_string(chan, buf, chan->language, len);
 	else if (!strcasecmp(data, "musicclass"))
 		locked_copy_string(chan, buf, chan->musicclass, len);
+	else if (!strcasecmp(data, "parkinglot"))
+		locked_copy_string(chan, buf, chan->parkinglot, len);
 	else if (!strcasecmp(data, "state"))
 		locked_copy_string(chan, buf, ast_state2str(chan->_state), len);
 	else if (!strcasecmp(data, "channeltype"))
@@ -110,6 +112,8 @@
 
 	if (!strcasecmp(data, "language"))
 		locked_string_field_set(chan, language, value);
+	else if (!strcasecmp(data, "parkinglot"))
+		locked_string_field_set(chan, parkinglot, value);
 	else if (!strcasecmp(data, "musicclass"))
 		locked_string_field_set(chan, musicclass, value);
 #ifdef CHANNEL_TRACE
@@ -172,6 +176,7 @@
 		"R/O	channeltype        technology used for channel\n"
 		"R/W	language           language for sounds played\n"
 		"R/W	musicclass         class (from musiconhold.conf) for hold music\n"
+		"R/W	parkinglot         parkinglot for parking\n"
 		"R/W	rxgain             set rxgain level on channel drivers that support it\n"
 		"R/O	state              state for channel\n"
 		"R/W	tonezone           zone for indications played\n"

Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Mon Apr 21 18:42:45 2008
@@ -434,6 +434,7 @@
 		AST_STRING_FIELD(accountcode);		/*!< Account code for billing */
 		AST_STRING_FIELD(call_forward);		/*!< Where to forward to if asked to dial on this interface */
 		AST_STRING_FIELD(uniqueid);		/*!< Unique Channel Identifier */
+		AST_STRING_FIELD(parkinglot);		/*! Default parking lot, if empty, default parking lot  */
 	);
 	
 	int fds[AST_MAX_FDS];				/*!< File descriptors for channel -- Drivers will poll on

Modified: trunk/main/features.c
URL: http://svn.digium.com/view/asterisk/trunk/main/features.c?view=diff&rev=114487&r1=114486&r2=114487
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Mon Apr 21 18:42:45 2008
@@ -54,11 +54,13 @@
 #include "asterisk/monitor.h"
 #include "asterisk/audiohook.h"
 #include "asterisk/global_datastores.h"
+#include "asterisk/astobj2.h"
 
 #define DEFAULT_PARK_TIME 45000
 #define DEFAULT_TRANSFER_DIGIT_TIMEOUT 3000
 #define DEFAULT_FEATURE_DIGIT_TIMEOUT 500
 #define DEFAULT_NOANSWER_TIMEOUT_ATTENDED_TRANSFER 15000
+#define DEFAULT_PARKINGLOT "default"			/*!< Default parking lot */
 #define DEFAULT_ATXFER_DROP_CALL 0
 #define DEFAULT_ATXFER_LOOP_DELAY 10000
 #define DEFAULT_ATXFER_CALLBACK_RETRIES 2
@@ -85,73 +87,11 @@
 
 static char *parkedcall = "ParkedCall";
 
-static int parkaddhints = 0;                               /*!< Add parking hints automatically */
-static int parkedcalltransfers = 0;                        /*!< Enable DTMF based transfers on bridge when picking up parked calls */
-static int parkedcallreparking = 0;                        /*!< Enable DTMF based parking on bridge when picking up parked calls */
-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 char pickup_ext[AST_MAX_EXTENSION];                 /*!< Call pickup extension */
-static char parkmohclass[MAX_MUSICCLASS];                  /*!< Music class used for parking */
-static int parking_start;                                  /*!< First available extension for parking */
-static int parking_stop;                                   /*!< Last available extension for parking */
-
-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 comebacktoorigin = 1;
-
-static int atxfernoanswertimeout;
-static unsigned int atxferdropcall;
-static unsigned int atxferloopdelay;
-static unsigned int atxfercallbackretries;
-
-static char *registrar = "features";		   /*!< Registrar for operations */
-
-/* module and CLI command definitions */
-static char *synopsis = "Answer a parked call";
-
-static char *descrip = "ParkedCall(exten): "
-"Used to connect to a parked call.  This application is always\n"
-"registered internally and does not need to be explicitly added\n"
-"into the dialplan, although you should include the 'parkedcalls'\n"
-"context.  If no extension is provided, then the first available\n"
-"parked call will be acquired.\n";
-
-static char *parkcall = "Park";
-
-static char *synopsis2 = "Park yourself";
-
-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"
-"into the dialplan, although you should include the 'parkedcalls'\n"
-"context (or the context specified in features.conf).\n\n"
-"If you set the PARKINGEXTEN variable to an extension in your\n"
-"parking context, Park() will park the call on that extension, unless\n"
-"it already exists. In that case, execution will continue at next\n"
-"priority.\n" ;
-
-static struct ast_app *monitor_app = NULL;
-static int monitor_ok = 1;
-
-static struct ast_app *mixmonitor_app = NULL;
-static int mixmonitor_ok = 1;
-
-static struct ast_app *stopmixmonitor_app = NULL;
-static int stopmixmonitor_ok = 1;
-
+
+/*! \brief Description of one parked call, added to a list while active, then removed.
+	The list belongs to a parkinglot 
+*/
 struct parkeduser {
 	struct ast_channel *chan;                   /*!< Parking channel */
 	struct timeval start;                       /*!< Time the parking started */
@@ -164,12 +104,94 @@
 	int notquiteyet;
 	char peername[1024];
 	unsigned char moh_trys;
+	struct ast_parkinglot *parkinglot;
 	AST_LIST_ENTRY(parkeduser) list;
 };
 
-static AST_LIST_HEAD_STATIC(parkinglot, parkeduser);
+/*! \brief Structure for parking lots which are put in a container. */
+struct ast_parkinglot {
+	char name[AST_MAX_CONTEXT];
+	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 */
+	char mohclass[MAX_MUSICCLASS];                  /*!< Music class used for parking */
+	int parkaddhints;                               /*!< Add parking hints automatically */
+	int parkedcalltransfers;                        /*!< Enable DTMF based transfers on bridge when picking up parked calls */
+	int parkedcallreparking;                        /*!< Enable DTMF based parking on bridge when picking up parked calls */
+	AST_LIST_HEAD(parkinglot_parklist, parkeduser) parkings; /*!< List of active parkings in this parkinglot */
+};
+
+/*! \brief The list of parking lots configured. Always at least one  - the default parking lot */
+static struct ao2_container *parkinglots;
+ 
+struct ast_parkinglot *default_parkinglot;
+char parking_ext[AST_MAX_EXTENSION];            /*!< Extension you type to park the call */
+
+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 adsipark;
+
+static int transferdigittimeout;
+static int featuredigittimeout;
+static int comebacktoorigin = 1;
+
+static int atxfernoanswertimeout;
+static unsigned int atxferdropcall;
+static unsigned int atxferloopdelay;
+static unsigned int atxfercallbackretries;
+
+static char *registrar = "features";		   /*!< Registrar for operations */
+
+/* module and CLI command definitions */
+static char *synopsis = "Answer a parked call";
+
+static char *descrip = "ParkedCall(exten): "
+"Used to connect to a parked call.  This application is always\n"
+"registered internally and does not need to be explicitly added\n"
+"into the dialplan, although you should include the 'parkedcalls'\n"
+"context.  If no extension is provided, then the first available\n"
+"parked call will be acquired.\n";
+
+static char *parkcall = "Park";
+
+static char *synopsis2 = "Park yourself";
+
+static char *descrip2 = "Park(): "
+"Used to park yourself (typically in combination with a supervised\n"

[... 1268 lines stripped ...]



More information about the asterisk-commits mailing list