[svn-commits] mmichelson: branch group/CCSS r235664 - in /team/group/CCSS: channels/ includ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Dec 18 17:03:51 CST 2009


Author: mmichelson
Date: Fri Dec 18 17:03:46 2009
New Revision: 235664

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=235664
Log:
Round 1 of adding dialable name to CC frames.

Round 2 will consist of reading the dialable name off the frame
payload. And that will also not be today.


Modified:
    team/group/CCSS/channels/chan_dahdi.c
    team/group/CCSS/channels/chan_sip.c
    team/group/CCSS/channels/sig_analog.c
    team/group/CCSS/channels/sig_analog.h
    team/group/CCSS/include/asterisk/ccss.h
    team/group/CCSS/main/ccss.c

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=235664&r1=235663&r2=235664
==============================================================================
--- team/group/CCSS/channels/chan_dahdi.c (original)
+++ team/group/CCSS/channels/chan_dahdi.c Fri Dec 18 17:03:46 2009
@@ -1248,6 +1248,13 @@
 	int muting;
 	void *sig_pvt;
 	struct ast_cc_config_params *cc_params;
+	/* DAHDI channel names may differ greatly from the
+	 * string that was provided to an app such as Dial. We
+	 * need to save the original string passed to dahdi_request
+	 * for call completion purposes. This way, we can replicate
+	 * the original dialed string later.
+	 */
+	char dialstring[AST_CHANNEL_NAME];
 };
 
 static struct dahdi_pvt *iflist = NULL;	/*!< Main interface list start */
@@ -8048,7 +8055,7 @@
 				/* XXX I unfortunately cannot test this at the moment because analog
 				 * call forwarding is broken in trunk.
 				 */
-				if (!ast_cc_build_frame(p->owner, p->cc_params, device_name, AST_CC_CCNR, &p->subs[idx].f)) {
+				if (!ast_cc_build_frame(p->owner, p->cc_params, device_name, p->dialstring, AST_CC_CCNR, &p->subs[idx].f)) {
 					p->subs[idx].needringing = 0;
 					ast_mutex_unlock(&p->lock);
 					return &p->subs[idx].f;
@@ -12249,7 +12256,9 @@
 
 			p->outgoing = 1;
 			if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
-				tmp = analog_request(p->sig_pvt, &callwait, requestor);
+				char dialstring[AST_CHANNEL_NAME];
+				snprintf(dialstring, sizeof(dialstring) - 1, "DAHDI/%s", (char *) data);
+				tmp = analog_request(p->sig_pvt, &callwait, requestor, dialstring);
 #ifdef HAVE_PRI
 			} else if (dahdi_sig_pri_lib_handles(p->sig)) {
 				sig_pri_extract_called_num_subaddr(p->sig_pvt, data, p->dnid,
@@ -12282,6 +12291,9 @@
 			break;
 	}
 	ast_mutex_unlock(&iflock);
+	if (p) {
+		ast_copy_string(p->dialstring, data, sizeof(p->dialstring));
+	}
 	restart_monitor();
 	if (callwait)
 		*cause = AST_CAUSE_BUSY;
@@ -12313,6 +12325,7 @@
 		if (is_group_or_channel_match(p, groupmatch, &groupmatched, channelmatch, &channelmatched)) {
 			/* We found a potential match. call the callback */
 			struct ast_str *interface_name;
+			char dialstring[AST_CHANNEL_NAME];
 #ifdef HAVE_PRI
 			char dnid[AST_CHANNEL_NAME];
 			sig_pri_extract_called_num_subaddr(p->sig_pvt, dest, dnid, sizeof(dnid));
@@ -12323,7 +12336,8 @@
 #else
 			interface_name = create_channel_name(p);
 #endif
-			callback(inbound, p->cc_params, ast_str_buffer(interface_name));
+			snprintf(dialstring, sizeof(dialstring) - 1, "DAHDI/%s", dest);
+			callback(inbound, p->cc_params, ast_str_buffer(interface_name), dialstring);
 			ast_free(interface_name);
 		}
 		p = backwards ? p->prev : p->next;

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=235664&r1=235663&r2=235664
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Fri Dec 18 17:03:46 2009
@@ -19532,7 +19532,9 @@
 				ast_channel_queue_connected_line_update(p->owner, &connected);
 			}
 			if (ast_get_cc_monitor_policy(p->cc_params) == AST_CC_MONITOR_GENERIC) {
-				ast_queue_cc_frame(p->owner, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCNR);
+				char interface_name[AST_CHANNEL_NAME];
+				ast_channel_get_device_name(p->owner, interface_name, sizeof(interface_name));
+				ast_queue_cc_frame(p->owner, interface_name, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCNR);
 			}
 			ast_queue_control(p->owner, AST_CONTROL_RINGING);
 			if (p->owner->_state != AST_STATE_UP) {
@@ -19559,7 +19561,9 @@
 			change_redirecting_information(p, req, &redirecting, FALSE);
 			ast_channel_queue_redirecting_update(p->owner, &redirecting);
 			if (ast_get_cc_monitor_policy(p->cc_params) == AST_CC_MONITOR_GENERIC) {
-				ast_queue_cc_frame(p->owner, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCNR);
+				char interface_name[AST_CHANNEL_NAME];
+				ast_channel_get_device_name(p->owner, interface_name, sizeof(interface_name));
+				ast_queue_cc_frame(p->owner, interface_name, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCNR);
 			}
 		}
 		check_pendings(p);
@@ -19579,7 +19583,9 @@
 				ast_channel_queue_connected_line_update(p->owner, &connected);
 			}
 			if (ast_get_cc_monitor_policy(p->cc_params) == AST_CC_MONITOR_GENERIC) {
-				ast_queue_cc_frame(p->owner, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCNR);
+				char interface_name[AST_CHANNEL_NAME];
+				ast_channel_get_device_name(p->owner, interface_name, sizeof(interface_name));
+				ast_queue_cc_frame(p->owner, interface_name, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCNR);
 			}
 		}
 		if (find_sdp(req)) {
@@ -20540,9 +20546,10 @@
 				case 600: /* Busy everywhere */
 				case 603: /* Decline */
 					if (p->owner) {
-						/* XXX TEMPORARY! FOR TESTING ONLY */
 						if (ast_get_cc_monitor_policy(p->cc_params) == AST_CC_MONITOR_GENERIC) {
-							ast_queue_cc_frame(p->owner, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCBS);
+							char interface_name[AST_CHANNEL_NAME];
+							ast_channel_get_device_name(p->owner, interface_name, sizeof(interface_name));
+							ast_queue_cc_frame(p->owner, interface_name, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCBS);
 						}
 						ast_queue_control(p->owner, AST_CONTROL_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=235664&r1=235663&r2=235664
==============================================================================
--- team/group/CCSS/channels/sig_analog.c (original)
+++ team/group/CCSS/channels/sig_analog.c Fri Dec 18 17:03:46 2009
@@ -634,7 +634,7 @@
 	return 0;
 }
 
-struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor)
+struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor, const char * const dialstring)
 {
 	ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel);
 	*callwait = (p->owner != NULL);
@@ -645,6 +645,8 @@
 			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);
 }
@@ -944,7 +946,7 @@
 			 * 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, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCNR);
+				ast_queue_cc_frame(p->subs[index].owner, p->dialstring, AST_CC_GENERIC_MONITOR_TYPE, AST_CC_CCNR);
 			}
 			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=235664&r1=235663&r2=235664
==============================================================================
--- team/group/CCSS/channels/sig_analog.h (original)
+++ team/group/CCSS/channels/sig_analog.h Fri Dec 18 17:03:46 2009
@@ -319,6 +319,7 @@
 
 	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);
@@ -334,7 +335,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);
+struct ast_channel * analog_request(struct analog_pvt *p, int *callwait, const struct ast_channel *requestor, const char * const dialstring);
 
 int analog_available(struct analog_pvt *p, int channelmatch, ast_group_t groupmatch, int *busy, int *channelmatched, int *groupmatched);
 

Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=235664&r1=235663&r2=235664
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Fri Dec 18 17:03:46 2009
@@ -102,7 +102,8 @@
  * \retval 0 Success
  * \retval -1 Error
  */
-int ast_queue_cc_frame(struct ast_channel *chan, const char * const monitor_type, enum ast_cc_service_type service);
+int ast_queue_cc_frame(struct ast_channel *chan, const char * const monitor_type,
+		const char * const dialable_name, enum ast_cc_service_type service);
 
 /*!
  * \brief Allocate and initialize an ast_cc_config_params structure
@@ -1177,7 +1178,8 @@
  * is that a bunch of duplicate interfaces will be created and a bunch of duplicated
  * monitors would be created. Not sure of all the implications really.
  */
-void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_params *cc_params, const char * const interface_name);
+void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_params *cc_params,
+		const char * const interface_name, const char * const dialable_name);
 
 /*!
  * \since 1.6.4
@@ -1196,9 +1198,12 @@
  * \retval -1 Failure. At some point there was a failure. Do not attempt to use the frame in this case.
  * \retval 0 Success
  */
-int ast_cc_build_frame(struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char * const interface_name, enum ast_cc_service_type service, struct ast_frame *frame);
-
-typedef void (*ast_cc_callback_fn)(struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char * const interface_name);
+int ast_cc_build_frame(struct ast_channel *chan, struct ast_cc_config_params *cc_params,
+		const char * const interface_name, const char * const dialable_name, enum ast_cc_service_type service,
+		struct ast_frame *frame);
+
+typedef void (*ast_cc_callback_fn)(struct ast_channel *chan, struct ast_cc_config_params *cc_params,
+		const char * const interface_name, const char * const dialable_name);
 
 /*!
  * \since 1.6.4

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=235664&r1=235663&r2=235664
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Fri Dec 18 17:03:46 2009
@@ -1528,6 +1528,7 @@
 	struct ast_cc_config_params config_params;
 	int parent_interface_id;
 	char device_name[AST_CHANNEL_NAME];
+	char dialable_name[AST_CHANNEL_NAME];
 };
 
 /*!
@@ -3199,7 +3200,9 @@
 			cc_ref(core_instance, "Ref core instance for status response callback"));
 }
 
-static int cc_build_payload(struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char * const interface_name, enum ast_cc_service_type service, struct ast_control_cc_payload *payload)
+static int cc_build_payload(struct ast_channel *chan, struct ast_cc_config_params *cc_params,
+		const char * const interface_name, const char * dialable_name,
+		enum ast_cc_service_type service, struct ast_control_cc_payload *payload)
 {
 	struct ast_datastore *datastore;
 	struct dialed_cc_interfaces *cc_interfaces;
@@ -3240,10 +3243,12 @@
 	ast_cc_copy_config_params(&payload->config_params, cc_params);
 	payload->parent_interface_id = dial_parent_id;
 	ast_copy_string(payload->device_name, interface_name, sizeof(payload->device_name));
-	return 0;
-}
-
-int ast_queue_cc_frame(struct ast_channel *chan, const char *monitor_type, enum ast_cc_service_type service)
+	ast_copy_string(payload->dialable_name, dialable_name, sizeof(payload->dialable_name));
+	return 0;
+}
+
+int ast_queue_cc_frame(struct ast_channel *chan, const char *monitor_type, 
+		const char * const dialable_name, enum ast_cc_service_type service)
 {
 	struct ast_frame frame = {0,};
 	char chan_name[AST_CHANNEL_NAME];
@@ -3255,17 +3260,18 @@
 		return -1;
 	}
 
-	if (ast_cc_build_frame(chan, ast_channel_get_cc_config_params(chan), chan_name, service, &frame)) {
+	if (ast_cc_build_frame(chan, ast_channel_get_cc_config_params(chan), chan_name, dialable_name, service, &frame)) {
 		/* Frame building failed. We can't use this. */
 		return -1;
 	}
 	return ast_queue_frame(chan, &frame);
 }
 
-int ast_cc_build_frame(struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char * const interface_name, enum ast_cc_service_type service, struct ast_frame *frame)
+int ast_cc_build_frame(struct ast_channel *chan, struct ast_cc_config_params *cc_params, const char * const interface_name,
+		const char * const dialable_name, enum ast_cc_service_type service, struct ast_frame *frame)
 {
 	struct ast_control_cc_payload *payload = ast_calloc(1, sizeof(*payload));
-	if (cc_build_payload(chan, cc_params, interface_name, service, payload)) {
+	if (cc_build_payload(chan, cc_params, interface_name, dialable_name, service, payload)) {
 		/* Something screwed up, we can't make a frame with this */
 		ast_free(payload);
 		return -1;
@@ -3278,12 +3284,11 @@
 	return 0;
 }
 
-/* XXX This function works under the assumption that it will only be called for a single interface name.
- */
-void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_params *cc_params, const char * const interface_name)
+void ast_cc_busy_interface(struct ast_channel *inbound, struct ast_cc_config_params *cc_params,
+		const char * const interface_name, const char * const dialable_name)
 {
 	struct ast_control_cc_payload payload;
-	if (cc_build_payload(inbound, cc_params, interface_name, AST_CC_CCBS, &payload)) {
+	if (cc_build_payload(inbound, cc_params, interface_name, dialable_name, AST_CC_CCBS, &payload)) {
 		/* Something screwed up. Don't try to handle this payload */
 		return;
 	}




More information about the svn-commits mailing list