diff --git a/src/api/sipe-core.h b/src/api/sipe-core.h index 47b6b7083..910b11f00 100644 --- a/src/api/sipe-core.h +++ b/src/api/sipe-core.h @@ -499,9 +499,11 @@ sipe_core_media_stream_end(struct sipe_media_stream *stream); * * @param sipe_public (in) SIPE core data. * @param chat_session (in) chat session structure + * @param with_video (in) TRUE if a video call should be created. */ void sipe_core_media_connect_conference(struct sipe_core_public *sipe_public, - struct sipe_chat_session *chat_session); + struct sipe_chat_session *chat_session, + gboolean with_video); /** * Retrieves the media call in progress diff --git a/src/core/sipe-conf.c b/src/core/sipe-conf.c index 12600bcf0..95ad4621c 100644 --- a/src/core/sipe-conf.c +++ b/src/core/sipe-conf.c @@ -281,7 +281,8 @@ process_invite_conf_focus_response(struct sipe_core_private *sipe_private, #ifdef HAVE_VV if (session->is_call) sipe_core_media_connect_conference(SIPE_CORE_PUBLIC, - session->chat_session); + session->chat_session, + FALSE); #endif } sipe_xml_free(xn_response); @@ -1206,7 +1207,8 @@ call_accept_cb(struct sipe_core_private *sipe_private, struct conf_accept_ctx *c if (session) { sipe_core_media_connect_conference(SIPE_CORE_PUBLIC, - session->chat_session); + session->chat_session, + FALSE); } } diff --git a/src/core/sipe-media.c b/src/core/sipe-media.c index 61cf89674..5512d89b5 100644 --- a/src/core/sipe-media.c +++ b/src/core/sipe-media.c @@ -1573,7 +1573,8 @@ conference_audio_muted_cb(struct sipe_media_stream *stream, gboolean is_muted) } void sipe_core_media_connect_conference(struct sipe_core_public *sipe_public, - struct sipe_chat_session *chat_session) + struct sipe_chat_session *chat_session, + gboolean with_video) { struct sipe_core_private *sipe_private = SIPE_CORE_PRIVATE; struct sipe_media_call_private *call_private; @@ -1611,6 +1612,8 @@ void sipe_core_media_connect_conference(struct sipe_core_public *sipe_public, call_private->conference_session = session; SIPE_MEDIA_CALL->call_reject_cb = av_call_reject_cb; + g_free(av_uri); + stream = sipe_media_stream_add(SIPE_MEDIA_CALL, "audio", SIPE_MEDIA_AUDIO, call_private->ice_version, @@ -1621,11 +1624,23 @@ void sipe_core_media_connect_conference(struct sipe_core_public *sipe_public, _("Error creating audio stream")); sipe_media_hangup(call_private); + return; } stream->mute_cb = conference_audio_muted_cb; - g_free(av_uri); + if (with_video) { + stream = sipe_media_stream_add(SIPE_MEDIA_CALL, "video", + SIPE_MEDIA_VIDEO, + call_private->ice_version, + TRUE, VIDEO_SSRC_COUNT); + if (!stream) { + sipe_backend_notify_error(sipe_public, + _("Error occurred"), + _("Error creating video stream")); + sipe_media_hangup(call_private); + } + } // Processing continues in stream_initialized_cb } diff --git a/src/purple/purple-chat.c b/src/purple/purple-chat.c index bfe66c482..9435a5260 100644 --- a/src/purple/purple-chat.c +++ b/src/purple/purple-chat.c @@ -257,13 +257,26 @@ static void sipe_purple_chat_menu_lock_cb(SIPE_UNUSED_PARAMETER PurpleChat *chat #ifdef HAVE_VV -static void sipe_purple_chat_menu_join_call_cb(SIPE_UNUSED_PARAMETER PurpleChat *chat, - PurpleConversation *conv) +static void +join_conference_call(PurpleConversation *conv, gboolean with_video) { struct sipe_core_public *sipe_public = PURPLE_CONV_TO_SIPE_CORE_PUBLIC; struct sipe_chat_session *chat_session = sipe_purple_chat_get_session(conv); - SIPE_DEBUG_INFO("sipe_purple_chat_join_call_cb: %p %p", conv, chat_session); - sipe_core_media_connect_conference(sipe_public, chat_session); + sipe_core_media_connect_conference(sipe_public, chat_session, with_video); +} + +static void sipe_purple_chat_menu_join_call_cb(SIPE_UNUSED_PARAMETER PurpleChat *chat, + PurpleConversation *conv) +{ + SIPE_DEBUG_INFO("sipe_purple_chat_join_call_cb: %p", conv); + join_conference_call(conv, FALSE); +} + +static void sipe_purple_chat_menu_join_video_call_cb(SIPE_UNUSED_PARAMETER PurpleChat *chat, + PurpleConversation *conv) +{ + SIPE_DEBUG_INFO("sipe_purple_chat_join_video_call_cb: %p", conv); + join_conference_call(conv, TRUE); } #ifdef HAVE_APPSHARE @@ -349,12 +362,15 @@ sipe_purple_chat_menu(PurpleChat *chat) case SIPE_CHAT_TYPE_MULTIPARTY: #ifdef HAVE_VV if (!sipe_core_media_get_call(PURPLE_CONV_TO_SIPE_CORE_PUBLIC)) { - act = NULL; + act = purple_menu_action_new(_("Join conference video call"), + PURPLE_CALLBACK(sipe_purple_chat_menu_join_video_call_cb), + conv, NULL); + menu = g_list_prepend(menu, act); + act = purple_menu_action_new(_("Join conference call"), PURPLE_CALLBACK(sipe_purple_chat_menu_join_call_cb), conv, NULL); - if (act) - menu = g_list_prepend(menu, act); + menu = g_list_prepend(menu, act); } #ifdef HAVE_APPSHARE role = sipe_core_conf_get_appshare_role(PURPLE_CONV_TO_SIPE_CORE_PUBLIC,