]> sjero.net Git - linphone/blob - java/common/org/linphone/core/LinphoneCallLog.java
Add JNI glue to get timestamp for logs
[linphone] / java / common / org / linphone / core / LinphoneCallLog.java
1 /*
2 LinPhoneCallLog.java
3 Copyright (C) 2010  Belledonne Communications, Grenoble, France
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19 package org.linphone.core;
20 /**
21  * Call data records object 
22  *
23  */
24 import java.util.Vector;
25
26
27
28 public interface LinphoneCallLog {
29         /**
30          * Represents call status
31          *
32          */
33         static class CallStatus {
34                 
35                 static private Vector<CallStatus> values = new Vector<CallStatus>();
36                 private final int mValue;
37                 private final String mStringValue;
38                 /**
39                  * Call success.
40                  */
41                 public final static CallStatus Success = new CallStatus(0,"Sucess");
42                 /**
43                  * Call aborted.
44                  */
45                 public final static CallStatus Aborted = new CallStatus(1,"Aborted");
46                 /**
47                  * missed incoming call.
48                  */
49                 public final static CallStatus Missed = new CallStatus(2,"Missed");
50                 /**
51                  * remote call declined.
52                  */
53                 public final static CallStatus Declined = new CallStatus(3,"Declined");
54                 
55                 
56                 private CallStatus(int value,String stringValue) {
57                         mValue = value;
58                         values.addElement(this);
59                         mStringValue=stringValue;
60                 }
61                 public static CallStatus fromInt(int value) {
62
63                         for (int i=0; i<values.size();i++) {
64                                 CallStatus state = (CallStatus) values.elementAt(i);
65                                 if (state.mValue == value) return state;
66                         }
67                         throw new RuntimeException("CallStatus not found ["+value+"]");
68                 }
69                 public String toString() {
70                         return mStringValue;
71                 }
72                 public int toInt() {
73                         return mValue;
74                 }
75         }
76         
77         /**
78          * Originator of the call as a LinphoneAddress object.
79          * @return LinphoneAddress
80          */
81         public LinphoneAddress getFrom();
82         /**
83          * Destination of the call as a LinphoneAddress object.
84          * @return
85          */
86         public LinphoneAddress getTo ();
87         /**
88          * The direction of the call
89          * @return CallDirection
90          */
91         public CallDirection getDirection();
92         /**
93          * get status of this call
94          * @return
95          */
96         public CallStatus getStatus();
97         
98         /**
99          * @return a human readble String with the start date/time of the call
100          */
101         public String getStartDate();
102         
103         /**
104          * @return a timestamp of the start date/time of the call in milliseconds since January 1st 1970
105          */
106         public long getTimestamp();
107         
108         /**
109          * @return the call duration, in seconds
110          */
111         public int getCallDuration();
112         /**
113          * @return the call id from signaling
114          */
115         public int getCallId();
116 }