Changeset 27
- Timestamp:
- 01/21/08 08:30:28
(7 months ago)
- Author:
- sip
- Message:
--
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r23 |
r27 |
|
| 76 | 76 | return participants; |
|---|
| 77 | 77 | } |
|---|
| 78 | | |
|---|
| | 78 | public Participant getParticipant(Integer id) |
|---|
| | 79 | { |
|---|
| | 80 | return participants.get(id); |
|---|
| | 81 | } |
|---|
| 79 | 82 | public int getNumParcitipants() { |
|---|
| 80 | 83 | return participants.size(); |
|---|
| r24 |
r27 |
|
| 180 | 180 | } |
|---|
| 181 | 181 | |
|---|
| 182 | | public String createSDP(Participant part) { |
|---|
| | 182 | public String createSDP(Participant part) { |
|---|
| 183 | 183 | |
|---|
| 184 | 184 | String sdp = "v=0\r\n"; |
|---|
| … | … | |
| 341 | 341 | } |
|---|
| 342 | 342 | |
|---|
| | 343 | |
|---|
| 343 | 344 | void setCompositionType(String confId, Integer compType, Integer size, String profileId) { |
|---|
| 344 | 345 | //Get conference |
|---|
| … | … | |
| 359 | 360 | conf.setProfile(profile); |
|---|
| 360 | 361 | } |
|---|
| | 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 | } |
|---|
| 361 | 406 | |
|---|
| 362 | 407 | } |
|---|
| r24 |
r27 |
|
| 135 | 135 | //Call |
|---|
| 136 | 136 | 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); |
|---|
| 137 | 163 | //Redirect |
|---|
| 138 | 164 | response.sendRedirect("/mcuWeb/conference.jsp?uid=" + uid); |
|---|
| … | … | |
| 264 | 290 | return part; |
|---|
| 265 | 291 | } |
|---|
| | 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 | } |
|---|
| 266 | 313 | |
|---|
| 267 | 314 | private void removeConference(String uid) { |
|---|
| … | … | |
| 281 | 328 | confMngr.removeConference(uid); |
|---|
| 282 | 329 | } |
|---|
| 283 | | |
|---|
| | 330 | |
|---|
| 284 | 331 | private void setCompositionType(String confId, Integer compType, Integer size, String profileId) { |
|---|
| 285 | 332 | //Set composition type |
|---|
| … | … | |
| 296 | 343 | confMngr.removeProfile(uid); |
|---|
| 297 | 344 | } |
|---|
| | 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 | |
|---|
| 298 | 356 | } |
|---|
| r23 |
r27 |
|
| 90 | 90 | if (confMngr.joinParticipant(part)) { |
|---|
| 91 | 91 | try { |
|---|
| 92 | | //Create ringing |
|---|
| | 92 | //Create final response |
|---|
| 93 | 93 | SipServletResponse resp = request.createResponse(200, "Ok"); |
|---|
| 94 | 94 | //Attach body |
|---|
| … | … | |
| 114 | 114 | //Remove participant |
|---|
| 115 | 115 | 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 | } |
|---|
| 118 | 125 | } |
|---|
| 119 | 126 | |
|---|
| r24 |
r27 |
|
| 63 | 63 | //Add values |
|---|
| 64 | 64 | sizes.put(QCIF,"QCIF"); |
|---|
| 65 | | sizes.put(CIF,"QCIF"); |
|---|
| | 65 | sizes.put(CIF,"CIF"); |
|---|
| 66 | 66 | //Return map |
|---|
| 67 | 67 | return sizes; |
|---|
| … | … | |
| 99 | 99 | mosaics.put(MOSAIC2x2,"MOSAIC2x2"); |
|---|
| 100 | 100 | mosaics.put(MOSAIC3x3,"MOSAIC3x3"); |
|---|
| | 101 | mosaics.put(MOSAIC3p4,"MOSAIC3+4"); |
|---|
| | 102 | mosaics.put(MOSAIC1p5,"MOSAIC1+5"); |
|---|
| | 103 | mosaics.put(MOSAIC1p5,"MOSAIC1+7"); |
|---|
| 101 | 104 | //Return map |
|---|
| 102 | 105 | return mosaics; |
|---|
| r23 |
r27 |
|
| 12 | 12 | |
|---|
| 13 | 13 | %> |
|---|
| 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> |
|---|
| 15 | 32 | <fieldset style="width:48%;float:right"> |
|---|
| 16 | 33 | <legend><img src="icons/application_view_tile.png"> Mosaic</legend> |
|---|
| … | … | |
| 74 | 91 | <td>Composition:</td> |
|---|
| 75 | 92 | <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 | %> |
|---|
| 79 | 106 | </select> |
|---|
| 80 | 107 | </td> |
|---|
| … | … | |
| 83 | 110 | <td>Size</td> |
|---|
| 84 | 111 | <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 | %> |
|---|
| 87 | 125 | </select> |
|---|
| 88 | 126 | </td> |
|---|
| … | … | |
| 99 | 137 | org.murillo.mcuWeb.Profile profile = itProf.next(); |
|---|
| 100 | 138 | //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()%><% |
|---|
| 106 | 140 | } |
|---|
| 107 | 141 | %> |
|---|
Download in other formats:
|
|