[asterisk-commits] mmichelson: branch group/CCSS r236709 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 28 12:28:55 CST 2009


Author: mmichelson
Date: Mon Dec 28 12:28:53 2009
New Revision: 236709

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=236709
Log:
Add function sip_handle_cc as a central function to
deal with queuing CC frames. 

Currently, it only handles generic CC. The next step
is to imbue it with the power to facilitate SIP CC.


Modified:
    team/group/CCSS/channels/chan_sip.c

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=236709&r1=236708&r2=236709
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Mon Dec 28 12:28:53 2009
@@ -3783,6 +3783,15 @@
 	ao2_ref(monitor_instance, -1);
 }
 
+static void sip_handle_cc(struct sip_pvt *pvt, enum ast_cc_service_type service)
+{
+	if (ast_get_cc_monitor_policy(pvt->cc_params) == AST_CC_MONITOR_GENERIC) {
+		char interface_name[AST_CHANNEL_NAME];
+		ast_channel_get_device_name(pvt->owner, interface_name, sizeof(interface_name));
+		ast_queue_cc_frame(pvt->owner, interface_name, AST_CC_GENERIC_MONITOR_TYPE, service);
+	}
+	return;
+}
 
 /*! \brief Working TLS connection configuration */
 static struct ast_tls_config sip_tls_cfg;
@@ -19688,11 +19697,7 @@
 				connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
 				ast_channel_queue_connected_line_update(p->owner, &connected);
 			}
-			if (ast_get_cc_monitor_policy(p->cc_params) == AST_CC_MONITOR_GENERIC) {
-				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);
-			}
+			sip_handle_cc(p, AST_CC_CCNR);
 			ast_queue_control(p->owner, AST_CONTROL_RINGING);
 			if (p->owner->_state != AST_STATE_UP) {
 				ast_setstate(p->owner, AST_STATE_RINGING);
@@ -19717,11 +19722,7 @@
 			struct ast_party_redirecting redirecting = {{0,},};
 			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) {
-				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);
-			}
+			sip_handle_cc(p, AST_CC_CCNR);
 		}
 		check_pendings(p);
 		break;
@@ -19739,11 +19740,7 @@
 				connected.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
 				ast_channel_queue_connected_line_update(p->owner, &connected);
 			}
-			if (ast_get_cc_monitor_policy(p->cc_params) == AST_CC_MONITOR_GENERIC) {
-				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);
-			}
+			sip_handle_cc(p, AST_CC_CCNR);
 		}
 		if (find_sdp(req)) {
 			if (p->invitestate != INV_CANCELLED)
@@ -20703,11 +20700,7 @@
 				case 600: /* Busy everywhere */
 				case 603: /* Decline */
 					if (p->owner) {
-						if (ast_get_cc_monitor_policy(p->cc_params) == AST_CC_MONITOR_GENERIC) {
-							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);
-						}
+						sip_handle_cc(p, AST_CC_CCBS);
 						ast_queue_control(p->owner, AST_CONTROL_BUSY);
 					}
 					break;




More information about the asterisk-commits mailing list