summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ab54c765b..7a48cd8cd 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -284,6 +284,7 @@ ASTERISK_REGISTER_FILE()
#include "asterisk/features_config.h"
#include "asterisk/http_websocket.h"
#include "asterisk/format_cache.h"
+#include "asterisk/linkedlists.h" /* for AST_LIST_NEXT */
/*** DOCUMENTATION
<application name="SIPDtmfMode" language="en_US">
@@ -13222,21 +13223,34 @@ static void get_our_media_address(struct sip_pvt *p, int needvideo, int needtext
static char *crypto_get_attrib(struct ast_sdp_srtp *srtp, int dtls_enabled, int default_taglen_32)
{
+ struct ast_sdp_srtp *tmp = srtp;
char *a_crypto;
- const char *orig_crypto;
- if (!srtp || dtls_enabled) {
+ if (!tmp || dtls_enabled) {
return NULL;
}
- orig_crypto = ast_sdp_srtp_get_attrib(srtp, dtls_enabled, default_taglen_32);
- if (ast_strlen_zero(orig_crypto)) {
+ a_crypto = ast_strdup("");
+ if (!a_crypto) {
return NULL;
}
- if (ast_asprintf(&a_crypto, "a=crypto:%s\r\n", orig_crypto) == -1) {
- return NULL;
- }
+ do {
+ char *copy = a_crypto;
+ const char *orig_crypto = ast_sdp_srtp_get_attrib(tmp, dtls_enabled, default_taglen_32);
+
+ if (ast_strlen_zero(orig_crypto)) {
+ ast_free(copy);
+ return NULL;
+ }
+ if (ast_asprintf(&a_crypto, "%sa=crypto:%s\r\n", copy, orig_crypto) == -1) {
+ ast_free(copy);
+ return NULL;
+ }
+
+ ast_free(copy);
+ } while ((tmp = AST_LIST_NEXT(tmp, sdp_srtp_list)));
+
return a_crypto;
}