]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
zrtp_secure_media=true will have to be set to true in order for your zrtp to work...
authorBrian West <brian@freeswitch.org>
Wed, 27 May 2009 05:07:19 +0000 (05:07 +0000)
committerBrian West <brian@freeswitch.org>
Wed, 27 May 2009 05:07:19 +0000 (05:07 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13461 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/vars.xml
src/switch_rtp.c

index de265a6948ad1a3a8c40436449e419bb7e661783..4cea3262377c75ebd0c0fecdcbf647bb89ba9a11 100644 (file)
@@ -26,6 +26,9 @@
   <X-PRE-PROCESS cmd="set" data="domain=$${local_ip_v4}"/>
   <X-PRE-PROCESS cmd="set" data="domain_name=$${domain}"/>
   <X-PRE-PROCESS cmd="set" data="hold_music=local_stream://moh"/>
+
+  <!-- Enable ZRTP globally you can override this on a per channel basis -->
+  <X-PRE-PROCESS cmd="set" data="zrtp_secure_media=true"/>
   <!--
       xmpp_client_profile and xmpp_server_profile
       xmpp_client_profile can be any string. 
index 5b4d9c7fdd63bb71f3de5a3e4fd4bcb6950f6a5f..d0a3922bc45a77a5be17635386c87b0dcfe452ed 100644 (file)
@@ -1107,35 +1107,38 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
                int initiator = 0;
                switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
                switch_channel_t *channel = switch_core_session_get_channel(session);
+               const char *zrtp_enabled = switch_channel_get_variable(channel, "zrtp_secure_media");
 
-               if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
-                       initiator = 1;
-               }
-
-               rtp_session->zrtp_profile = switch_core_alloc(rtp_session->pool, sizeof(*rtp_session->zrtp_profile));
-               zrtp_profile_defaults(rtp_session->zrtp_profile, zrtp_global);
-
-               rtp_session->zrtp_profile->allowclear = 0;
-               rtp_session->zrtp_profile->disclose_bit = 0;
-               rtp_session->zrtp_profile->cache_ttl = -1;
-
-               if (zrtp_status_ok != zrtp_session_init(zrtp_global, rtp_session->zrtp_profile, zid, initiator, &rtp_session->zrtp_session)) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! zRTP INIT Failed\n");
-                       zrtp_session_down(rtp_session->zrtp_session);
-                       rtp_session->zrtp_session = NULL;
-               }
-
-               zrtp_session_set_userdata(rtp_session->zrtp_session, rtp_session);
-       
-               if (zrtp_status_ok != zrtp_stream_attach(rtp_session->zrtp_session, &rtp_session->zrtp_ctx)) {
-                       abort();
-               }
-               zrtp_stream_set_userdata(rtp_session->zrtp_ctx, rtp_session);
-               
-               if (switch_true(switch_channel_get_variable(channel, "zrtp_enrollment"))) {
-                       zrtp_stream_registration_start(rtp_session->zrtp_ctx, rtp_session->ssrc);
-               } else {
-                       zrtp_stream_start(rtp_session->zrtp_ctx, rtp_session->ssrc);
+               if (switch_true(zrtp_enabled)) {
+                       if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+                               initiator = 1;
+                       }
+                       
+                       rtp_session->zrtp_profile = switch_core_alloc(rtp_session->pool, sizeof(*rtp_session->zrtp_profile));
+                       zrtp_profile_defaults(rtp_session->zrtp_profile, zrtp_global);
+                       
+                       rtp_session->zrtp_profile->allowclear = 0;
+                       rtp_session->zrtp_profile->disclose_bit = 0;
+                       rtp_session->zrtp_profile->cache_ttl = -1;
+                       
+                       if (zrtp_status_ok != zrtp_session_init(zrtp_global, rtp_session->zrtp_profile, zid, initiator, &rtp_session->zrtp_session)) {
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! zRTP INIT Failed\n");
+                               zrtp_session_down(rtp_session->zrtp_session);
+                               rtp_session->zrtp_session = NULL;
+                       }
+                       
+                       zrtp_session_set_userdata(rtp_session->zrtp_session, rtp_session);
+                       
+                       if (zrtp_status_ok != zrtp_stream_attach(rtp_session->zrtp_session, &rtp_session->zrtp_ctx)) {
+                               abort();
+                       }
+                       zrtp_stream_set_userdata(rtp_session->zrtp_ctx, rtp_session);
+                       
+                       if (switch_true(switch_channel_get_variable(channel, "zrtp_enrollment"))) {
+                               zrtp_stream_registration_start(rtp_session->zrtp_ctx, rtp_session->ssrc);
+                       } else {
+                               zrtp_stream_start(rtp_session->zrtp_ctx, rtp_session->ssrc);
+                       }
                }
        }
 #endif