Skip to content

Commit

Permalink
conf: join conference video call
Browse files Browse the repository at this point in the history
  • Loading branch information
xhaakon committed Oct 22, 2019
1 parent 334c76c commit e65869d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/api/sipe-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/core/sipe-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1198,7 +1199,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);
}
}

Expand Down
19 changes: 17 additions & 2 deletions src/core/sipe-media.c
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,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;
Expand Down Expand Up @@ -1617,6 +1618,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,
Expand All @@ -1627,11 +1630,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
}
Expand Down
30 changes: 23 additions & 7 deletions src/purple/purple-chat.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,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
Expand Down Expand Up @@ -352,12 +365,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_action_menu_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_action_menu_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,
Expand Down

0 comments on commit e65869d

Please sign in to comment.