[asterisk-commits] rmudgett: branch group/CCSS r239711 - /team/group/CCSS/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 13 10:28:29 CST 2010


Author: rmudgett
Date: Wed Jan 13 10:28:27 2010
New Revision: 239711

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=239711
Log:
*  Fixed sig_analog parameter calling order for ast_queue_cc_frame().
*  Made sig_analog do generic CC if the monitor policy is set to
AST_CC_MONITOR_NATIVE, AST_CC_MONITOR_ALWAYS, and AST_CC_MONITOR_GENERIC.
*  Changed sig_analog to use a callback instead of duplicating the
original dialstring in its private structure.
*  In dahdi_request() if a channel is not found do not overwrite the
original dialstring on the last channel checked.

Modified:
    team/group/CCSS/channels/chan_dahdi.c
    team/group/CCSS/channels/sig_analog.c
    team/group/CCSS/channels/sig_analog.h

Modified: team/group/CCSS/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_dahdi.c?view=diff&rev=239711&r1=239710&r2=239711
==============================================================================
--- team/group/CCSS/channels/chan_dahdi.c (original)
+++ team/group/CCSS/channels/chan_dahdi.c Wed Jan 13 10:28:27 2010
@@ -2155,6 +2155,13 @@
 	p->pulsedial = flag;
 }
 
+static const char *my_get_orig_dialstring(void *pvt)
+{
+	struct dahdi_pvt *p = pvt;
+
+	return p->dialstring;
+}
+
 static void my_increase_ss_count(void)
 {
 	ast_mutex_lock(&ss_thread_lock);
@@ -2935,6 +2942,7 @@
 	.cancel_cidspill = my_cancel_cidspill,
 	.confmute = my_confmute,
 	.set_pulsedial = my_set_pulsedial,
+	.get_orig_dialstring = my_get_orig_dialstring,
 };
 
 static struct dahdi_pvt *round_robin[32];
@@ -12261,10 +12269,7 @@
 
 			p->outgoing = 1;
 			if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
-				char dialstring[AST_CHANNEL_NAME];
-
-				snprintf(dialstring, sizeof(dialstring), "DAHDI/%s", (char *) data);
-				tmp = analog_request(p->sig_pvt, &callwait, requestor, dialstring);
+				tmp = analog_request(p->sig_pvt, &callwait, requestor);
 #ifdef HAVE_PRI
 			} else if (dahdi_sig_pri_lib_handles(p->sig)) {
 				sig_pri_extract_called_num_subaddr(p->sig_pvt, data, p->dnid,
@@ -12276,6 +12281,8 @@
 			}
 			if (!tmp) {
 				p->outgoing = 0;
+			} else {
+				snprintf(p->dialstring, sizeof(p->dialstring), "DAHDI/%s", (char *) data);
 			}
 			/* Note if the call is a call waiting call */
 			if (tmp && callwait)
@@ -12299,9 +12306,6 @@
 			break;
 	}
 	ast_mutex_unlock(&iflock);
-	if (p) {
-		ast_copy_string(p->dialstring, data, sizeof(p->dialstring));
-	}
 	restart_monitor();
 	if (callwait)
 		*cause = AST_CAUSE_BUSY;

Modified: team/group/CCSS/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/sig_analog.c?view=diff&rev=239711&r1=239710&r2=239711
==============================================================================
--- team/group/CCSS/channels/sig_analog.c (original)
+++ team/group/CCSS/channels/sig_analog.c Wed Jan 13 10:28:27 2010
@@ -169,6 +169,14 @@
 	return -1;
 }
 
+static const char *analog_get_orig_dialstring(struct analog_pvt *p)
+{
+	if (p->calls->get_orig_dialstring) {
+		return p->calls->get_orig_dialstring(p->chan_pvt);
+	}
+	return "";
+}
+
 static int analog_get_event(struct analog_pvt *p)
 {
 	if (p->calls->get_event) {
@@ -634,7 +642,7 @@
 	return 0;
 }
 
-struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor, const char * const dialstring)
+struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor)
 {
 	ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel);
 	*callwait = (p->owner != NULL);
@@ -645,8 +653,6 @@
 			return NULL;
 		}
 	}
-
-	ast_copy_string(p->dialstring, dialstring, sizeof(p->dialstring));
 
 	return analog_new_ast_channel(p, AST_STATE_RESERVED, 0, p->owner ? ANALOG_SUB_CALLWAIT : ANALOG_SUB_REAL, requestor);
 }
@@ -942,11 +948,23 @@
 		ast_setstate(ast, AST_STATE_RINGING);
 		index = analog_get_index(ast, p, 0);
 		if (index > -1) {
+			struct ast_cc_config_params *cc_params;
+
 			/* This is where the initial ringing frame is queued for an analog call.
 			 * As such, this is a great time to offer CCNR to the caller if it's available.
 			 */
-			if (ast_get_cc_monitor_policy(ast_channel_get_cc_config_params(p->subs[index].owner)) == AST_CC_MONITOR_GENERIC) {
-				ast_queue_cc_frame(p->subs[index].owner, p->dialstring, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCNR);
+			cc_params = ast_channel_get_cc_config_params(p->subs[index].owner);
+			if (cc_params) {
+				switch (ast_get_cc_monitor_policy(cc_params)) {
+				case AST_CC_MONITOR_NEVER:
+					break;
+				case AST_CC_MONITOR_NATIVE:
+				case AST_CC_MONITOR_ALWAYS:
+				case AST_CC_MONITOR_GENERIC:
+					ast_queue_cc_frame(p->subs[index].owner, AST_CC_GENERIC_MONITOR_TYPE,
+						analog_get_orig_dialstring(p), AST_CC_CCNR);
+					break;
+				}
 			}
 			ast_queue_control(p->subs[index].owner, AST_CONTROL_RINGING);
 		}

Modified: team/group/CCSS/channels/sig_analog.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/sig_analog.h?view=diff&rev=239711&r1=239710&r2=239711
==============================================================================
--- team/group/CCSS/channels/sig_analog.h (original)
+++ team/group/CCSS/channels/sig_analog.h Wed Jan 13 10:28:27 2010
@@ -213,6 +213,8 @@
 	void (* const cancel_cidspill)(void *pvt);
 	int (* const confmute)(void *pvt, int mute);	
 	void (* const set_pulsedial)(void *pvt, int flag);
+
+	const char *(* const get_orig_dialstring)(void *pvt);
 };
 
 
@@ -319,7 +321,6 @@
 
 	int ringt;
 	int ringt_base;
-	char dialstring[AST_CHANNEL_NAME];
 };
 
 struct analog_pvt *analog_new(enum analog_sigtype signallingtype, struct analog_callback *c, void *private_data);
@@ -335,7 +336,7 @@
 
 struct ast_frame *analog_exception(struct analog_pvt *p, struct ast_channel *ast);
 
-struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor, const char * const dialstring);
+struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor);
 
 int analog_available(struct analog_pvt *p, int *busy);
 




More information about the asterisk-commits mailing list