summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-05-02 19:39:23 +0200
committerGitHub <noreply@github.com>2017-05-02 19:39:23 +0200
commit9dd09211bb52d85ccf7cc78e7e818ad0663f5d9a (patch)
tree574031af192e3f93d39cf1eb6930aaeb3a357165
parent893ba0894236eecf497e1d013bda364cc88569ee (diff)
attempt to fix SRTP for early-media (ref #229) (#243)
-rw-r--r--modules/srtp/srtp.c7
-rw-r--r--src/call.c3
2 files changed, 10 insertions, 0 deletions
diff --git a/modules/srtp/srtp.c b/modules/srtp/srtp.c
index b327154..217e5bf 100644
--- a/modules/srtp/srtp.c
+++ b/modules/srtp/srtp.c
@@ -34,6 +34,7 @@ struct menc_st {
uint8_t key_rx[32];
struct srtp *srtp_tx, *srtp_rx;
bool use_srtp;
+ bool got_sdp;
char *crypto_suite;
void *rtpsock;
@@ -194,6 +195,9 @@ static bool recv_handler(struct sa *src, struct mbuf *mb, void *arg)
int err = 0;
(void)src;
+ if (!st->got_sdp)
+ return true; /* drop the packet */
+
if (!st->use_srtp || !is_rtp_or_rtcp(mb))
return false;
@@ -347,6 +351,9 @@ static int alloc(struct menc_media **stp, struct menc_sess *sess,
/* SDP handling */
+ if (sdp_media_rport(sdpm))
+ st->got_sdp = true;
+
if (sdp_media_rattr(st->sdpm, "crypto")) {
rattr = sdp_media_rattr_apply(st->sdpm, "crypto",
diff --git a/src/call.c b/src/call.c
index 18b9b3a..15c8e8c 100644
--- a/src/call.c
+++ b/src/call.c
@@ -1485,6 +1485,9 @@ static void sipsess_progr_handler(const struct sip_msg *msg, void *arg)
call_event_handler(call, CALL_EVENT_PROGRESS, call->peer_uri);
else
call_event_handler(call, CALL_EVENT_RINGING, call->peer_uri);
+
+ if (media)
+ update_media(call);
}