001package com.plivo.api.models.application; 002 003import com.fasterxml.jackson.annotation.JsonInclude; 004import com.plivo.api.models.base.BaseResource; 005 006@JsonInclude(JsonInclude.Include.NON_NULL) 007public class Application extends BaseResource { 008 009 private String answerUrl; 010 private String answerMethod; 011 private String appId; 012 private String appName; 013 private Boolean defaultApp; 014 private Boolean defaultEndpointApp; 015 private Boolean enabled; 016 private String fallbackAnswerUrl; 017 private String fallbackMethod; 018 private String hangupUrl; 019 private String hangupMethod; 020 private String messageMethod; 021 private String messageUrl; 022 private Boolean publicUri; 023 private String resourceUri; 024 private String sipUri; 025 private String subAccount; 026 027 public static ApplicationCreator creator(String appName) { 028 return new ApplicationCreator(appName); 029 } 030 031 public static ApplicationUpdater updater(String id) { 032 return new ApplicationUpdater(id); 033 } 034 035 public static ApplicationGetter getter(String id) { 036 return new ApplicationGetter(id); 037 } 038 039 public static ApplicationDeleter deleter(String id) { 040 return new ApplicationDeleter(id); 041 } 042 043 public static ApplicationLister lister() { 044 return new ApplicationLister(); 045 } 046 047 // FIXME DOCS 048 public Boolean getDefaultEndpointApp() { 049 return defaultEndpointApp; 050 } 051 052 /** 053 * @return The url returning Plivo XML to be requested when a call is answered. 054 */ 055 public String getAnswerUrl() { 056 return answerUrl; 057 } 058 059 /** 060 * @return The HTTP method which will be used to request the answer_url when an incoming call is 061 * answered on the number or the endpoint attached to the application. 062 */ 063 public String getAnswerMethod() { 064 return answerMethod; 065 } 066 067 public String getAppId() { 068 return appId; 069 } 070 071 /** 072 * @return A friendly name for your Plivo application. 073 */ 074 public String getAppName() { 075 return appName; 076 } 077 078 // FIXME DOCS 079 080 /** 081 * @return Default app. 082 */ 083 public Boolean getDefaultApp() { 084 return defaultApp; 085 } 086 087 /** 088 * @return Set to true if the application is enabled. 089 */ 090 public Boolean getEnabled() { 091 return enabled; 092 } 093 094 /** 095 * @return Plivo will request this URL with the same parameters sent to the answer_url if the 096 * answer_url returns a non 200 HTTP status code. 097 */ 098 public String getFallbackAnswerUrl() { 099 return fallbackAnswerUrl; 100 } 101 102 /** 103 * @return The HTTP method which will be used to request the fallback_answer_url when the 104 * answer_url returns a non 200 HTTP status code. 105 */ 106 public String getFallbackMethod() { 107 return fallbackMethod; 108 } 109 110 /** 111 * @return When the incoming call is hung up on a number or an endpoint attached to the 112 * application, Plivo will send a request to the hangup_url with the attributes of the call. 113 */ 114 public String getHangupUrl() { 115 return hangupUrl; 116 } 117 118 /** 119 * @return The HTTP method which will be used to request the hangup_url when an incoming call is 120 * hung up on the number or the endpoint attached to the application. 121 */ 122 public String getHangupMethod() { 123 return hangupMethod; 124 } 125 126 /** 127 * @return The HTTP method which will be used to request the message_url when an incoming message 128 * (SMS) is received on the number attached to the application 129 */ 130 public String getMessageMethod() { 131 return messageMethod; 132 } 133 134 /** 135 * @return When an incoming message (SMS) is received to a number attached to the application, 136 * Plivo will make a request to the message_url with the parameters documented here. 137 */ 138 public String getMessageUrl() { 139 return messageUrl; 140 } 141 142 /** 143 * @return Set to true is the application can be called from an external SIP service. By default 144 * the application is not public, and external SIP services cannot call your application SIP URI. 145 */ 146 public Boolean getPublicUri() { 147 return publicUri; 148 } 149 150 public String getResourceUri() { 151 return resourceUri; 152 } 153 154 /** 155 * @return The SIP URI of the application. All Plivo applications can be called directly without 156 * attaching them to a number or an endpoint. When an incoming call is received on this URI, Plivo 157 * will follow the same flow as it does with a number or an endpoint. 158 */ 159 public String getSipUri() { 160 return sipUri; 161 } 162 163 /** 164 * @return The subaccount associated with the application. If the application belongs to the main 165 * account, this field will be null. 166 */ 167 public String getSubAccount() { 168 return subAccount; 169 } 170 171 public ApplicationUpdater updater() { 172 return Application.updater(appId); 173 } 174 175 public ApplicationDeleter deleter() { 176 return Application.deleter(appId); 177 } 178 179 @Override 180 public String getId() { 181 return getAppId(); 182 } 183}