[asterisk-commits] murf: trunk r63046 - in /trunk: ./ channels/ include/asterisk/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri May 4 09:37:23 MST 2007


Author: murf
Date: Fri May  4 11:37:23 2007
New Revision: 63046

URL: http://svn.digium.com/view/asterisk?view=rev&rev=63046
Log:
Added a small bit of code to support the SNOM 360's Record button. Made the find_feature func in res_features.c public, so I could use it to find the automon dial sequence as configured by the user. When the INFO packet has a Record: header with on/off, the sequence is sent as consecutive DTMF frames on the phone's channel, triggering the automon functionality. The user has to configure the automon in features.conf, and set up his dialplan accordingly.

Modified:
    trunk/UPGRADE.txt
    trunk/channels/chan_sip.c
    trunk/include/asterisk/features.h
    trunk/res/res_features.c

Modified: trunk/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/trunk/UPGRADE.txt?view=diff&rev=63046&r1=63045&r2=63046
==============================================================================
--- trunk/UPGRADE.txt (original)
+++ trunk/UPGRADE.txt Fri May  4 11:37:23 2007
@@ -61,3 +61,14 @@
   choppiness or the clipping of loud signal peaks.  To increasing the volume
   of voicemail messages, use the 'volgain' option in voicemail.conf
 
+Channel Drivers:
+
+* chan_sip.c: a small upgrade to support the "Record" button on the SNOM360,
+  which sends a sip INFO message with a "Record: on" or "Record: off" 
+  header. If asterisk is set up (via features.conf) to accept "One Touch Monitor"
+  requests (by default, via '*1'), then the user-configured dialpad sequence
+  is generated, and recording can be started and stopped via this button. The
+  file names and formats are all controlled via the normal mechanisms. If the
+  user has not configured the automon feature, the normal "415 Unsupported media type"
+  is returned, and nothing is done.
+

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=63046&r1=63045&r2=63046
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri May  4 11:37:23 2007
@@ -11645,6 +11645,38 @@
 			transmit_response(p, "403 Unauthorized", req);
 		}
 		return;
+	} else if (!ast_strlen_zero(c = get_header(req, "Record"))) {
+		/* first, get the feature string, if it exists */
+		struct ast_call_feature *feat = find_feature("automon");
+		
+		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);
+			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");
+			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");
+			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)) { */

Modified: trunk/include/asterisk/features.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/features.h?view=diff&rev=63046&r1=63045&r2=63046
==============================================================================
--- trunk/include/asterisk/features.h (original)
+++ trunk/include/asterisk/features.h Fri May  4 11:37:23 2007
@@ -94,4 +94,8 @@
     \param feature the ast_call_feature object which was registered before*/
 void ast_unregister_feature(struct ast_call_feature *feature);
 
+/*! \brief look for a feature entry by its sname
+	\param name a string ptr, should match "automon", "blindxfer", "atxfer", etc. */
+struct ast_call_feature *find_feature(char *name);
+
 #endif /* _AST_FEATURES_H */

Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?view=diff&rev=63046&r1=63045&r2=63046
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Fri May  4 11:37:23 2007
@@ -1056,7 +1056,7 @@
 }
 
 /*! \brief find a feature by name */
-static struct ast_call_feature *find_feature(char *name)
+struct ast_call_feature *find_feature(char *name)
 {
 	struct ast_call_feature *tmp;
 



More information about the asterisk-commits mailing list