[svn-commits] oej: trunk r63136 - /trunk/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat May 5 01:05:38 MST 2007


Author: oej
Date: Sat May  5 03:05:38 2007
New Revision: 63136

URL: http://svn.digium.com/view/asterisk?view=rev&rev=63136
Log:
- Adding some missing spaces
- Correcting error messages
- Disabling code that doesn't do anything
- Making sure we always respond to this request, happily

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=63136&r1=63135&r2=63136
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sat May  5 03:05:38 2007
@@ -11642,41 +11642,54 @@
 				ast_cdr_setuserfield(ast_bridged_channel(p->owner), c);
 			transmit_response(p, "200 OK", req);
 		} else {
-			transmit_response(p, "403 Unauthorized", req);
+			transmit_response(p, "403 Forbidden", req);
 		}
 		return;
 	} else if (!ast_strlen_zero(c = get_header(req, "Record"))) {
+		/* INFO messages generated by some phones to start/stop recording
+			on phone calls. 
+			OEJ: I think this should be something that is enabled/disabled
+			per device. I don't want incoming callers to record calls in my
+			pbx.
+		*/
 		/* first, get the feature string, if it exists */
 		struct ast_call_feature *feat = ast_find_call_feature("automon");
+		int j;
+		struct ast_frame f = { AST_FRAME_DTMF, };
 		
 		if (!feat || ast_strlen_zero(feat->exten)) {
 			ast_log(LOG_WARNING,"Recording requested, but no One Touch Monitor registered. (See features.conf)\n");
-			transmit_response(p, "415 Unsupported media type", req);
+			/* 403 means that we don't support this feature, so don't request it again */
+			transmit_response(p, "403 Forbidden", req);
 			return;
-		} else {
-			int j;
-			struct ast_frame f = { AST_FRAME_DTMF, };
-			f.len = 100;
-			for (j=0; j<strlen(feat->exten); j++) {
-				f.subclass = feat->exten[j];
-				ast_queue_frame(p->owner, &f);
-				if (sipdebug)
-					ast_verbose("* DTMF-relay event received: %c\n", f.subclass);
-			}
-		}
-		
-		if (strcasecmp(c,"on")== 0) {
-		
-			ast_log(LOG_NOTICE,"Got a Request to Record the channel!\n");
+		} 
+		/* OEJ: Why is the DTMF code included in the record section? */
+		f.len = 100;
+		for (j=0; j<strlen(feat->exten); j++) {
+			f.subclass = feat->exten[j];
+			ast_queue_frame(p->owner, &f);
+			if (sipdebug)
+				ast_verbose("* DTMF-relay event received: %c\n", f.subclass);
+		}
+#ifdef DISABLED_CODE
+		/* And feat isn't used here - Is this code tested at all??? 
+			We just send a reply ... 
+		*/
+		if (strcasecmp(c, "on")== 0) {
+			if (option_debug)
+				ast_log(LOG_DEBUG, "Got a Request to Record the channel!\n");
 			transmit_response(p, "200 OK", req);
 			return;
 
-		} else if (strcasecmp(c,"off")== 0) {
-
-			ast_log(LOG_NOTICE,"Got a Request to Stop Recording the channel\n");
+		} else if (strcasecmp(c, "off")== 0) {
+			if (option_debug)
+				ast_log(LOG_DEBUG, "Got a Request to Stop Recording the channel\n");
 			transmit_response(p, "200 OK", req);
 			return;
 		}
+#endif
+		transmit_response(p, "200 OK", req);
+		return;
 	}
 	/* Other type of INFO message, not really understood by Asterisk */
 	/* if (get_msg_text(buf, sizeof(buf), req)) { */



More information about the svn-commits mailing list