@@ 0,0 1,66 @@
+From: Stephen Paul Weber <singpolyma@singpolyma.net>
+Date: Thu, 27 Aug 2020 19:43:55 -0500
+X-Dgit-Generated: 1:16.2.1~dfsg-1+deb10u1 a192e25f489ab2455395eac2c106f1fd517ad05f
+Subject: DTLS support for video
+
+
+---
+
+--- asterisk-16.2.1~dfsg.orig/channels/chan_motif.c
++++ asterisk-16.2.1~dfsg/channels/chan_motif.c
+@@ -666,6 +666,9 @@ static void jingle_set_owner(struct jing
+ }
+ }
+
++static struct ast_rtp_dtls_cfg dtls_cfg;
++static struct ast_rtp_dtls_cfg dtls_cfg_video;
++
+ /*! \brief Internal helper function which enables video support on a sesson if possible */
+ static void jingle_enable_video(struct jingle_session *session)
+ {
+@@ -697,9 +700,31 @@ static void jingle_enable_video(struct j
+ if (session->transport == JINGLE_TRANSPORT_GOOGLE_V2 && (ice = ast_rtp_instance_get_ice(session->vrtp))) {
+ ice->stop(session->vrtp);
+ }
+-}
+
+-static struct ast_rtp_dtls_cfg dtls_cfg;
++ struct ast_rtp_engine_dtls *dtls;
++ if (session->vrtp && (dtls = ast_rtp_instance_get_dtls(session->vrtp))) {
++ dtls_cfg_video.enabled = 1;
++ dtls_cfg_video.default_setup = AST_RTP_DTLS_SETUP_ACTPASS;
++ dtls_cfg_video.hash = AST_RTP_DTLS_HASH_SHA256;
++ dtls_cfg_video.verify = AST_RTP_DTLS_VERIFY_FINGERPRINT;
++ dtls_cfg_video.suite = AST_AES_CM_128_HMAC_SHA1_80;
++ dtls_cfg_video.ephemeral_cert = 1;
++ dtls_cfg_video.certfile = ast_strdup("");
++ dtls_cfg_video.pvtfile = ast_strdup("");
++ dtls_cfg_video.cipher = ast_strdup("");
++ dtls_cfg_video.cafile = ast_strdup("");
++ dtls_cfg_video.capath = ast_strdup("");
++
++ if (dtls->set_configuration(session->vrtp, &dtls_cfg_video)) {
++ ast_log(LOG_ERROR, "Attempted to set an invalid DTLS-SRTP configuration on RTP instance '%p'\n",
++ session->rtp);
++ }
++ }
++ else {
++ ast_log(LOG_ERROR, "No DTLS-SRTP support present on engine for RTP instance '%p', was it compiled with support for it?\n",
++ session->rtp);
++ }
++}
+
+ /*! \brief Internal helper function used to allocate Jingle session on an endpoint */
+ static struct jingle_session *jingle_alloc(struct jingle_endpoint *endpoint, const char *from, const char *sid)
+@@ -1604,6 +1629,11 @@ static void jingle_send_session_accept(s
+ // This will cause us to reply with active
+ dtls->set_setup(session->rtp, AST_RTP_DTLS_SETUP_ACTPASS);
+ }
++ if (session->vrtp && (dtls = ast_rtp_instance_get_dtls(session->vrtp)) && dtls->get_setup(session->vrtp) == AST_RTP_DTLS_SETUP_ACTPASS) {
++ // We don't know what the remote wants yet, so just assume both?
++ // This will cause us to reply with active
++ dtls->set_setup(session->vrtp, AST_RTP_DTLS_SETUP_ACTPASS);
++ }
+ jingle_send_session_action(session, session->transport == JINGLE_TRANSPORT_GOOGLE_V1 ? "accept" : "session-accept");
+ }
+
@@ 42,3 42,4 @@ there-can-be-children-other-than-content.patch
remove-duplicate-fingerprint.patch
default-to-active-on-session-accept.patch
allow--in-user-part-of-fromuser_and_doma.patch
+dtls-support-for-video.patch