- Adding some missing spaces
authorOlle Johansson <oej@edvina.net>
Sat, 5 May 2007 08:05:38 +0000 (08:05 +0000)
committerOlle Johansson <oej@edvina.net>
Sat, 5 May 2007 08:05:38 +0000 (08:05 +0000)
- Correcting error messages
- Disabling code that doesn't do anything
- Making sure we always respond to this request, happily

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@63136 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index d4f2558..41234b8 100644 (file)
@@ -11642,41 +11642,54 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
                                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);
-                       }
+               } 
+               /* 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);
                }
-               
-               if (strcasecmp(c,"on")== 0) {
-               
-                       ast_log(LOG_NOTICE,"Got a Request to Record the channel!\n");
+#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)) { */