[asterisk-commits] jpeeler: branch jpeeler/feature14882 r286473 - in /team/jpeeler/feature14882:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 13 15:20:11 CDT 2010


Author: jpeeler
Date: Mon Sep 13 15:20:06 2010
New Revision: 286473

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=286473
Log:
only require passing in the context instead of the channel for checking of a valid parking extension

Modified:
    team/jpeeler/feature14882/channels/chan_dahdi.c
    team/jpeeler/feature14882/channels/chan_iax2.c
    team/jpeeler/feature14882/channels/chan_sip.c
    team/jpeeler/feature14882/channels/sig_analog.c
    team/jpeeler/feature14882/include/asterisk/features.h
    team/jpeeler/feature14882/main/features.c

Modified: team/jpeeler/feature14882/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/jpeeler/feature14882/channels/chan_dahdi.c?view=diff&rev=286473&r1=286472&r2=286473
==============================================================================
--- team/jpeeler/feature14882/channels/chan_dahdi.c (original)
+++ team/jpeeler/feature14882/channels/chan_dahdi.c Mon Sep 13 15:20:06 2010
@@ -9739,7 +9739,7 @@
 				tone_zone_play_tone(p->subs[idx].dfd, -1);
 			else
 				tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALTONE);
-			if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan)) {
+			if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan->context)) {
 				if (!res || !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
 					if (getforward) {
 						/* Record this as the forwarding extension */
@@ -9875,7 +9875,7 @@
 				getforward = 0;
 				memset(exten, 0, sizeof(exten));
 				len = 0;
-			} else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan) &&
+			} else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan->context) &&
 						p->subs[SUB_THREEWAY].owner &&
 						ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
 				/* This is a three way call, the main call being a real channel,

Modified: team/jpeeler/feature14882/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/jpeeler/feature14882/channels/chan_iax2.c?view=diff&rev=286473&r1=286472&r2=286473
==============================================================================
--- team/jpeeler/feature14882/channels/chan_iax2.c (original)
+++ team/jpeeler/feature14882/channels/chan_iax2.c Mon Sep 13 15:20:06 2010
@@ -9101,10 +9101,9 @@
 	char context[AST_MAX_EXTENSION];
 	char callednum[AST_MAX_EXTENSION];
 	char *callerid;
-	struct ast_channel *chan;
 };
 
-static void dp_lookup(int callno, const char *context, const char *callednum, const char *callerid, int skiplock, struct ast_channel *chan)
+static void dp_lookup(int callno, const char *context, const char *callednum, const char *callerid, int skiplock)
 {
 	unsigned short dpstatus = 0;
 	struct iax_ie_data ied1;
@@ -9113,7 +9112,7 @@
 	memset(&ied1, 0, sizeof(ied1));
 	mm = ast_matchmore_extension(NULL, context, callednum, 1, callerid);
 	/* Must be started */
-	if (ast_parking_ext_valid(callednum, chan) || ast_exists_extension(NULL, context, callednum, 1, callerid)) {
+	if (ast_parking_ext_valid(callednum, context) || ast_exists_extension(NULL, context, callednum, 1, callerid)) {
 		dpstatus = IAX_DPSTATUS_EXISTS;
 	} else if (ast_canmatch_extension(NULL, context, callednum, 1, callerid)) {
 		dpstatus = IAX_DPSTATUS_CANEXIST;
@@ -9140,14 +9139,14 @@
 {
 	/* Look up for dpreq */
 	struct dpreq_data *dpr = data;
-	dp_lookup(dpr->callno, dpr->context, dpr->callednum, dpr->callerid, 0, dpr->chan);
+	dp_lookup(dpr->callno, dpr->context, dpr->callednum, dpr->callerid, 0);
 	if (dpr->callerid)
 		ast_free(dpr->callerid);
 	ast_free(dpr);
 	return NULL;
 }
 
-static void spawn_dp_lookup(int callno, const char *context, const char *callednum, const char *callerid, struct ast_channel *chan)
+static void spawn_dp_lookup(int callno, const char *context, const char *callednum, const char *callerid)
 {
 	pthread_t newthread;
 	struct dpreq_data *dpr;
@@ -9158,7 +9157,6 @@
 	dpr->callno = callno;
 	ast_copy_string(dpr->context, context, sizeof(dpr->context));
 	ast_copy_string(dpr->callednum, callednum, sizeof(dpr->callednum));
-	dpr->chan = chan;
 	if (callerid)
 		dpr->callerid = ast_strdup(callerid);
 	if (ast_pthread_create_detached(&newthread, NULL, dp_lookup_thread, dpr)) {
@@ -10544,10 +10542,10 @@
 					!ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED) && ies.called_number) {
 					if (iaxcompat) {
 						/* Spawn a thread for the lookup */
-						spawn_dp_lookup(fr->callno, iaxs[fr->callno]->context, ies.called_number, iaxs[fr->callno]->cid_num, c);
+						spawn_dp_lookup(fr->callno, iaxs[fr->callno]->context, ies.called_number, iaxs[fr->callno]->cid_num);
 					} else {
 						/* Just look it up */
-						dp_lookup(fr->callno, iaxs[fr->callno]->context, ies.called_number, iaxs[fr->callno]->cid_num, 1, c);
+						dp_lookup(fr->callno, iaxs[fr->callno]->context, ies.called_number, iaxs[fr->callno]->cid_num, 1);
 					}
 				}
 				break;
@@ -10608,7 +10606,7 @@
 					}
 
 					pbx_builtin_setvar_helper(bridged_chan, "BLINDTRANSFER", iaxs[fr->callno]->owner->name);
-					if (ast_parking_ext_valid(ies.called_number, c)) {
+					if (ast_parking_ext_valid(ies.called_number, iaxs[fr->callno]->context)) {
 						struct ast_channel *saved_channel = iaxs[fr->callno]->owner;
 						ast_mutex_unlock(&iaxsl[fr->callno]);
 						if (iax_park(bridged_chan, saved_channel, ies.called_number)) {

Modified: team/jpeeler/feature14882/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/jpeeler/feature14882/channels/chan_sip.c?view=diff&rev=286473&r1=286472&r2=286473
==============================================================================
--- team/jpeeler/feature14882/channels/chan_sip.c (original)
+++ team/jpeeler/feature14882/channels/chan_sip.c Mon Sep 13 15:20:06 2010
@@ -22069,7 +22069,7 @@
 	}
 
 	/* Parking a call */
-	if (p->refer->localtransfer && ast_parking_ext_valid(p->refer->refer_to, p->owner)) {
+	if (p->refer->localtransfer && ast_parking_ext_valid(p->refer->refer_to, p->owner->context)) {
 		/* Must release c's lock now, because it will not longer be accessible after the transfer! */
 		*nounlock = 1;
 		ast_channel_unlock(current.chan1);

Modified: team/jpeeler/feature14882/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/jpeeler/feature14882/channels/sig_analog.c?view=diff&rev=286473&r1=286472&r2=286473
==============================================================================
--- team/jpeeler/feature14882/channels/sig_analog.c (original)
+++ team/jpeeler/feature14882/channels/sig_analog.c Mon Sep 13 15:20:06 2010
@@ -1930,7 +1930,7 @@
 			} else {
 				analog_play_tone(p, index, ANALOG_TONE_DIALTONE);
 			}
-			if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan)) {
+			if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && !ast_parking_ext_valid(exten, chan->context)) {
 				if (!res || !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) {
 					if (getforward) {
 						/* Record this as the forwarding extension */
@@ -2081,7 +2081,7 @@
 				getforward = 0;
 				memset(exten, 0, sizeof(exten));
 				len = 0;
-			} else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan) &&
+			} else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan->context) &&
 						p->subs[ANALOG_SUB_THREEWAY].owner &&
 						ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner)) {
 				/* This is a three way call, the main call being a real channel,

Modified: team/jpeeler/feature14882/include/asterisk/features.h
URL: http://svnview.digium.com/svn/asterisk/team/jpeeler/feature14882/include/asterisk/features.h?view=diff&rev=286473&r1=286472&r2=286473
==============================================================================
--- team/jpeeler/feature14882/include/asterisk/features.h (original)
+++ team/jpeeler/feature14882/include/asterisk/features.h Mon Sep 13 15:20:06 2010
@@ -111,7 +111,7 @@
  * \retval 0 if extension does not exist
  * \retval 1 if extension does exist
 */
-int ast_parking_ext_valid(const char *exten_str, struct ast_channel *chan);
+int ast_parking_ext_valid(const char *exten_str, const char *context);
 
 /*! \brief Determine system call pickup extension */
 const char *ast_pickup_ext(void);

Modified: team/jpeeler/feature14882/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/jpeeler/feature14882/main/features.c?view=diff&rev=286473&r1=286472&r2=286473
==============================================================================
--- team/jpeeler/feature14882/main/features.c (original)
+++ team/jpeeler/feature14882/main/features.c Mon Sep 13 15:20:06 2010
@@ -468,26 +468,19 @@
 	return 0;
 }
 
-int ast_parking_ext_valid(const char *exten_str, struct ast_channel *chan)
-{
-	struct ast_parkinglot *curlot;
+int ast_parking_ext_valid(const char *exten_str, const char *context)
+{
 	struct ast_exten *exten;
 	struct pbx_find_info q = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */
 	const char *app_at_exten;
 
-	exten = pbx_find_extension(chan, NULL, &q, chan->context, exten_str, 1, NULL, NULL, E_MATCH);
+	exten = pbx_find_extension(NULL, NULL, &q, context, exten_str, 1, NULL, NULL, E_MATCH);
 	app_at_exten = ast_get_extension_app(exten);
 	if (!app_at_exten || strcmp(PARK_APP_NAME, app_at_exten)) {
 		return 0;
 	}
 
-	curlot = ao2_callback(parkinglots, 0, find_parkinglot_by_exten_cb, (void *) exten_str);
-	if (curlot) {
-		ao2_ref(curlot, -1);
-		return 1;
-	}
-
-	return 0;
+	return 1;
 }
 
 const char *ast_pickup_ext(void)




More information about the asterisk-commits mailing list