Android Open Source - SipgateInfo Call






From Project

Back to project page SipgateInfo.

License

The source code is released under:

GNU General Public License

If you think the Android project SipgateInfo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.skweez.sipgate.api;
//w  ww .j a  v a2  s  .  c  om
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.net.Uri;

/**
 * @author Michael Kanis
 */
public class Call {

  public static final DateFormat DATE_FORMAT = new SimpleDateFormat(
      "yyyy-MM-dd'T'kk:mm:ssZ");

  /**
   * @see http://groups.google.com/group/sipgate-api/tree/browse_frm/thread/
   *      ba8628f1ade4622c/e1b7d6a847c85949
   */
  private static final String[] statusPrefixes = new String[] { "1100",
      "1000", "1200", "2100", "2000", "2200", "2300", "2301", "2400",
      "3000", "3100", "1020", "4000" };

  private Date timestamp;

  private Uri remoteURI;

  private ECallStatus status;

  public Date getTimestamp() {
    return timestamp;
  }

  public void setTimestamp(Date timestamp) {
    this.timestamp = timestamp;
  }

  public void setTimestamp(String timestamp) {
    try {
      this.timestamp = DATE_FORMAT.parse(timestamp);
    } catch (ParseException e) {
      e.printStackTrace();
      // TODO proper error handling
    }
  }

  public Uri getRemoteURI() {
    return remoteURI;
  }

  public String getRemoteNumber() {
    String number = remoteURI.getUserInfo();

    for (String prefix : statusPrefixes) {
      if (number.startsWith(prefix)) {
        number = number.substring(4);
        break;
      }
    }

    return "+" + number;
  }

  public void setRemoteURI(Uri remoteURI) {
    this.remoteURI = remoteURI;
  }

  public ECallStatus getStatus() {
    return status;
  }

  public void setStatus(ECallStatus status) {
    this.status = status;
  }

  @Override
  public String toString() {
    return getRemoteNumber();
  }

}




Java Source Code List

net.skweez.sipgate.CallUtils.java
net.skweez.sipgate.PreferencesAuthenticator.java
net.skweez.sipgate.SipgateApplication.java
net.skweez.sipgate.activity.AccountInfoAdapter.java
net.skweez.sipgate.activity.CallListAdapter.java
net.skweez.sipgate.activity.MainActivity.java
net.skweez.sipgate.activity.SetupActivity.java
net.skweez.sipgate.api.AuthenticationException.java
net.skweez.sipgate.api.Call.java
net.skweez.sipgate.api.ECallStatus.java
net.skweez.sipgate.api.ISipgateAPI.java
net.skweez.sipgate.api.Price.java
net.skweez.sipgate.api.SipgateException.java
net.skweez.sipgate.api.UserName.java
net.skweez.sipgate.api.UserUri.java
net.skweez.sipgate.api.xmlrpc.SipgateUriHelper.java
net.skweez.sipgate.api.xmlrpc.SipgateXmlRpcImpl.java
net.skweez.sipgate.db.DataSource.java
net.skweez.sipgate.db.DatabaseHelper.java
net.skweez.sipgate.model.AccountInfo.java
net.skweez.sipgate.service.QueryResultReceiver.java
net.skweez.sipgate.service.QueryService.java