ImsConferenceState.java revision f8458ff9d97f8961d67c41ee107129ecba873f36
1/* 2 * Copyright (c) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.ims; 18 19import java.util.HashMap; 20import java.util.Iterator; 21import java.util.Map.Entry; 22import java.util.Set; 23 24import android.os.Bundle; 25import android.os.Parcel; 26import android.os.Parcelable; 27 28/** 29 * Provides the conference information (defined in RFC 4575) for IMS conference call. 30 * 31 * @hide 32 */ 33public class ImsConferenceState implements Parcelable { 34 /** 35 * conference-info : user 36 */ 37 // user (String) : Tel or SIP URI 38 public static final String USER = "user"; 39 // user > display text (String) 40 public static final String DISPLAY_TEXT = "display-text"; 41 // user > endpoint (String) : URI or GRUU or Phone number 42 public static final String ENDPOINT = "endpoint"; 43 // user > endpoint > status 44 public static final String STATUS = "status"; 45 46 /** 47 * status-type (String) : 48 * "pending" : Endpoint is not yet in the session, but it is anticipated that he/she will 49 * join in the near future. 50 * "dialing-out" : Focus has dialed out to connect the endpoint to the conference, 51 * but the endpoint is not yet in the roster (probably being authenticated). 52 * "dialing-in" : Endpoint is dialing into the conference, not yet in the roster 53 * (probably being authenticated). 54 * "alerting" : PSTN alerting or SIP 180 Ringing was returned for the outbound call; 55 * endpoint is being alerted. 56 * "on-hold" : Active signaling dialog exists between an endpoint and a focus, 57 * but endpoint is "on-hold" for this conference, i.e., he/she is neither "hearing" 58 * the conference mix nor is his/her media being mixed in the conference. 59 * "connected" : Endpoint is a participant in the conference. Depending on the media policies, 60 * he/she can send and receive media to and from other participants. 61 * "disconnecting" : Focus is in the process of disconnecting the endpoint 62 * (e.g. in SIP a DISCONNECT or BYE was sent to the endpoint). 63 * "disconnected" : Endpoint is not a participant in the conference, and no active dialog 64 * exists between the endpoint and the focus. 65 * "muted-via-focus" : Active signaling dialog exists beween an endpoint and a focus and 66 * the endpoint can "listen" to the conference, but the endpoint's media is not being 67 * mixed into the conference. 68 * "connect-fail" : Endpoint fails to join the conference by rejecting the conference call. 69 */ 70 public static final String STATUS_PENDING = "pending"; 71 public static final String STATUS_DIALING_OUT = "dialing-out"; 72 public static final String STATUS_DIALING_IN = "dialing-in"; 73 public static final String STATUS_ALERTING = "alerting"; 74 public static final String STATUS_ON_HOLD = "on-hold"; 75 public static final String STATUS_CONNECTED = "connected"; 76 public static final String STATUS_DISCONNECTING = "disconnecting"; 77 public static final String STATUS_DISCONNECTED = "disconnected"; 78 public static final String STATUS_MUTED_VIA_FOCUS = "muted-via-focus"; 79 public static final String STATUS_CONNECT_FAIL = "connect-fail"; 80 81 /** 82 * conference-info : SIP status code (integer) 83 */ 84 public static final String SIP_STATUS_CODE = "sipstatuscode"; 85 86 public HashMap<String, Bundle> mParticipants = new HashMap<String, Bundle>(); 87 88 public ImsConferenceState() { 89 } 90 91 public ImsConferenceState(Parcel in) { 92 readFromParcel(in); 93 } 94 95 @Override 96 public int describeContents() { 97 return 0; 98 } 99 100 @Override 101 public void writeToParcel(Parcel out, int flags) { 102 out.writeInt(mParticipants.size()); 103 104 if (mParticipants.size() > 0) { 105 Set<Entry<String, Bundle>> entries = mParticipants.entrySet(); 106 107 if (entries != null) { 108 Iterator<Entry<String, Bundle>> iterator = entries.iterator(); 109 110 while (iterator.hasNext()) { 111 Entry<String, Bundle> entry = iterator.next(); 112 113 out.writeString(entry.getKey()); 114 out.writeParcelable(entry.getValue(), 0); 115 } 116 } 117 } 118 } 119 120 private void readFromParcel(Parcel in) { 121 int size = in.readInt(); 122 123 for (int i = 0; i < size; ++i) { 124 String user = in.readString(); 125 Bundle state = in.readParcelable(null); 126 mParticipants.put(user, state); 127 } 128 } 129 130 public static final Creator<ImsConferenceState> CREATOR = 131 new Creator<ImsConferenceState>() { 132 @Override 133 public ImsConferenceState createFromParcel(Parcel in) { 134 return new ImsConferenceState(in); 135 } 136 137 @Override 138 public ImsConferenceState[] newArray(int size) { 139 return new ImsConferenceState[size]; 140 } 141 }; 142} 143