[asterisk-commits] qwell: branch qwell/fun_with_transports r389001 - in /team/qwell/fun_with_tra...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 17 14:18:50 CDT 2013


Author: qwell
Date: Fri May 17 14:18:44 2013
New Revision: 389001

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389001
Log:
Multiple revisions 388685,388695,388698,388923,388938

........
  r388685 | file | 2013-05-14 08:27:11 -0500 (Tue, 14 May 2013) | 2 lines
  
  Fix a crash when attempting to send a bad response on some error conditions.
........
  r388695 | seanbright | 2013-05-14 12:38:41 -0500 (Tue, 14 May 2013) | 2 lines
  
  Don't crash if we aren't sent a Content-Type header
........
  r388698 | seanbright | 2013-05-14 13:33:58 -0500 (Tue, 14 May 2013) | 2 lines
  
  DRY: Add ast_sip_is_content_type function
........
  r388923 | seanbright | 2013-05-16 05:55:25 -0500 (Thu, 16 May 2013) | 10 lines
  
  Add custom INFO support for one touch recording.
  
  Certain devices support enabling one touch recording using a SIP INFO request.
  This will pass a "Record" header on the request.
  
  (closes issue ASTERISK-21501)
  
  Review: https://reviewboard.asterisk.org/r/2541/
........
  r388938 | file | 2013-05-16 18:46:42 -0500 (Thu, 16 May 2013) | 5 lines
  
  Fix a bug where the Expires header was not checked when the '*' Contact was used.
  
  (closes issue AST-1155)
  Reported by: John Bigelow
........

Merged revisions 388685,388695,388698,388923,388938 from http://svn.asterisk.org/svn/asterisk/team/group/pimp_my_sip

Added:
    team/qwell/fun_with_transports/res/res_sip_one_touch_record_info.c
      - copied unchanged from r388938, team/group/pimp_my_sip/res/res_sip_one_touch_record_info.c
Modified:
    team/qwell/fun_with_transports/   (props changed)
    team/qwell/fun_with_transports/include/asterisk/res_sip.h
    team/qwell/fun_with_transports/res/res_sip.c
    team/qwell/fun_with_transports/res/res_sip.exports.in
    team/qwell/fun_with_transports/res/res_sip/sip_configuration.c
    team/qwell/fun_with_transports/res/res_sip_dtmf_info.c
    team/qwell/fun_with_transports/res/res_sip_messaging.c
    team/qwell/fun_with_transports/res/res_sip_registrar.c
    team/qwell/fun_with_transports/res/res_sip_sdp_rtp.c
    team/qwell/fun_with_transports/res/res_sip_session.c

Propchange: team/qwell/fun_with_transports/
------------------------------------------------------------------------------
--- pimp_my_sip-integrated (original)
+++ pimp_my_sip-integrated Fri May 17 14:18:44 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-388639
+/team/group/pimp_my_sip:1-389000

Modified: team/qwell/fun_with_transports/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/include/asterisk/res_sip.h?view=diff&rev=389001&r1=389000&r2=389001
==============================================================================
--- team/qwell/fun_with_transports/include/asterisk/res_sip.h (original)
+++ team/qwell/fun_with_transports/include/asterisk/res_sip.h Fri May 17 14:18:44 2013
@@ -365,6 +365,8 @@
 	enum ast_sip_session_media_encryption media_encryption;
 	/*! Do we use AVPF exclusively for this endpoint? */
 	unsigned int use_avpf;
+	/*! Is one-touch recording permitted? */
+	unsigned int one_touch_recording;
 };
 
 /*!
@@ -1149,4 +1151,19 @@
  */
 void ast_sip_cleanup_auths(struct ast_sip_auth *auths[], size_t num_auths);
 
+/*!
+ * \brief Checks if the given content type matches type/subtype.
+ *
+ * Compares the pjsip_media_type with the passed type and subtype and
+ * returns the result of that comparison.  The media type parameters are
+ * ignored.
+ *
+ * \param content_type The pjsip_media_type structure to compare
+ * \param type The media type to compare
+ * \param subtype The media subtype to compare
+ * \retval 0 No match
+ * \retval -1 Match
+ */
+int ast_sip_is_content_type(pjsip_media_type *content_type, char *type, char *subtype);
+
 #endif /* _RES_SIP_H */

Modified: team/qwell/fun_with_transports/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/res/res_sip.c?view=diff&rev=389001&r1=389000&r2=389001
==============================================================================
--- team/qwell/fun_with_transports/res/res_sip.c (original)
+++ team/qwell/fun_with_transports/res/res_sip.c Fri May 17 14:18:44 2013
@@ -725,6 +725,19 @@
 	dest[chars_to_copy] = '\0';
 }
 
+int ast_sip_is_content_type(pjsip_media_type *content_type, char *type, char *subtype)
+{
+	pjsip_media_type compare;
+
+	if (!content_type) {
+		return 0;
+	}
+
+	pjsip_media_type_init2(&compare, type, subtype);
+
+	return pjsip_media_type_cmp(content_type, &compare, 0) ? -1 : 0;
+}
+
 pj_caching_pool caching_pool;
 pj_pool_t *memory_pool;
 pj_thread_t *monitor_thread;

Modified: team/qwell/fun_with_transports/res/res_sip.exports.in
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/res/res_sip.exports.in?view=diff&rev=389001&r1=389000&r2=389001
==============================================================================
--- team/qwell/fun_with_transports/res/res_sip.exports.in (original)
+++ team/qwell/fun_with_transports/res/res_sip.exports.in Fri May 17 14:18:44 2013
@@ -51,6 +51,7 @@
 		LINKER_SYMBOL_PREFIXast_sip_dialog_get_endpoint;
 		LINKER_SYMBOL_PREFIXast_sip_retrieve_auths;
 		LINKER_SYMBOL_PREFIXast_sip_cleanup_auths;
+		LINKER_SYMBOL_PREFIXast_sip_is_content_type;
 	local:
 		*;
 };

Modified: team/qwell/fun_with_transports/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/res/res_sip/sip_configuration.c?view=diff&rev=389001&r1=389000&r2=389001
==============================================================================
--- team/qwell/fun_with_transports/res/res_sip/sip_configuration.c (original)
+++ team/qwell/fun_with_transports/res/res_sip/sip_configuration.c Fri May 17 14:18:44 2013
@@ -371,6 +371,7 @@
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "aggregate_mwi", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, aggregate_mwi));
 	ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "media_encryption", "no", media_encryption_handler, NULL, 0, 0);
 	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "use_avpf", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, use_avpf));
+	ast_sorcery_object_field_register(sip_sorcery, "endpoint", "one_touch_recording", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, one_touch_recording));
 
 	if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
 		ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");

Modified: team/qwell/fun_with_transports/res/res_sip_dtmf_info.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/res/res_sip_dtmf_info.c?view=diff&rev=389001&r1=389000&r2=389001
==============================================================================
--- team/qwell/fun_with_transports/res/res_sip_dtmf_info.c (original)
+++ team/qwell/fun_with_transports/res/res_sip_dtmf_info.c Fri May 17 14:18:44 2013
@@ -46,8 +46,7 @@
 	char event = '\0';
 	unsigned int duration = 0;
 
-	if (pj_strcmp2(&body->content_type.type, "application") ||
-	    pj_strcmp2(&body->content_type.subtype, "dtmf-relay")) {
+	if (!ast_sip_is_content_type(&body->content_type, "application", "dtmf-relay")) {
 		return 0;
 	}
 

Modified: team/qwell/fun_with_transports/res/res_sip_messaging.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/res/res_sip_messaging.c?view=diff&rev=389001&r1=389000&r2=389001
==============================================================================
--- team/qwell/fun_with_transports/res/res_sip_messaging.c (original)
+++ team/qwell/fun_with_transports/res/res_sip_messaging.c Fri May 17 14:18:44 2013
@@ -80,11 +80,13 @@
  */
 static enum pjsip_status_code check_content_type(const pjsip_rx_data *rdata)
 {
-	if (pj_strcmp2(&rdata->msg_info.msg->body->content_type.type, "text") ||
-	    pj_strcmp2(&rdata->msg_info.msg->body->content_type.subtype, "plain")) {
+	if (ast_sip_is_content_type(&rdata->msg_info.msg->body->content_type,
+				    "text",
+				    "plain")) {
+		return PJSIP_SC_OK;
+	} else {
 		return PJSIP_SC_UNSUPPORTED_MEDIA_TYPE;
 	}
-	return PJSIP_SC_OK;
 }
 
 /*!

Modified: team/qwell/fun_with_transports/res/res_sip_registrar.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/res/res_sip_registrar.c?view=diff&rev=389001&r1=389000&r2=389001
==============================================================================
--- team/qwell/fun_with_transports/res/res_sip_registrar.c (original)
+++ team/qwell/fun_with_transports/res/res_sip_registrar.c Fri May 17 14:18:44 2013
@@ -90,12 +90,12 @@
 	}
 
 	while ((contact = (pjsip_contact_hdr *) pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, contact->next))) {
-		int expiration;
+		int expiration = registrar_get_expiration(aor, contact, rdata);
 		RAII_VAR(struct ast_sip_contact *, existing, NULL, ao2_cleanup);
 
 		if (contact->star) {
 			/* The expiration MUST be 0 when a '*' contact is used and there must be no other contact */
-			if ((contact->expires != 0) || previous) {
+			if ((expiration != 0) || previous) {
 				pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), details.pool);
 				return -1;
 			}
@@ -111,7 +111,6 @@
 		}
 
 		details.uri = pjsip_uri_get_uri(contact->uri);
-		expiration = registrar_get_expiration(aor, contact, rdata);
 
 		/* Determine if this is an add, update, or delete for policy enforcement purposes */
 		if (!(existing = ao2_callback(contacts, 0, registrar_find_contact, &details))) {

Modified: team/qwell/fun_with_transports/res/res_sip_sdp_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/res/res_sip_sdp_rtp.c?view=diff&rev=389001&r1=389000&r2=389001
==============================================================================
--- team/qwell/fun_with_transports/res/res_sip_sdp_rtp.c (original)
+++ team/qwell/fun_with_transports/res/res_sip_sdp_rtp.c Fri May 17 14:18:44 2013
@@ -921,9 +921,9 @@
 	struct pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
 	pjsip_tx_data *tdata;
 
-	if (pj_strcmp2(&rdata->msg_info.msg->body->content_type.type, "application") ||
-	    pj_strcmp2(&rdata->msg_info.msg->body->content_type.subtype, "media_control+xml")) {
-
+	if (!ast_sip_is_content_type(&rdata->msg_info.msg->body->content_type,
+				     "application",
+				     "media_control+xml")) {
 		return 0;
 	}
 

Modified: team/qwell/fun_with_transports/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/fun_with_transports/res/res_sip_session.c?view=diff&rev=389001&r1=389000&r2=389001
==============================================================================
--- team/qwell/fun_with_transports/res/res_sip_session.c (original)
+++ team/qwell/fun_with_transports/res/res_sip_session.c Fri May 17 14:18:44 2013
@@ -1146,11 +1146,11 @@
 		return NULL;
 	}
 	if (pjsip_dlg_create_uas(pjsip_ua_instance(), rdata, NULL, &dlg) != PJ_SUCCESS) {
-		pjsip_endpt_send_response2(ast_sip_get_pjsip_endpoint(), rdata, tdata, NULL, NULL);
-        return NULL;
+		pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 500, NULL, NULL, NULL);
+		return NULL;
 	}
 	if (pjsip_inv_create_uas(dlg, rdata, NULL, 0, &inv_session) != PJ_SUCCESS) {
-		pjsip_endpt_send_response2(ast_sip_get_pjsip_endpoint(), rdata, tdata, NULL, NULL);
+		pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 500, NULL, NULL, NULL);
 		pjsip_dlg_terminate(dlg);
 		return NULL;
 	}




More information about the asterisk-commits mailing list