]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7513 FS-7509: crack at screen share
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 17 Feb 2015 03:21:10 +0000 (21:21 -0600)
committerMichael Jerris <mike@jerris.com>
Thu, 28 May 2015 17:47:03 +0000 (12:47 -0500)
conf/vanilla/autoload_configs/conference_layouts.conf.xml
html5/verto/video_demo/index.html
html5/verto/video_demo/js/verto-min.js
html5/verto/video_demo/verto.js
src/include/switch_types.h
src/mod/applications/mod_conference/mod_conference.c
src/mod/endpoints/mod_verto/mod_verto.c
src/switch_core_media.c

index 1c4fc0fd078f219571483d8258409ada2aee9f6b..04360831a49b2995b7bdac78e1239b51e7b193f6 100644 (file)
@@ -2,7 +2,7 @@
   <layout-settings>
     <layouts>
       <layout name="1x1">
-       <image x="0" y="0" scale="360"/>
+       <image x="0" y="0" scale="360" floor="true"/>
       </layout>
       <layout name="1x2">
        <image x="90" y="0" scale="180"/>
index 73334887ea705132873f892ea2e0e397f193f10f..637de7983e4a7b4690a6871c5e6beb29fb98de93 100644 (file)
 
 <!--      <button data-inline="true" id="hold">HOLD</button>-->
       <button data-inline="true" id="hupbtn">End Call</button>
+         <button data-inline="true" id="sharebtn">Share</button>
+         <button data-inline="true" id="nosharebtn">End Share</button>
 <!--      <button data-inline="true" class="startxferbtn">Transfer</button>-->
        <br><br>
        <img src="img/verto_black_web.gif" width="300"><br><br>
@@ -419,6 +421,7 @@ FireFox is pretty much stuck on 640x480 for now.  Chrome even when put into the
     <script type="text/javascript" src="js/jquery.cookie.js"></script>
     <script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
     <script type="text/javascript" src="js/verto-min.js"></script>
+    <script type="text/javascript" src="js/getScreenId.js"></script>
     <script type="text/javascript" src="verto.js"></script>
 
   </body>
index 8bc97845ea6d310d8fbab4f8eaddcb04e4fd2b98..192320d3a1b576c3e99e65ebef8e23b9ec72ecc8 100644 (file)
@@ -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<elements.length;i++){if(index===3){newLine[index++]=payload;}
 if(elements[i]!==payload)newLine[index++]=elements[i];}
 return newLine.join(' ');}
-$.FSRTC=function(options){this.options=$.extend({useVideo:null,useStereo:false,userData:null,localVideo:null,iceServers:false,videoParams:{},audioParams:{},callbacks:{onICEComplete:function(){},onICE:function(){},onOfferSDP:function(){}}},options);this.mediaData={SDP:null,profile:{},candidateList:[]};if(moz){this.constraints={offerToReceiveAudio:true,offerToReceiveVideo:this.options.useVideo?true:false,};}else{this.constraints={optional:[{'DtlsSrtpKeyAgreement':'true'}],mandatory:{OfferToReceiveAudio:true,OfferToReceiveVideo:this.options.useVideo?true:false,}};}
+$.FSRTC=function(options){this.options=$.extend({useVideo:null,useStereo:false,userData:null,localVideo:null,screenShare:false,iceServers:false,videoParams:{},audioParams:{},callbacks:{onICEComplete:function(){},onICE:function(){},onOfferSDP:function(){}}},options);this.mediaData={SDP:null,profile:{},candidateList:[]};if(moz){this.constraints={offerToReceiveAudio:true,offerToReceiveVideo:this.options.useVideo?true:false,};}else{this.constraints={optional:[{'DtlsSrtpKeyAgreement':'true'}],mandatory:{OfferToReceiveAudio:true,OfferToReceiveVideo:this.options.useVideo?true:false,}};}
 setCompat();checkCompat();};$.FSRTC.prototype.useVideo=function(obj,local){var self=this;if(obj){self.options.useVideo=obj;self.options.localVideo=local;if(moz){self.constraints.offerToReceiveVideo=true;}else{self.constraints.mandatory.OfferToReceiveVideo=true;}}else{self.options.useVideo=null;self.options.localVideo=null;if(moz){self.constraints.offerToReceiveVideo=false;}else{self.constraints.mandatory.OfferToReceiveVideo=false;}}};$.FSRTC.prototype.useStereo=function(on){var self=this;self.options.useStereo=on;};$.FSRTC.prototype.stereoHack=function(sdp){var self=this;if(!self.options.useStereo){return sdp;}
 var sdpLines=sdp.split('\r\n');var opusIndex=findLine(sdpLines,'a=rtpmap','opus/48000'),opusPayload;if(opusIndex){opusPayload=getCodecPayloadType(sdpLines[opusIndex]);}
 var fmtpLineIndex=findLine(sdpLines,'a=fmtp:'+opusPayload.toString());if(fmtpLineIndex===null)return sdp;sdpLines[fmtpLineIndex]=sdpLines[fmtpLineIndex].concat('; stereo=1');sdp=sdpLines.join('\r\n');return sdp;};function setCompat(){$.FSRTC.moz=!!navigator.mozGetUserMedia;if(!navigator.getUserMedia){navigator.getUserMedia=navigator.mozGetUserMedia||navigator.webkitGetUserMedia||navigator.msGetUserMedia;}}
@@ -30,11 +30,12 @@ if(self.options.localVideo){self.options.localVideo[moz?'mozSrcObject':'src']=""
 if(self.options.localVideoStream){self.options.localVideoStream.stop();}
 if(self.peer){console.log("stopping peer");self.peer.stop();}};$.FSRTC.prototype.createAnswer=function(sdp){var self=this;self.type="answer";self.remoteSDP=sdp;console.debug("inbound sdp: ",sdp);function onSuccess(stream){self.localStream=stream;self.peer=RTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:function(stream){return onRemoteStream(self,stream);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,offerSDP:{type:"offer",sdp:self.remoteSDP}});onStreamSuccess(self);}
 function onError(e){onStreamError(self,e);}
-var audio;if(this.options.videoParams&&this.options.videoParams.chromeMediaSource=='screen'){this.options.videoParams={chromeMediaSource:'screen',maxWidth:screen.width,maxHeight:screen.height};console.error("SCREEN SHARE");audio=false;}else{audio={mandatory:this.options.audioParams,optional:[]};}
+var audio;if(this.options.videoParams&&this.options.videoParams.chromeMediaSource=='desktop'){console.error("SCREEN SHARE");audio=false;}else{audio={mandatory:this.options.audioParams,optional:[]};}
 console.log("Mandatory audio constraints",this.options.audioParams);console.log("Mandatory video constraints",this.options.videoParams);if(this.options.useVideo&&this.options.localVideo){getUserMedia({constraints:{audio:false,video:{mandatory:this.options.videoParams,optional:[]},},localVideo:this.options.localVideo,onsuccess:function(e){self.options.localVideoStream=e;console.log("local video ready");},onerror:function(e){console.error("local video error!");}});}
-getUserMedia({constraints:{audio:audio,video:this.options.useVideo?{mandatory:this.options.videoParams,optional:[]}:null},video:this.options.useVideo,onsuccess:onSuccess,onerror:onError});};$.FSRTC.prototype.call=function(profile){checkCompat();var self=this;self.type="offer";function onSuccess(stream){self.localStream=stream;self.peer=RTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:function(stream){return onRemoteStream(self,stream);},onOfferSDP:function(sdp){return onOfferSDP(self,sdp);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,});onStreamSuccess(self,stream);}
+getUserMedia({constraints:{audio:audio,video:this.options.useVideo?{mandatory:this.options.videoParams,optional:[]}:null},video:this.options.useVideo,onsuccess:onSuccess,onerror:onError});};$.FSRTC.prototype.call=function(profile){checkCompat();var self=this;var screen=false;self.type="offer";if(this.options.videoParams&&this.options.videoParams.chromeMediaSource=='desktop'){screen=true;}
+console.error("FOO",screen);function onSuccess(stream){self.localStream=stream;self.peer=RTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:screen?function(stream){console.error("SKIP");}:function(stream){return onRemoteStream(self,stream);},onOfferSDP:function(sdp){return onOfferSDP(self,sdp);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,});onStreamSuccess(self,stream);}
 function onError(e){onStreamError(self,e);}
-var audio;if(this.options.videoParams&&this.options.videoParams.chromeMediaSource=='screen'){this.options.videoParams={chromeMediaSource:'screen',maxWidth:screen.width,maxHeight:screen.height};console.error("SCREEN SHARE");audio=false;}else{audio={mandatory:this.options.audioParams,optional:[]};}
+var audio;if(this.options.videoParams&&this.options.videoParams.chromeMediaSource=='desktop'){console.error("SCREEN SHARE");audio=false;}else{audio={mandatory:this.options.audioParams,optional:[]};}
 console.log("Mandatory audio constraints",this.options.audioParams);console.log("Mandatory video constraints",this.options.videoParams);if(this.options.useVideo&&this.options.localVideo){getUserMedia({constraints:{audio:false,video:{mandatory:this.options.videoParams,optional:[]},},localVideo:this.options.localVideo,onsuccess:function(e){self.options.localVideoStream=e;console.log("local video ready");},onerror:function(e){console.error("local video error!");}});}
 getUserMedia({constraints:{audio:audio,video:this.options.useVideo?{mandatory:this.options.videoParams,optional:[]}:null},video:this.options.useVideo,onsuccess:onSuccess,onerror:onError});};window.moz=!!navigator.mozGetUserMedia;function RTCPeerConnection(options){var w=window,PeerConnection=w.mozRTCPeerConnection||w.webkitRTCPeerConnection,SessionDescription=w.mozRTCSessionDescription||w.RTCSessionDescription,IceCandidate=w.mozRTCIceCandidate||w.RTCIceCandidate;var STUN={url:!moz?'stun:stun.l.google.com:19302':'stun:23.21.150.121'};var TURN={url:'turn:homeo@turn.bistri.com:80',credential:'homeo'};var iceServers=null;if(options.iceServers){var tmp=options.iceServers;if(typeof(tmp)==="boolean"){tmp=null;}
 if(tmp&&!(typeof(tmp)=="object"&&tmp.constructor===Array)){console.warn("iceServers must be an array, reverting to default ice servers");tmp=null;}
@@ -174,14 +175,14 @@ confMan.lastTimeout=setTimeout(function(){$(confMan.params.displayID).html(confM
 var row_callback=null;if(confMan.params.laData.role==="moderator"){row_callback=function(nRow,aData,iDisplayIndex,iDisplayIndexFull){if(!aData[5]){var $row=$('td:eq(5)',nRow);genControls($row,aData);if(confMan.params.onLaRow){confMan.params.onLaRow(verto,confMan,$row,aData);}}};}
 confMan.lt=new $.verto.liveTable(verto,confMan.params.laData.laChannel,confMan.params.laData.laName,$(confMan.params.tableID),{subParams:{callID:confMan.params.dialog?confMan.params.dialog.callID:null},"onChange":function(obj,args){$(confMan.params.statusID).text("Conference Members: "+" ("+obj.arrayLen()+" Total)");if(confMan.params.onLaChange){confMan.params.onLaChange(verto,confMan,$.verto.enum.confEvent.laChange,obj,args);}},"aaData":[],"aoColumns":[{"sTitle":"ID"},{"sTitle":"Number"},{"sTitle":"Name"},{"sTitle":"Codec"},{"sTitle":"Status","sWidth":confMan.params.hasVid?"300px":"150px"},{"sTitle":atitle,"sWidth":awidth,}],"bAutoWidth":true,"bDestroy":true,"bSort":false,"bInfo":false,"bFilter":false,"bLengthChange":false,"bPaginate":false,"iDisplayLength":1000,"oLanguage":{"sEmptyTable":"The Conference is Empty....."},"fnRowCallback":row_callback});};$.verto.confMan.prototype.modCommand=function(cmd,id,value){var confMan=this;confMan.verto.sendMethod("verto.broadcast",{"eventChannel":confMan.params.laData.modChannel,"data":{"application":"conf-control","command":cmd,"id":id,"value":value}});};$.verto.confMan.prototype.destroy=function(){var confMan=this;confMan.destroyed=true;if(confMan.lt){confMan.lt.destroy();}
 if(confMan.params.laData.modChannel){confMan.verto.unsubscribe(confMan.params.laData.modChannel);}
-if(confMan.params.mainModID){$(confMan.params.mainModID).html("");}};$.verto.dialog=function(direction,verto,params){var dialog=this;dialog.params=$.extend({useVideo:verto.options.useVideo,useStereo:verto.options.useStereo,tag:verto.options.tag,localTag:verto.options.localTag,login:verto.options.login},params);dialog.verto=verto;dialog.direction=direction;dialog.lastState=null;dialog.state=dialog.lastState=$.verto.enum.state.new;dialog.callbacks=verto.callbacks;dialog.answered=false;dialog.attach=params.attach||false;if(dialog.params.callID){dialog.callID=dialog.params.callID;}else{dialog.callID=dialog.params.callID=generateGUID();}
+if(confMan.params.mainModID){$(confMan.params.mainModID).html("");}};$.verto.dialog=function(direction,verto,params){var dialog=this;dialog.params=$.extend({useVideo:verto.options.useVideo,useStereo:verto.options.useStereo,screenShare:false,tag:verto.options.tag,localTag:verto.options.localTag,login:verto.options.login},params);dialog.verto=verto;dialog.direction=direction;dialog.lastState=null;dialog.state=dialog.lastState=$.verto.enum.state.new;dialog.callbacks=verto.callbacks;dialog.answered=false;dialog.attach=params.attach||false;dialog.screenShare=params.screenShare||false;if(dialog.params.callID){dialog.callID=dialog.params.callID;}else{dialog.callID=dialog.params.callID=generateGUID();}
 if(dialog.params.tag){dialog.audioStream=document.getElementById(dialog.params.tag);if(dialog.params.useVideo){dialog.videoStream=dialog.audioStream;}}
 if(dialog.params.localTag){dialog.localVideo=document.getElementById(dialog.params.localTag);}
 dialog.verto.dialogs[dialog.callID]=dialog;var RTCcallbacks={};if(dialog.direction==$.verto.enum.direction.inbound){if(dialog.params.display_direction==="outbound"){dialog.params.remote_caller_id_name=dialog.params.caller_id_name;dialog.params.remote_caller_id_number=dialog.params.caller_id_number;}else{dialog.params.remote_caller_id_name=dialog.params.callee_id_name;dialog.params.remote_caller_id_number=dialog.params.callee_id_number;}
 if(!dialog.params.remote_caller_id_name){dialog.params.remote_caller_id_name="Nobody";}
 if(!dialog.params.remote_caller_id_number){dialog.params.remote_caller_id_number="UNKNOWN";}
 RTCcallbacks.onMessage=function(rtc,msg){console.debug(msg);};RTCcallbacks.onAnswerSDP=function(rtc,sdp){console.error("answer sdp",sdp);};}else{dialog.params.remote_caller_id_name="Outbound Call";dialog.params.remote_caller_id_number=dialog.params.destination_number;}
-RTCcallbacks.onICESDP=function(rtc){if(rtc.type=="offer"){console.log("offer",rtc.mediaData.SDP);dialog.setState($.verto.enum.state.requesting);dialog.sendMethod("verto.invite",{sdp:rtc.mediaData.SDP});}else{dialog.setState($.verto.enum.state.answering);dialog.sendMethod(dialog.attach?"verto.attach":"verto.answer",{sdp:dialog.rtc.mediaData.SDP});}};RTCcallbacks.onICE=function(rtc){if(rtc.type=="offer"){console.log("offer",rtc.mediaData.candidate);return;}};RTCcallbacks.onStream=function(rtc,stream){console.log("stream started");};RTCcallbacks.onError=function(e){console.error("ERROR:",e);dialog.hangup();};dialog.rtc=new $.FSRTC({callbacks:RTCcallbacks,localVideo:dialog.localVideo,useVideo:dialog.videoStream,useAudio:dialog.audioStream,useStereo:dialog.params.useStereo,videoParams:verto.options.videoParams,audioParams:verto.options.audioParams,iceServers:verto.options.iceServers});dialog.rtc.verto=dialog.verto;if(dialog.direction==$.verto.enum.direction.inbound){if(dialog.attach){dialog.answer();}else{dialog.ring();}}};$.verto.dialog.prototype.invite=function(){var dialog=this;dialog.rtc.call();};$.verto.dialog.prototype.sendMethod=function(method,obj){var dialog=this;obj.dialogParams={};for(var i in dialog.params){if(i=="sdp"&&method!="verto.invite"&&method!="verto.attach"){continue;}
+RTCcallbacks.onICESDP=function(rtc){if(rtc.type=="offer"){console.log("offer",rtc.mediaData.SDP);dialog.setState($.verto.enum.state.requesting);dialog.sendMethod("verto.invite",{sdp:rtc.mediaData.SDP});}else{dialog.setState($.verto.enum.state.answering);dialog.sendMethod(dialog.attach?"verto.attach":"verto.answer",{sdp:dialog.rtc.mediaData.SDP});}};RTCcallbacks.onICE=function(rtc){if(rtc.type=="offer"){console.log("offer",rtc.mediaData.candidate);return;}};RTCcallbacks.onStream=function(rtc,stream){console.log("stream started");};RTCcallbacks.onError=function(e){console.error("ERROR:",e);dialog.hangup();};dialog.rtc=new $.FSRTC({callbacks:RTCcallbacks,localVideo:dialog.localVideo,useVideo:dialog.videoStream,useAudio:dialog.audioStream,useStereo:dialog.params.useStereo,videoParams:verto.options.videoParams,audioParams:verto.options.audioParams,iceServers:verto.options.iceServers,screenShare:dialog.screenShare});dialog.rtc.verto=dialog.verto;if(dialog.direction==$.verto.enum.direction.inbound){if(dialog.attach){dialog.answer();}else{dialog.ring();}}};$.verto.dialog.prototype.invite=function(){var dialog=this;dialog.rtc.call();};$.verto.dialog.prototype.sendMethod=function(method,obj){var dialog=this;obj.dialogParams={};for(var i in dialog.params){if(i=="sdp"&&method!="verto.invite"&&method!="verto.attach"){continue;}
 obj.dialogParams[i]=dialog.params[i];}
 dialog.verto.rpcClient.call(method,obj,function(e){dialog.processReply(method,true,e);},function(e){dialog.processReply(method,false,e);});};function checkStateChange(oldS,newS){if(newS==$.verto.enum.state.purge||$.verto.enum.states[oldS.name][newS.name]){return true;}
 return false;}
@@ -191,7 +192,8 @@ console.info("Dialog "+dialog.callID+": state change from "+dialog.state.name+"
 if(!dialog.cause){dialog.cause="NORMAL CLEARING";}
 if(dialog.callbacks.onDialogState){dialog.callbacks.onDialogState(this);}
 switch(dialog.state){case $.verto.enum.state.trying:setTimeout(function(){if(dialog.state==$.verto.enum.state.trying){dialog.setState($.verto.enum.state.hangup);}},30000);break;case $.verto.enum.state.purge:dialog.setState($.verto.enum.state.destroy);break;case $.verto.enum.state.hangup:if(dialog.lastState.val>$.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);}}}
index 028c955e946e65cb5db5ca66ff29538191047a14..696e7da987c3e6cd165f597749d6022b9ed05c87 100644 (file)
@@ -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, {
index 4520ca23c6668fce7046afcc2aaac6e00cc37c88..148e24fdc8e4f52ce621ad4bfd3eddf9e99695c8 100644 (file)
@@ -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
index 25d3822b614e5819da6cc4f5a7221e2b9ed06165..b12578407cd90c74ad3dc17b972daad846fc4057 100644 (file)
@@ -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);
 
index ae6d9adaf3c5b52d41ccc82aa6c2cf86c1844189..71ec4bcb1973b6b5bffce70cd00791d522bef181 100644 (file)
@@ -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);
index 4e2e1ed41682a2679f90a8ca7a7c3a0deccdb011..91d342178a9753cdb64e80e10c4b93f0cafa5dcb 100644 (file)
@@ -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)) {