]> sjero.net Git - linphone/commitdiff
add call status to java call logs
authorJehan Monnier <jehan.monnier@linphone.org>
Mon, 22 Nov 2010 11:34:29 +0000 (12:34 +0100)
committerJehan Monnier <jehan.monnier@linphone.org>
Mon, 22 Nov 2010 11:34:29 +0000 (12:34 +0100)
java/common/org/linphone/core/LinphoneCallLog.java

index 08cdb8034b748dced650c32b4eef262e5dc3aa48..0e459f81ccfdd593b781d070668fa77605fb3f49 100644 (file)
@@ -18,12 +18,64 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 package org.linphone.core;
 
+import java.util.Vector;
+
+
+
 public interface LinphoneCallLog {
+       /**
+        * Represents call status
+        *
+        */
+       static class CallStatus {
+               static private Vector values = new Vector();
+               private final int mValue;
+               private final String mStringValue;
+               /**
+                * Call success.
+                */
+               public final static CallStatus Sucess = new CallStatus(0,"Sucess");
+               /**
+                * Call aborted.
+                */
+               public final static CallStatus Aborted = new CallStatus(1,"Aborted");
+               /**
+                * missed incoming call.
+                */
+               public final static CallStatus Missed = new CallStatus(2,"Missed");
+               /**
+                * remote call declined.
+                */
+               public final static CallStatus Declined = new CallStatus(3,"Declined");
+               private CallStatus(int value,String stringValue) {
+                       mValue = value;
+                       values.addElement(this);
+                       mStringValue=stringValue;
+               }
+               public static CallStatus fromInt(int value) {
 
+                       for (int i=0; i<values.size();i++) {
+                               CallStatus state = (CallStatus) values.elementAt(i);
+                               if (state.mValue == value) return state;
+                       }
+                       throw new RuntimeException("CallStatus not found ["+value+"]");
+               }
+               public String toString() {
+                       return mStringValue;
+               }
+               public int toInt() {
+                       return mValue;
+               }
+       }
        
        public LinphoneAddress getFrom();
        
        public LinphoneAddress getTo ();
        
        public CallDirection getDirection();
+       /**
+        * get status of this call
+        * @return
+        */
+       public CallStatus getStatus();
 }