Changeset 27

Show
Ignore:
Timestamp:
01/21/08 08:30:28 (7 months ago)
Author:
sip
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mcuWeb/src/java/org/murillo/mcuWeb/Conference.java

    r23 r27  
    7676        return participants; 
    7777    } 
    78      
     78    public Participant getParticipant(Integer id) 
     79    { 
     80        return participants.get(id); 
     81    } 
    7982    public int getNumParcitipants() { 
    8083        return participants.size(); 
  • mcuWeb/src/java/org/murillo/mcuWeb/ConferenceMngr.java

    r24 r27  
    180180    } 
    181181     
    182         public String createSDP(Participant part) { 
     182   public String createSDP(Participant part) { 
    183183         
    184184        String sdp = "v=0\r\n"; 
     
    341341    } 
    342342 
     343 
    343344    void setCompositionType(String confId, Integer compType, Integer size, String profileId) { 
    344345        //Get conference 
     
    359360        conf.setProfile(profile); 
    360361    } 
     362 
     363    void setAudioMute(String confId, Integer partId, Boolean flag) { 
     364        //Get the conference 
     365        Conference conf = getConference(confId); 
     366        //And the video  Mute 
     367        MediaMixer mixer = conf.getMixer(); 
     368        //And the participant 
     369        Participant part = conf.getParticipant(partId); 
     370        try { 
     371            //Depending on the state 
     372            if (!flag) 
     373                //UnMute 
     374                mixer.StartReceivingAudio(conf.getId(), partId); 
     375            else 
     376                //Mute 
     377                mixer.StopReceivingAudio(conf.getId(), partId); 
     378            //Set participant mute 
     379            part.setAudioMuted(flag); 
     380        } catch (XmlRpcException ex) { 
     381            ex.printStackTrace(); 
     382        } 
     383    } 
     384 
     385    void setVideoMute(String confId, Integer partId, Boolean flag) { 
     386        //Get the conference 
     387        Conference conf = getConference(confId); 
     388        //And the video Mute 
     389        MediaMixer mixer = conf.getMixer(); 
     390        //And the participant 
     391        Participant part = conf.getParticipant(partId); 
     392        try { 
     393            //Depending on the state 
     394            if (!flag) 
     395                //UnMute 
     396                mixer.StartReceivingVideo(conf.getId(), partId); 
     397            else 
     398                //Mute 
     399                mixer.StopReceivingVideo(conf.getId(), partId); 
     400            //Set participant mute 
     401            part.setVideoMuted(flag); 
     402        } catch (XmlRpcException ex) { 
     403            ex.printStackTrace(); 
     404        } 
     405    } 
    361406    
    362407} 
  • mcuWeb/src/java/org/murillo/mcuWeb/MCUHttpServlet.java

    r24 r27  
    135135            //Call 
    136136            Participant part = joinParticipant(uid,dest); 
     137            //Redirect 
     138            response.sendRedirect("/mcuWeb/conference.jsp?uid=" + uid); 
     139        } else if(method.equals("removeParticipant")){ 
     140            //Get parameters 
     141            String  uid  = request.getParameter("uid"); 
     142            Integer partId  = Integer.parseInt(request.getParameter("partId")); 
     143            //Remove participant 
     144            removeParticipant(uid, partId); 
     145            //Redirect 
     146            response.sendRedirect("/mcuWeb/conference.jsp?uid=" + uid);  
     147         } else if(method.equals("setVideoMute")){ 
     148            //Get parameters 
     149            String  uid = request.getParameter("uid"); 
     150            Integer partId = Integer.parseInt(request.getParameter("partId")); 
     151            Boolean flag = Boolean.parseBoolean(request.getParameter("flag")); 
     152            //Call 
     153            setVideoMute(uid, partId, flag); 
     154            //Redirect 
     155            response.sendRedirect("/mcuWeb/conference.jsp?uid=" + uid);  
     156        }else if(method.equals("setAudioMute")){ 
     157            //Get parameters 
     158            String  uid = request.getParameter("uid"); 
     159            Integer partId = Integer.parseInt(request.getParameter("partId")); 
     160            Boolean flag = Boolean.parseBoolean(request.getParameter("flag")); 
     161            //Call 
     162            setAudioMute(uid, partId, flag); 
    137163            //Redirect 
    138164            response.sendRedirect("/mcuWeb/conference.jsp?uid=" + uid); 
     
    264290        return part; 
    265291    } 
     292     
     293    private void removeParticipant(String confId, Integer partId) 
     294    {     
     295        //Get the conference and participants 
     296        Conference conf = confMngr.getConference(confId); 
     297        Participant part = conf.getParticipant(partId); 
     298        //Get user session 
     299        SipSession session = part.getSession(); 
     300        try{ 
     301            //Create BYE request 
     302            SipServletRequest req = session.createRequest("BYE"); 
     303            //Send it 
     304            req.send(); 
     305        } catch(IOException ex){ 
     306            ex.printStackTrace(); 
     307        } catch(IllegalStateException ex){ 
     308            ex.printStackTrace(); 
     309        } 
     310        //Remover from conference 
     311        confMngr.removeParticipant(part); 
     312    } 
    266313 
    267314    private void removeConference(String uid) { 
     
    281328        confMngr.removeConference(uid); 
    282329    } 
    283      
     330  
    284331    private void setCompositionType(String confId, Integer compType, Integer size, String profileId) { 
    285332       //Set composition type 
     
    296343        confMngr.removeProfile(uid); 
    297344    } 
     345 
     346     private void setAudioMute(String uid, Integer partId, Boolean flag) { 
     347        //Set audio Mute 
     348        confMngr.setAudioMute(uid, partId, flag); 
     349    } 
     350      
     351    private void setVideoMute(String uid, Integer partId, Boolean flag) { 
     352        //Set video Mute 
     353        confMngr.setVideoMute(uid, partId, flag); 
     354    } 
     355     
    298356} 
  • mcuWeb/src/java/org/murillo/mcuWeb/MCUSipServlet.java

    r23 r27  
    9090            if (confMngr.joinParticipant(part)) { 
    9191                try { 
    92                     //Create ringing 
     92                    //Create final response 
    9393                    SipServletResponse resp = request.createResponse(200, "Ok"); 
    9494                    //Attach body 
     
    114114        //Remove participant 
    115115        confMngr.removeParticipant(part); 
    116         //Continue processing 
    117         super.doBye(request); 
     116        try { 
     117            //Create final response 
     118            SipServletResponse resp = request.createResponse(200, "Ok"); 
     119            //Send it 
     120            resp.send(); 
     121        } catch (IOException ex) { 
     122            Logger.getLogger("global").log(Level.SEVERE, null, ex); 
     123            return; 
     124        } 
    118125    } 
    119126 
  • mcuWeb/src/java/org/murillo/mcuWeb/MediaMixer.java

    r24 r27  
    6363        //Add values 
    6464        sizes.put(QCIF,"QCIF"); 
    65         sizes.put(CIF,"QCIF"); 
     65        sizes.put(CIF,"CIF"); 
    6666        //Return map 
    6767        return sizes; 
     
    9999        mosaics.put(MOSAIC2x2,"MOSAIC2x2"); 
    100100        mosaics.put(MOSAIC3x3,"MOSAIC3x3"); 
     101        mosaics.put(MOSAIC3p4,"MOSAIC3+4"); 
     102        mosaics.put(MOSAIC1p5,"MOSAIC1+5"); 
     103        mosaics.put(MOSAIC1p5,"MOSAIC1+7"); 
    101104        //Return map 
    102105        return mosaics; 
  • mcuWeb/web/conference.jsp

    r23 r27  
    1212    
    1313%> 
    14  
     14<script> 
     15    var uid = "<%=uid%>"; 
     16    function removeParticipant(partId) 
     17    { 
     18        var param = {uid:uid, partId:partId}; 
     19        return callController("removeParticipant", param); 
     20    } 
     21    function setVideoMute(partId, flag) 
     22    { 
     23        var param = {uid:uid, partId:partId, flag:flag }; 
     24        return callController("setVideoMute",param); 
     25    } 
     26    function setAudioMute(partId, flag) 
     27    { 
     28        var param = {uid:uid, partId:partId, flag:flag }; 
     29        return callController("setAudioMute",param); 
     30    } 
     31</script> 
    1532<fieldset style="width:48%;float:right"> 
    1633    <legend><img src="icons/application_view_tile.png"> Mosaic</legend> 
     
    7491                <td>Composition:</td> 
    7592                <td><select name="compType" value="<%=conf.getCompType()%>"> 
    76                     <option value="0" <%=conf.getCompType()==0?"selected":""%>>Mosaic 1x1 
    77                     <option value="1" <%=conf.getCompType()==1?"selected":""%>>Mosaic 2x2 
    78                     <option value="2" <%=conf.getCompType()==2?"selected":""%>>Mosaic 3x3 
     93                    <% 
     94                        //Get mosaics 
     95                        java.util.HashMap<Integer,String> mosaics = org.murillo.mcuWeb.MediaMixer.getMosaics(); 
     96                        //Get iterator 
     97                        Iterator<java.lang.Integer> itMosaics = mosaics.keySet().iterator(); 
     98                        //Loop  
     99                        while(itMosaics.hasNext()) { 
     100                            //Get key and value 
     101                            Integer k = itMosaics.next(); 
     102                            String v = mosaics.get(k); 
     103                            %><option value="<%=k%>" <%=conf.getCompType()==k?"selected":""%> ><%=v%><% 
     104                        } 
     105                    %> 
    79106                    </select> 
    80107                </td> 
     
    83110                <td>Size</td> 
    84111                <td><select name="size" value="<%=conf.getSize()%>"> 
    85                     <option value="0" <%=conf.getSize()==0?"selected":""%>>QCIF 
    86                     <option value="1" <%=conf.getSize()==1?"selected":""%>>CIF 
     112                <% 
     113                        //Get sizes 
     114                        java.util.HashMap<Integer,String> sizes = org.murillo.mcuWeb.MediaMixer.getSizes(); 
     115                        //Get iterator 
     116                        Iterator<java.lang.Integer> itSizes = sizes.keySet().iterator(); 
     117                        //Loop  
     118                        while(itSizes.hasNext()) { 
     119                            //Get key and value 
     120                            Integer k = itSizes.next(); 
     121                            String v = sizes.get(k); 
     122                            %><option value="<%=k%>" <%=conf.getSize()==k?"selected":""%> ><%=v%><% 
     123                        } 
     124                    %> 
    87125                    </select> 
    88126                </td> 
     
    99137                            org.murillo.mcuWeb.Profile profile = itProf.next(); 
    100138                            //If it's the selected profile 
    101                             if (profile.getUID().equals(conf.getProfile().getUID())) { 
    102                                 %><option value="<%=profile.getUID()%>" selected><%=profile.getName()%><% 
    103                             } else { 
    104                                 %><option value="<%=profile.getUID()%>"><%=profile.getName()%><% 
    105                             } 
     139                            %><option value="<%=profile.getUID()%>" <%=profile.getUID().equals(conf.getProfile().getUID())?"selected":""%>><%=profile.getName()%><% 
    106140                        } 
    107141                    %> 
Copyright 2006 - Sergio García Murillo
Powered by Trac - Edgewall Software