diff --git a/conf/vanilla/autoload_configs/conference_layouts.conf.xml b/conf/vanilla/autoload_configs/conference_layouts.conf.xml index 1c4fc0fd07..04360831a4 100644 --- a/conf/vanilla/autoload_configs/conference_layouts.conf.xml +++ b/conf/vanilla/autoload_configs/conference_layouts.conf.xml @@ -2,7 +2,7 @@ - + diff --git a/html5/verto/video_demo/index.html b/html5/verto/video_demo/index.html index 73334887ea..637de7983e 100644 --- a/html5/verto/video_demo/index.html +++ b/html5/verto/video_demo/index.html @@ -117,6 +117,8 @@ + +



@@ -419,6 +421,7 @@ FireFox is pretty much stuck on 640x480 for now. Chrome even when put into the + diff --git a/html5/verto/video_demo/js/verto-min.js b/html5/verto/video_demo/js/verto-min.js index 8bc97845ea..192320d3a1 100644 --- a/html5/verto/video_demo/js/verto-min.js +++ b/html5/verto/video_demo/js/verto-min.js @@ -6,7 +6,7 @@ function getCodecPayloadType(sdpLine){var pattern=new RegExp('a=rtpmap:(\\d+) \\ function setDefaultCodec(mLine,payload){var elements=mLine.split(' ');var newLine=[];var index=0;for(var i=0;i$.verto.enum.state.requesting.val&&dialog.lastState.val<$.verto.enum.state.hangup.val){dialog.sendMethod("verto.bye",{});} -dialog.setState($.verto.enum.state.destroy);break;case $.verto.enum.state.destroy:delete dialog.verto.dialogs[dialog.callID];dialog.rtc.stop();break;} +dialog.setState($.verto.enum.state.destroy);break;case $.verto.enum.state.destroy:delete dialog.verto.dialogs[dialog.callID];if(!dialog.params.screenShare){dialog.rtc.stop();} +break;} return true;};$.verto.dialog.prototype.processReply=function(method,success,e){var dialog=this;switch(method){case"verto.answer":case"verto.attach":if(success){dialog.setState($.verto.enum.state.active);}else{dialog.hangup();} break;case"verto.invite":if(success){dialog.setState($.verto.enum.state.trying);}else{dialog.setState($.verto.enum.state.destroy);} break;case"verto.bye":dialog.hangup();break;case"verto.modify":if(e.holdState){if(e.holdState=="held"){if(dialog.state!=$.verto.enum.state.held){dialog.setState($.verto.enum.state.held);}}else if(e.holdState=="active"){if(dialog.state!=$.verto.enum.state.active){dialog.setState($.verto.enum.state.active);}}} diff --git a/html5/verto/video_demo/verto.js b/html5/verto/video_demo/verto.js index 028c955e94..696e7da987 100644 --- a/html5/verto/video_demo/verto.js +++ b/html5/verto/video_demo/verto.js @@ -1,5 +1,6 @@ 'use strict'; var cur_call = null; +var share_call = null; var confMan = null; var verto; var ringing = false; @@ -318,8 +319,30 @@ var callbacks = { }, onDialogState: function(d) { - cur_call = d; + //console.error(d, share_call, d == share_call, d.state); + + if (d == share_call) { + switch (d.state) { + case $.verto.enum.state.early: + case $.verto.enum.state.active: + $("#nosharebtn").show(); + $("#sharebtn").hide(); + break; + case $.verto.enum.state.destroy: + $("#nosharebtn").hide(); + $("#sharebtn").show(); + share_call = null; + break; + } + + return; + } + + if (!cur_call) { + cur_call = d; + } + if (d.state == $.verto.enum.state.ringing) { ringing = true; } else { @@ -515,10 +538,69 @@ function docall() { }); } + +function doshare(on) { + //$('#ext').trigger('change'); + + if (!on) { + if (share_call) { + share_call.hangup(); + share_call = null; + return; + } + } + + + if (share_call) { + return; + } + + + console.error("WTF???"); + getScreenId(function (error, sourceId, screen_constraints) { + console.error(error, sourceId, screen_constraints); + + verto.videoParams(screen_constraints.video.mandatory); + + share_call = verto.newCall({ + destination_number: $("#ext").val(), + caller_id_name: $("#name").val(), + caller_id_number: $("#cid").val(), + useVideo: true, + screenShare: true + }); + + }); + + + + //$("#main_info").html("Trying"); + + //check_vid_res(); + + //cur_share = verto.newCall({ + // destination_number: $("#ext").val(), + // caller_id_name: $("#name").val(), + // caller_id_number: $("#cid").val(), + // useVideo: check_vid(), + // useStereo: $("#use_stereo").is(':checked') + //}); +} + $("#callbtn").click(function() { docall(); }); +$("#sharebtn").click(function() { + doshare(true); +}); + +$("#nosharebtn").click(function() { + doshare(false); +}); + +$("#nosharebtn").hide(); + function pop(id, cname, dft) { var tmp = $.cookie(cname) || dft; $.cookie(cname, tmp, { diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 4520ca23c6..148e24fdc8 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1464,6 +1464,7 @@ typedef enum { CF_VIDEO_DECODED_READ, CF_VIDEO_DEBUG_READ, CF_VIDEO_DEBUG_WRITE, + CF_VIDEO_ONLY, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 25d3822b61..b12578407c 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -11363,10 +11363,17 @@ SWITCH_STANDARD_APP(conference_function) /* Chime in the core video thread */ switch_core_session_set_video_read_callback(session, video_thread_callback, (void *)&member); - /* Run the conference loop */ - do { - conference_loop_output(&member); - } while (member.loop_loop); + if (switch_channel_test_flag(channel, CF_VIDEO_ONLY)) { + while(switch_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) { + switch_yield(100000); + } + } else { + + /* Run the conference loop */ + do { + conference_loop_output(&member); + } while (member.loop_loop); + } switch_core_session_set_video_read_callback(session, NULL, NULL); diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index ae6d9adaf3..71ec4bcb19 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3204,7 +3204,7 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response) { - cJSON *obj = cJSON_CreateObject(); + cJSON *obj = cJSON_CreateObject(), *screenShare = NULL; switch_core_session_t *session = NULL; switch_channel_t *channel; switch_event_t *var_event; @@ -3270,6 +3270,11 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock destination_number = "service"; } + if ((screenShare = cJSON_GetObjectItem(dialog, "screenShare")) && screenShare->type == cJSON_True) { + switch_channel_set_flag(channel, CF_VIDEO_ONLY); + } + + switch_snprintf(name, sizeof(name), "verto.rtc/%s", destination_number); switch_channel_set_name(channel, name); switch_channel_set_variable(channel, "jsock_uuid_str", jsock->uuid_str); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 4e2e1ed416..91d342178a 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -2253,6 +2253,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_sessio engine = &smh->engines[type]; + + if (switch_channel_test_flag(session->channel, CF_VIDEO_ONLY) && type == SWITCH_MEDIA_TYPE_AUDIO) { + return SWITCH_STATUS_SUCCESS; + } + while (!(engine->read_codec.implementation && switch_rtp_ready(engine->rtp_session))) { if (switch_channel_ready(session->channel)) { switch_yield(10000); @@ -6754,7 +6759,6 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=msid-semantic: WMS %s\n", smh->msid); } - if (a_engine->codec_negotiated) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=audio %d %s", port, get_media_profile_name(session, !a_engine->no_crypto && @@ -7035,7 +7039,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess } } - + if (switch_channel_test_flag(session->channel, CF_VIDEO_POSSIBLE)) { if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_INBOUND) { if (switch_channel_test_flag(smh->session->channel, CF_DTLS)) {