001package com.plivo.api.models.endpoint;
002
003import com.plivo.api.models.base.BaseResource;
004import com.plivo.api.util.Utils;
005
006public class Endpoint extends BaseResource {
007
008  private String alias;
009  private String application;
010  private String endpointId;
011  private String resourceUri;
012  private String sipExpires;
013  private String sipRegistered;
014  private String sipUri;
015  private String sipContact;
016  private String sipUserAgent;
017  private String subAccount;
018  private String username;
019  private String password;
020
021  public static EndpointCreator creator(String username, String password, String alias) {
022    if (!Utils.allNotNull(username, password, alias)) {
023      throw new IllegalArgumentException("username, password and alias cannot be null");
024    }
025
026    return new EndpointCreator(username, password, alias);
027  }
028
029  public static EndpointLister lister() {
030    return new EndpointLister();
031  }
032
033  public static EndpointGetter getter(String id) {
034    return new EndpointGetter(id);
035  }
036
037  public static EndpointUpdater updater(String id) {
038    return new EndpointUpdater(id);
039  }
040
041  public static EndpointDeleter deleter(String id) {
042    return new EndpointDeleter(id);
043  }
044
045  /**
046   * @return The contact field contains the address at which the callee can reach the caller for
047   * future requests. It is the IP on which the SIP client is registered.
048   */
049  public String getSipContact() {
050    return sipContact;
051  }
052
053  /**
054   * @return Friendly name for your endpoint.
055   */
056  public String getAlias() {
057    return alias;
058  }
059
060  public String getApplication() {
061    return application;
062  }
063
064  /**
065   * @return A unique ID for your endpoint. All API operations will be performed with this ID.
066   */
067  public String getEndpointId() {
068    return endpointId;
069  }
070
071  public String getResourceUri() {
072    return resourceUri;
073  }
074
075  /**
076   * @return Time when the SIP registration will expire. Major SIP clients, Plivo WebSDK and Plivo
077   * mobile SDKs will re-register the endpoint before the registration expires.
078   */
079  public String getSipExpires() {
080    return sipExpires;
081  }
082
083  /**
084   * @return true if the SIP endpoint is registered on a SIP client.
085   */
086  public String getSipRegistered() {
087    return sipRegistered;
088  }
089
090  /**
091   * @return The SIP URI of the endpoint. External users will be able to call this endpoint on this
092   * SIP URI.
093   */
094  public String getSipUri() {
095    return sipUri;
096  }
097
098  /**
099   * @return The User Agent of SIP client used to register this endpoint. In the case of WebSDK this
100   * field will be plivo-websdk.
101   */
102  public String getSipUserAgent() {
103    return sipUserAgent;
104  }
105
106  /**
107   * @return The sub account in your Plivo account, if this endpoint belongs to a Plivo sub account.
108   */
109  public String getSubAccount() {
110    return subAccount;
111  }
112
113  /**
114   * @return Username of your endpoint. Plivo appends a 12 digit code in front your username.
115   */
116  public String getUsername() {
117    return username;
118  }
119
120  public String getPassword() {
121    return password;
122  }
123
124  public EndpointUpdater updater() {
125    return Endpoint.updater(endpointId);
126  }
127
128  public EndpointDeleter deleter() {
129    return Endpoint.deleter(endpointId);
130  }
131
132  @Override
133  public String getId() {
134    return getEndpointId();
135  }
136}