[asterisk-commits] kmoore: branch kmoore/pimp_sip_srtp r386429 - in /team/kmoore/pimp_sip_srtp: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 24 13:44:33 CDT 2013
Author: kmoore
Date: Wed Apr 24 13:44:30 2013
New Revision: 386429
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386429
Log:
Clean up naming of a static function and make mid-call re-keying work properly
Modified:
team/kmoore/pimp_sip_srtp/main/sdp_srtp.c
team/kmoore/pimp_sip_srtp/res/res_sip_session.c
Modified: team/kmoore/pimp_sip_srtp/main/sdp_srtp.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pimp_sip_srtp/main/sdp_srtp.c?view=diff&rev=386429&r1=386428&r2=386429
==============================================================================
--- team/kmoore/pimp_sip_srtp/main/sdp_srtp.c (original)
+++ team/kmoore/pimp_sip_srtp/main/sdp_srtp.c Wed Apr 24 13:44:30 2013
@@ -152,7 +152,7 @@
return 0;
}
-static int ast_sdp_crypto_activate(struct ast_sdp_crypto *p, int suite_val, unsigned char *remote_key, struct ast_rtp_instance *rtp)
+static int crypto_activate(struct ast_sdp_crypto *p, int suite_val, unsigned char *remote_key, struct ast_rtp_instance *rtp)
{
struct ast_srtp_policy *local_policy = NULL;
struct ast_srtp_policy *remote_policy = NULL;
@@ -297,7 +297,7 @@
}
memcpy(crypto->remote_key, remote_key, sizeof(crypto->remote_key));
- if (ast_sdp_crypto_activate(crypto, suite_val, remote_key, rtp) < 0) {
+ if (crypto_activate(crypto, suite_val, remote_key, rtp) < 0) {
return -1;
}
Modified: team/kmoore/pimp_sip_srtp/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pimp_sip_srtp/res/res_sip_session.c?view=diff&rev=386429&r1=386428&r2=386429
==============================================================================
--- team/kmoore/pimp_sip_srtp/res/res_sip_session.c (original)
+++ team/kmoore/pimp_sip_srtp/res/res_sip_session.c Wed Apr 24 13:44:30 2013
@@ -336,9 +336,32 @@
char media[20];
struct ast_sip_session_sdp_handler *handler;
RAII_VAR(struct sdp_handler_list *, handler_list, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_sip_session_media *, session_media, NULL, ao2_cleanup);
/* We need a null-terminated version of the media string */
ast_copy_pj_str(media, &sdp->media[i]->desc.media, sizeof(media));
+
+ session_media = ao2_find(session->media, media, OBJ_KEY);
+ if (!session_media) {
+ /* if the session_media doesn't exist, there weren't
+ * any handlers at the time of its creation */
+ continue;
+ }
+
+ if (session_media->handler) {
+ int res;
+ handler = session_media->handler;
+ res = handler->negotiate_incoming_sdp_stream(
+ session, session_media, sdp, sdp->media[i]);
+ if (res <= 0) {
+ /* Catastrophic failure or ignored by assigned handler. Abort! */
+ return -1;
+ }
+ if (res > 0) {
+ /* Handled by this handler. Move to the next stream */
+ continue;
+ }
+ }
handler_list = ao2_find(sdp_handlers, media, OBJ_KEY);
if (!handler_list) {
@@ -347,9 +370,7 @@
}
AST_LIST_TRAVERSE(&handler_list->list, handler, next) {
int res;
- RAII_VAR(struct ast_sip_session_media *, session_media, NULL, ao2_cleanup);
- session_media = ao2_find(session->media, handler_list->stream_type, OBJ_KEY);
- if (!session_media || session_media->handler) {
+ if (session_media->handler) {
/* There is only one slot for this stream type and it has already been claimed
* so it will go unhandled */
break;
More information about the asterisk-commits
mailing list