[asterisk-commits] mmichelson: branch group/pimp_my_sip r379064 - /team/group/pimp_my_sip/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 14 14:33:30 CST 2013


Author: mmichelson
Date: Mon Jan 14 14:33:27 2013
New Revision: 379064

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379064
Log:
Add session supplement registration/unregistration handling.


Modified:
    team/group/pimp_my_sip/res/res_sip_session.c

Modified: team/group/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_session.c?view=diff&rev=379064&r1=379063&r2=379064
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_session.c (original)
+++ team/group/pimp_my_sip/res/res_sip_session.c Mon Jan 14 14:33:27 2013
@@ -110,6 +110,7 @@
 	struct sdp_handler_list *handler_list = obj;
 	struct ast_sip_session_sdp_handler *handler = data;
 	struct ast_sip_session_sdp_handler *iter;
+	const char *stream_type = arg;
 
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&handler_list->list, iter, next) {
 		if (!strcmp(iter->id, handler->id)) {
@@ -132,15 +133,26 @@
 	ao2_callback_data(sdp_handlers, OBJ_KEY | OBJ_UNLINK | OBJ_NODATA, remove_handler, (void *)stream_type, handler);
 }
 
+AST_RWLIST_HEAD_STATIC(session_supplements, ast_sip_session_supplement);
+
 int ast_sip_session_register_supplement(struct ast_sip_session_supplement *supplement)
 {
-	/* XXX STUB */
+	SCOPED_LOCK(lock, &session_supplements, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
+	AST_RWLIST_INSERT_TAIL(&session_supplements, supplement, next);
 	return 0;
 }
 
 void ast_sip_session_unregister_supplement(struct ast_sip_session_supplement *supplement)
 {
-	/* XXX STUB */
+	struct ast_sip_session_supplement *iter;
+	SCOPED_LOCK(lock, &session_supplements, AST_RWLIST_WRLOCK, AST_RWLIST_UNLOCK);
+	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&session_supplements, iter, next) {
+		if (supplement == iter) {
+			AST_RWLIST_REMOVE_CURRENT(next);
+			break;
+		}
+	}
+	AST_RWLIST_TRAVERSE_SAFE_END;
 }
 
 struct ast_datastore *ast_sip_session_alloc_datastore(const struct ast_datastore_info *info, const char *uid)




More information about the asterisk-commits mailing list