[asterisk-commits] oej: branch oej/multiparking r53056 - in /team/oej/multiparking: channels/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 31 18:08:03 MST 2007


Author: oej
Date: Wed Jan 31 19:08:02 2007
New Revision: 53056

URL: http://svn.digium.com/view/asterisk?view=rev&rev=53056
Log:
Look, ma, it compiles again. Now I wonder:
	- does it still work?

Testers, come on! You've been asking for this.

Modified:
    team/oej/multiparking/channels/chan_sip.c
    team/oej/multiparking/res/res_features.c

Modified: team/oej/multiparking/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_sip.c?view=diff&rev=53056&r1=53055&r2=53056
==============================================================================
--- team/oej/multiparking/channels/chan_sip.c (original)
+++ team/oej/multiparking/channels/chan_sip.c Wed Jan 31 19:08:02 2007
@@ -555,7 +555,6 @@
 static char global_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 */
 static int global_autoframing;          /*!< Turn autoframing on or off. */
@@ -912,7 +911,6 @@
 		AST_STRING_FIELD(language);	/*!< Default language for this call */
 		AST_STRING_FIELD(mohinterpret);	/*!< MOH class to use when put on hold */
 		AST_STRING_FIELD(mohsuggest);	/*!< MOH class to suggest when putting a peer on hold */
-		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 */
@@ -1054,7 +1052,6 @@
 	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_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 */
@@ -1104,7 +1101,6 @@
 	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_EXTENSION];/*!< Default parking lot */
 	char useragent[256];		/*!<  User agent in SIP request (saved from registration) */
 	struct ast_codec_pref prefs;	/*!<  codec prefs */
 	int lastmsgssent;
@@ -2760,7 +2756,7 @@
 	do_setnat(dialog, ast_test_flag(&dialog->flags[0], SIP_NAT) & SIP_NAT_ROUTE );
 
 	if (dialog->rtp) {
-		ast_rtp_setdtmf(dialog->rtp, ast_test_flag(&dialog->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
+		ast_rtp_setdtmf(dialog->rtp, ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
 		ast_rtp_setdtmfcompensate(dialog->rtp, ast_test_flag(&dialog->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
 		ast_rtp_set_rtptimeout(dialog->rtp, peer->rtptimeout);
 		ast_rtp_set_rtpholdtimeout(dialog->rtp, peer->rtpholdtimeout);
@@ -2800,8 +2796,6 @@
 		ast_string_field_set(dialog, tohost, ast_inet_ntoa(dialog->sa.sin_addr));
 	if (!ast_strlen_zero(peer->fromdomain))
 		ast_string_field_set(dialog, 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(dialog, fromuser, peer->fromuser);
 	dialog->callgroup = peer->callgroup;
@@ -3976,8 +3970,6 @@
 		tmp->amaflags = i->amaflags;
 	if (!ast_strlen_zero(i->language))
 		ast_string_field_set(tmp, language, i->language);
-	if (!ast_strlen_zero(i->parkinglot))
-		ast_string_field_set(tmp, parkinglot, i->parkinglot);
 	i->owner = tmp;
 	ast_module_ref(ast_module_info->self);
 	ast_copy_string(tmp->context, i->context, sizeof(tmp->context));
@@ -4349,7 +4341,7 @@
 			free(p);
 			return NULL;
 		}
-		ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
+		ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
 		ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
 		ast_rtp_settos(p->rtp, global_tos_audio);
 		ast_rtp_set_rtptimeout(p->rtp, global_rtptimeout);
@@ -4385,7 +4377,6 @@
 	/* Assign default music on hold class */
 	ast_string_field_set(p, mohinterpret, default_mohinterpret);
 	ast_string_field_set(p, mohsuggest, default_mohsuggest);
-	ast_string_field_set(p, parkinglot, default_parkinglot);
 	p->capability = global_capability;
 	p->allowtransfer = global_allowtransfer;
 	if ((ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833) ||
@@ -9167,7 +9158,6 @@
 		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;
@@ -9294,7 +9284,6 @@
 		ast_string_field_set(p, peermd5secret, peer->md5secret);
 		ast_string_field_set(p, language, peer->language);
 		ast_string_field_set(p, accountcode, peer->accountcode);
-		ast_string_field_set(p, parkinglot, user->parkinglot);
 		p->amaflags = peer->amaflags;
 		p->callgroup = peer->callgroup;
 		p->pickupgroup = peer->pickupgroup;
@@ -10191,7 +10180,6 @@
 		}
 		ast_cli(fd, "  Context      : %s\n", peer->context);
 		ast_cli(fd, "  Subscr.Cont. : %s\n", S_OR(peer->subscribecontext, "<Not set>") );
-		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);
@@ -10534,8 +10522,8 @@
 	ast_cli(fd, "  Language:               %s\n", S_OR(default_language, "(Defaults to English)"));
 	ast_cli(fd, "  MOH Interpret:          %s\n", default_mohinterpret);
 	ast_cli(fd, "  MOH Suggest:            %s\n", default_mohsuggest);
-	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");
@@ -11587,8 +11575,6 @@
 		ast_copy_string(buf, peer->accountcode, len);
 	} 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")) {
@@ -11638,8 +11624,7 @@
 	"- status                Status (if qualify=yes).\n"
 	"- regexten              Registration extension\n"
 	"- limit                 Call limit (call-limit)\n"
-	"- curcalls              Current amount of calls\n"
-	"- parkinglot            Parking lot used for this peer\n"
+	"- curcalls              Current amount of calls \n"
 	"                        Only available if call-limit is set\n"
 	"- language              Default language for peer\n"
 	"- accountcode           Account code for this peer\n"
@@ -12856,8 +12841,10 @@
 			/* Could not start thread */
 			free(d);	/* We don't need it anymore. If thread is created, d will be free'd
 					   by sip_park_thread() */
+			pthread_attr_destroy(&attr);
 			return 0;
 		}
+		pthread_attr_destroy(&attr);
 	} 
 	return -1;
 }
@@ -13571,7 +13558,7 @@
 		build_contact(p);			/* Build our contact header */
 
 		if (p->rtp) {
-			ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) != SIP_DTMF_INFO);
+			ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
 			ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
 		}
 
@@ -15847,7 +15834,6 @@
 	strcpy(user->language, default_language);
 	strcpy(user->mohinterpret, default_mohinterpret);
 	strcpy(user->mohsuggest, default_mohsuggest);
-	strcpy(user->parkinglot, default_parkinglot);
 	for (; v; v = v->next) {
 		if (handle_common_options(&userflags[0], &mask[0], v))
 			continue;
@@ -15887,8 +15873,6 @@
 			ast_copy_string(user->mohinterpret, v->value, sizeof(user->mohinterpret));
 		} else if (!strcasecmp(v->name, "mohsuggest")) {
 			ast_copy_string(user->mohsuggest, v->value, sizeof(user->mohsuggest));
-		} 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")) {
@@ -15948,7 +15932,6 @@
 	strcpy(peer->language, default_language);
 	strcpy(peer->mohinterpret, default_mohinterpret);
 	strcpy(peer->mohsuggest, default_mohsuggest);
-	strcpy(peer->parkinglot, default_parkinglot);
 	peer->addr.sin_family = AF_INET;
 	peer->defaddr.sin_family = AF_INET;
 	peer->capability = global_capability;
@@ -16168,8 +16151,6 @@
 			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")) {
 			ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox));
 		} else if (!strcasecmp(v->name, "subscribemwi")) {
@@ -16328,7 +16309,6 @@
 		ast_copy_string(global_realm, DEFAULT_REALM, sizeof(global_realm));
 	else
 		ast_copy_string(global_realm, ast_config_AST_SYSTEM_NAME, 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;
@@ -16457,8 +16437,6 @@
 			ast_copy_string(default_mohinterpret, v->value, sizeof(default_mohinterpret));
 		} else if (!strcasecmp(v->name, "mohsuggest")) {
 			ast_copy_string(default_mohsuggest, v->value, sizeof(default_mohsuggest));
-		} else if (!strcasecmp(v->name, "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/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/res/res_features.c?view=diff&rev=53056&r1=53055&r2=53056
==============================================================================
--- team/oej/multiparking/res/res_features.c (original)
+++ team/oej/multiparking/res/res_features.c Wed Jan 31 19:08:02 2007
@@ -83,7 +83,6 @@
 static int parkedcalltransfers = 0;                        /*!< Enable DTMF based transfers 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 pickup_ext[AST_MAX_EXTENSION];                 /*!< Call pickup extension */
-static int parkaddhints = 0;                               /*!< Add parking hints automatically */
 static char parkmohclass[MAX_MUSICCLASS];                  /*!< Music class used for parking */
 
 /* XXX This is used in many modules, so for now it's the same for all parking lots */
@@ -383,8 +382,8 @@
 	/* Check for channel variable PARKINGEXTEN */
 	parkingexten = pbx_builtin_getvar_helper(chan, "PARKINGEXTEN");
 	if (!ast_strlen_zero(parkingexten)) {
-		if (ast_exists_extension(NULL, parking_con, parkingexten, 1, NULL)) {
-			ast_log(LOG_WARNING, "Requested parking extension already exists: %s@%s\n", parkingexten, parking_con);
+		if (ast_exists_extension(NULL, parkinglot->parking_con, parkingexten, 1, NULL)) {
+			ast_log(LOG_WARNING, "Requested parking extension already exists: %s@%s\n", parkingexten, parkinglot->parking_con);
 			return 0;	/* Continue execution if possible */
 		}
 		ast_copy_string(pu->parkingexten, parkingexten, sizeof(pu->parkingexten));
@@ -451,7 +450,7 @@
 	/* Wake up the (presumably select()ing) thread */
 	pthread_kill(parking_thread, SIGURG);
 	if (option_verbose > 1) 
-		ast_verbose(VERBOSE_PREFIX_2 "Parked %s on %s (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));
+		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));
 
 	if (pu->parkingnum != -1)
 		snprintf(pu->parkingexten, sizeof(pu->parkingexten), "%d", x);
@@ -480,7 +479,7 @@
 		ast_log(LOG_ERROR, "Parking context '%s' does not exist and unable to create\n", parkinglot->parking_con);
 	else {		/* Add extension to context */
 		if (!ast_add_extension2(con, 1, pu->parkingexten, 1, NULL, NULL, parkedcall, strdup(pu->parkingexten), ast_free, registrar))
-			notify_metermaids(pu->parkingexten, parking_con);
+			notify_metermaids(pu->parkingexten, parkinglot->parking_con);
 
 	}
 	/* Tell the peer channel the number of the parking space */
@@ -1592,6 +1591,7 @@
 static void *do_parking_thread(void *ignore)
 {
 	struct ast_parkinglot *curlot;
+	char parkingslot[AST_MAX_EXTENSION];
 	fd_set rfds, efds;	/* results from previous select, to be preserved across loops. */
 
 	FD_ZERO(&rfds);
@@ -1655,13 +1655,16 @@
 					   	should have their original extensions and such, but we copy to be on the safe side */
 						if (comebacktoorigin) { 
 							ast_copy_string(pu->chan->exten, pu->exten, sizeof(pu->chan->exten));
+							ast_copy_string(pu->chan->context, pu->parkinglot->parking_con_dial, sizeof(pu->chan->context));
+							pu->chan->priority = pu->priority;
+						} else {
+							if (option_verbose)
+								ast_verbose("Now going to parkedcallstimeout,s,1 | ps is %d\n", pu->parkingnum);
+							snprintf(parkingslot, sizeof(parkingslot), "%d", pu->parkingnum);
+							pbx_builtin_setvar_helper(pu->chan, "PARKINGSLOT", parkingslot);
+							ast_copy_string(pu->chan->exten, pu->exten, sizeof(pu->chan->exten));
 							ast_copy_string(pu->chan->context, pu->context, sizeof(pu->chan->context));
 							pu->chan->priority = pu->priority;
-						} else {
-							ast_log(LOG_WARNING, "now going to parkedcallstimeout,s,1 | ps is %d\n",pu->parkingnum);
-							SKREP check with trunk
-							snprintf(parkingslot, sizeof(parkingslot), "%d", pu->parkingnum);
-							pbx_builtin_setvar_helper(pu->chan, "PARKINGSLOT", parkingslot);
 						}
 					}
 #ifdef OLD
@@ -1897,7 +1900,7 @@
 			if (ast_context_remove_extension2(con, pu->parkingexten, 1, NULL))
 				ast_log(LOG_WARNING, "Whoa, failed to remove the extension!\n");
 			else
-				notify_metermaids(pu->parkingexten, parking_con);
+				notify_metermaids(pu->parkingexten, parkinglot->parking_con);
 		} else
 			ast_log(LOG_WARNING, "Whoa, no parking context?\n");
 
@@ -2324,7 +2327,7 @@
 	}
 
 	/* Add a parking extension into the context */
-	if (ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, strdup(""), FREE, registrar) == -1)
+	if (ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, strdup(""), ast_free, registrar) == -1)
 		error = 1;
 
 	if (error) {
@@ -2472,8 +2475,6 @@
 			ast_copy_string(xferfailsound, var->value, sizeof(xferfailsound));
 		} else if (!strcasecmp(var->name, "pickupexten")) {
 			ast_copy_string(pickup_ext, var->value, sizeof(pickup_ext));
-		} else if (!strcasecmp(var->name, "findslot")) {
-			parkfindnext = (!strcasecmp(var->value, "next"));
 		} else if (!strcasecmp(var->name, "parkedcalltransfers")) {
 			parkedcalltransfers = ast_true(var->value);
 		} else if (!strcasecmp(var->name, "adsipark")) {
@@ -2640,9 +2641,9 @@
 	}
 	res = ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, NULL, parkcall, NULL, NULL, registrar);
 	if (parkaddhints)
-		park_add_hints(parking_con, parking_start, parking_stop);
+		park_add_hints(default_parkinglot->parking_con, default_parkinglot->parking_start, default_parkinglot->parking_stop);
 	if (!res)
-		notify_metermaids(ast_parking_ext(), parking_con);
+		notify_metermaids(ast_parking_ext(), default_parkinglot->parking_con);
 	return res;
 
 }



More information about the asterisk-commits mailing list