diff --git a/README.md b/README.md index fc35abc..efa51fd 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,43 @@ To know more about Restcomm, please refer to http://documentation.telestax.com/ Regarding issues, please refer to https://github.com/RestComm/restcomm-sdk-java/issues +### RCML Example of Use + +This example assumes you have a Java development environment with a Web server capable of running Java servlets, and the restcomm-sdk-java library. + +```java +import org.restcomm.connect.java.sdk.rcml.Response; +import org.restcomm.connect.java.sdk.rcml.Say; +import org.restcomm.connect.java.sdk.rcml.VoiceType; + +/** + * This servlet represent a demo of use the Restcomm Java RCML library. + * @author Ricardo Limonta + */ +@WebServlet(name = "AgentDemo", urlPatterns = {"/agent"}) +public class AgentDemo extends HttpServlet { + @Override + protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + //Define a response content type + response.setContentType("application/xml"); + + //Create a RCML verb and return our welcome message + Response rcml = new Response().say(new Say() + .text("Welcome to Restcomm Connect!") + .language("en") + .voice(VoiceType.WOMAN)).build(); + //Process response + response.getWriter().print(rcml.toXML()); + } +} +``` + + +The result of the servlet execution will be: + +```xml + + + Welcome to Restcomm Connect! + +``` diff --git a/restcomm-connect.java.sdk/.gitignore b/restcomm-connect.java.sdk/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/restcomm-connect.java.sdk/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/restcomm-connect.java.sdk/.project b/restcomm-connect.java.sdk/.project deleted file mode 100644 index ae29da4..0000000 --- a/restcomm-connect.java.sdk/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - restcomm-connect.java.sdk - - - - - - com.worldline.asciidoctools.builder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - - diff --git a/restcomm-connect.java.sdk/.settings/com.worldline.asciidoctools.builder.prefs b/restcomm-connect.java.sdk/.settings/com.worldline.asciidoctools.builder.prefs deleted file mode 100644 index ba63cc2..0000000 --- a/restcomm-connect.java.sdk/.settings/com.worldline.asciidoctools.builder.prefs +++ /dev/null @@ -1,6 +0,0 @@ -backend=html -eclipse.preferences.version=1 -resourcesPath=src/main/doc-resources -sourcesPath=src/main/asciidoc -stylesheetPath=css/stylesheet.css -targetPath=target/generated-docs diff --git a/restcomm-connect.java.sdk/.settings/org.eclipse.core.resources.prefs b/restcomm-connect.java.sdk/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0..0000000 --- a/restcomm-connect.java.sdk/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/restcomm-connect.java.sdk/.settings/org.eclipse.m2e.core.prefs b/restcomm-connect.java.sdk/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/restcomm-connect.java.sdk/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/restcomm-connect.java.sdk/pom.xml b/restcomm-connect.java.sdk/pom.xml index 3648a53..ca6966a 100644 --- a/restcomm-connect.java.sdk/pom.xml +++ b/restcomm-connect.java.sdk/pom.xml @@ -52,6 +52,11 @@ wiremock-body-transformer 1.1.5 + + javax.xml.bind + jaxb-api + 2.2 + diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Client.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Client.java new file mode 100644 index 0000000..e4f3549 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Client.java @@ -0,0 +1,93 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Client implements GenericBuilder{ + + @XmlAttribute + private String name; + + @XmlAttribute + private String url; + + @XmlAttribute + private String method; + + @XmlAttribute + private String statusCallbackEvent; + + @XmlAttribute + private String statusCallback; + + @XmlAttribute + private String statusCallbackMethod; + + @XmlValue + private String value; + + public Client name(String name) { + this.name = name; + return this; + } + public Client url(String url) { + this.url = url; + return this; + } + public Client method(MethodType method) { + this.method = method.name(); + return this; + } + public Client statusCallbackEvent(StatusCallbackType statusCallbackEvent) { + this.statusCallbackEvent = statusCallbackEvent.getName(); + return this; + } + public Client statusCallback(String statusCallback) { + this.statusCallback = statusCallback; + return this; + } + public Client statusCallbackMethod(MethodType method) { + this.statusCallbackMethod = method.name(); + return this; + } + public Client value(String value) { + this.value = value; + return this; + } + + @Override + public String toString() { + return "Client [name=" + name + ", url=" + url + ", method=" + method + ", statusCallbackEvent=" + + statusCallbackEvent + ", statusCallback=" + statusCallback + ", statusCallbackMethod=" + + statusCallbackMethod + ", value=" + value + "]"; + } + public Client build() { + return this; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Conference.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Conference.java new file mode 100644 index 0000000..b561dde --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Conference.java @@ -0,0 +1,103 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Conference implements GenericBuilder{ + + @XmlAttribute + private String name; + + @XmlAttribute + private Boolean muted; + + @XmlAttribute + private Boolean beep; + + @XmlAttribute + private Boolean startConferenceOnEnter; + + @XmlAttribute + private Boolean endConferenceOnExit; + + @XmlAttribute + private String waitUrl; + + @XmlAttribute + private String waitMethod; + + @XmlAttribute + private Integer maxParticipants; + + @XmlValue + private String value; + + public Conference maxParticipants(Integer maxParticipants) { + this.maxParticipants = maxParticipants; + return this; + } + public Conference waitMethod(MethodType waitMethod) { + this.waitMethod = waitMethod.name(); + return this; + } + public Conference value(String value) { + this.value = value; + return this; + } + public Conference name(String name) { + this.name = name; + return this; + } + public Conference muted(Boolean muted) { + this.muted = muted; + return this; + } + public Conference beep(Boolean beep) { + this.beep = beep; + return this; + } + public Conference startConferenceOnEnter(Boolean startConferenceOnEnter) { + this.startConferenceOnEnter = startConferenceOnEnter; + return this; + } + public Conference endConferenceOnExit(Boolean endConferenceOnExit) { + this.endConferenceOnExit = endConferenceOnExit; + return this; + } + + public Conference build() { + return this; + } + @Override + public String toString() { + return "Conference [name=" + name + ", muted=" + muted + ", beep=" + beep + ", startConferenceOnEnter=" + + startConferenceOnEnter + ", endConferenceOnExit=" + endConferenceOnExit + ", waitUrl=" + waitUrl + + ", waitMethod=" + waitMethod + ", maxParticipants=" + maxParticipants + ", value=" + value + "]"; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Dial.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Dial.java new file mode 100644 index 0000000..5dd97f2 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Dial.java @@ -0,0 +1,116 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Dial implements GenericBuilder{ + + @XmlAttribute + private String action; + + @XmlAttribute + private String method; + + @XmlAttribute + private Integer timeout; + + @XmlAttribute + private Integer timeLimit; + + @XmlAttribute + private String callerId; + + @XmlAttribute + private Boolean record; + + @XmlElement + private Conference conference; + + @XmlElement(name = "Sip") + private Sip sip; + + @XmlElement(name = "Client") + private List clients; + + @XmlElement(name = "Number") + private List numbers; + + public Dial() { + clients = new ArrayList(0); + numbers = new ArrayList(0); + } + + public Dial action(String action) { + this.action = action; + return this; + } + public Dial method(MethodType method) { + this.method = method.name(); + return this; + } + public Dial timeout(Integer timeout) { + this.timeout = timeout; + return this; + } + public Dial timeLimit(Integer timeLimit) { + this.timeLimit = timeLimit; + return this; + } + public Dial callerId(String callerId) { + this.callerId = callerId; + return this; + } + public Dial record(Boolean record) { + this.record = record; + return this; + } + public Dial number(Number number) { + this.numbers.add(number); + return this; + } + public Dial client(Client client) { + this.clients.add(client); + return this; + } + public Dial conference(Conference conference) { + this.conference = conference; + return this; + } + public Dial sip(Sip sip) { + this.sip = sip; + return this; + } + public Dial build() { + return this; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Email.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Email.java new file mode 100755 index 0000000..3e5b8fe --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Email.java @@ -0,0 +1,103 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Email implements GenericBuilder{ + + @XmlAttribute(required = true) + private String from; + + @XmlAttribute(required = true) + private String to; + + @XmlAttribute + private String cc; + + @XmlAttribute + private String bcc; + + @XmlAttribute + private String subject; + + @XmlValue + private String text; + + public Email() { + } + + public Email to(String to) { + this.to = to; + return this; + } + + public Email cc(String cc) { + if(this.cc == null) { + this.cc = cc; + } else { + this.cc = this.cc.concat(",").concat(cc); + } + return this; + } + + public Email bcc(String bcc) { + if(this.bcc == null) { + this.bcc = bcc; + } else { + this.bcc = this.bcc.concat(",").concat(bcc); + } + return this; + } + + public Email from(String from) { + this.from = from; + return this; + } + + public Email subject(String subject) { + this.subject = subject; + return this; + } + + public Email text(String text) { + this.text = text; + return this; + } + + public Email build() { + return this; + } + + @Override + public String toString() { + return "Email [to=" + to + ", cc=" + cc + ", Bcc=" + bcc + ", from=" + from + ", Subject=" + subject + ", text=" + + text + "]"; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Fax.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Fax.java new file mode 100644 index 0000000..c17d618 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Fax.java @@ -0,0 +1,90 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Fax implements GenericBuilder{ + + @XmlAttribute + private String to; + + @XmlAttribute + private String from; + + @XmlAttribute + private String action; + + @XmlAttribute + private String method; + + @XmlAttribute + private String statusCallback; + + @XmlValue + private String text; + + public Fax() { + } + + public Fax to(String to) { + this.to = to; + return this; + } + public Fax from(String from) { + this.from = from; + return this; + } + public Fax action(String action) { + this.action = action; + return this; + } + public Fax text(String text) { + this.text = text; + return this; + } + public Fax method(MethodType method) { + this.method = method.name(); + return this; + } + public Fax statusCallback(String statusCallback) { + this.statusCallback = statusCallback; + return this; + } + + public Fax build() { + return this; + } + + @Override + public String toString() { + return "Fax [to=" + to + ", from=" + from + ", action=" + action + ", method=" + method + ", statusCallback=" + + statusCallback + ", text=" + text + "]"; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Gather.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Gather.java new file mode 100755 index 0000000..32c1b1d --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Gather.java @@ -0,0 +1,148 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Gather implements GenericBuilder{ + + @XmlAttribute + private String action; + + @XmlAttribute + private String method; + + @XmlAttribute + private Integer timeout; + + @XmlAttribute + private String finishOnKey; + + @XmlAttribute + private Integer numDigits; + + @XmlAttribute + private String input; + + @XmlAttribute + private String partialResultCallback; + + @XmlAttribute + private String partialResultCallbackMethod; + + @XmlAttribute + private String language; + + @XmlAttribute + private String hints; + + @XmlElement(name = "Say") + private List says; + + @XmlElement(name = "Play") + private Play play; + + @XmlElement(name = "Pause") + private Pause pause; + + public Gather() { + this.says = new ArrayList(); + } + + public Gather action(String action) { + this.action = action; + return this; + } + public Gather method(MethodType methodType) { + this.method = methodType.name(); + return this; + } + public Gather timeout(Integer timeout) { + this.timeout = timeout; + return this; + } + public Gather finishOnKey(String finishOnKey) { + this.finishOnKey = finishOnKey; + return this; + } + public Gather numDigits(Integer numDigits) { + this.numDigits = numDigits; + return this; + } + public Gather input(InputType input) { + this.input = input.getName(); + return this; + } + public Gather partialResultCallback(String partialResultCallback) { + this.partialResultCallback = partialResultCallback; + return this; + } + public Gather partialResultCallbackMethod(MethodType methodType) { + this.partialResultCallbackMethod = methodType.name(); + return this; + } + public Gather language(LanguageType language) { + this.language = language.getName(); + return this; + } + public Gather hints(String hints) { + this.hints = hints; + return this; + } + public Gather say(Say say) { + this.says.add(say); + return this; + } + public Gather say(String sayText) { + this.says.add(new Say().text(sayText).build()); + return this; + } + public Gather play(Play play) { + this.play = play; + return this; + } + public Gather pause(Pause pause) { + this.pause = pause; + return this; + } + + public Gather build() { + return this; + } + + @Override + public String toString() { + return "Gather [action=" + action + ", method=" + method + ", timeout=" + timeout + ", finishOnKey=" + + finishOnKey + ", numDigits=" + numDigits + ", input=" + input + ", partialResultCallback=" + + partialResultCallback + ", partialResultCallbackMethod=" + partialResultCallbackMethod + ", language=" + + language + ", hints=" + hints + ", says=" + says + ", play=" + play + ", pause=" + pause + "]"; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/GenericBuilder.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/GenericBuilder.java new file mode 100644 index 0000000..dd82a05 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/GenericBuilder.java @@ -0,0 +1,30 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +public interface GenericBuilder { + + public E build(); + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/GeofenceEventType.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/GeofenceEventType.java new file mode 100644 index 0000000..e9a2bcc --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/GeofenceEventType.java @@ -0,0 +1,42 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +public enum GeofenceEventType { + + IN("in"), + OUT("out"), + IN_OUT("in-out"); + + private final String name; + + private GeofenceEventType(String name) { + this.name = name; + } + + public String getName() { + return name; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Geolocation.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Geolocation.java new file mode 100644 index 0000000..6dd767b --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Geolocation.java @@ -0,0 +1,90 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Geolocation implements GenericBuilder { + + @XmlAttribute + private String deviceIdentifier; + + @XmlAttribute + private String action; + + @XmlAttribute + private String method; + + @XmlAttribute + private String statusCallback; + + @XmlElement(name = "Notification") + private Notification notification; + + @XmlElement(name = "Immediate") + private Immediate immediate; + + public Geolocation() { + } + + public Geolocation deviceIdentifier(String deviceIdentifier) { + this.deviceIdentifier = deviceIdentifier; + return this; + } + public Geolocation action(String action) { + this.action = action; + return this; + } + public Geolocation method(MethodType method) { + this.method = method.name(); + return this; + } + public Geolocation statusCallback(String statusCallback) { + this.statusCallback = statusCallback; + return this; + } + public Geolocation notification(Notification notification) { + this.notification = notification; + return this; + } + public Geolocation immediate(Immediate immediate) { + this.immediate = immediate; + return this; + } + + public Geolocation build() { + return this; + } + + @Override + public String toString() { + return "Geolocation [deviceIdentifier=" + deviceIdentifier + ", action=" + action + ", method=" + method + + ", statusCallback=" + statusCallback + ", notification=" + notification + "]"; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Hangup.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Hangup.java new file mode 100755 index 0000000..264f9f4 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Hangup.java @@ -0,0 +1,32 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Hangup { + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Immediate.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Immediate.java new file mode 100644 index 0000000..d167a2a --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Immediate.java @@ -0,0 +1,70 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Immediate implements GenericBuilder { + + @XmlAttribute + private String deviceIdentifier; + + @XmlAttribute + private String statusCallback; + + @XmlAttribute + private String action; + + @XmlAttribute + private String method; + + + public Immediate deviceIdentifier(String deviceIdentifier) { + this.deviceIdentifier = deviceIdentifier; + return this; + } + public Immediate statusCallback(String statusCallback) { + this.statusCallback = statusCallback; + return this; + } + public Immediate action(String action) { + this.action = action; + return this; + } + public Immediate method(MethodType method) { + this.method = method.name(); + return this; + } + public Immediate build() { + return this; + } + @Override + public String toString() { + return "Immediate [deviceIdentifier=" + deviceIdentifier + ", statusCallback=" + statusCallback + ", action=" + + action + ", method=" + method + "]"; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/InputType.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/InputType.java new file mode 100644 index 0000000..6a6840b --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/InputType.java @@ -0,0 +1,39 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +public enum InputType { + + DTMF("dtmf"), SPEECH("speech"); + + private final String name; + + private InputType(String name) { + this.name = name; + } + + public String getName() { + return name; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/LanguageType.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/LanguageType.java new file mode 100644 index 0000000..23c360f --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/LanguageType.java @@ -0,0 +1,41 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +public enum LanguageType { + + EN_US("en-US"), EN_GB("en-GB"), ES_ES("es-ES"), + IT_IT("it-IT"), FR_FR("fr-FR"), PL_PL("pl-PL"), + PT_PT("pt-PT"), PT_BR("pt-BR"); + + private final String name; + + private LanguageType(String name) { + this.name = name; + } + public String getName() { + return name; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/LayoutType.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/LayoutType.java new file mode 100644 index 0000000..5a89a2b --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/LayoutType.java @@ -0,0 +1,40 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +public enum LayoutType { + + TILE("tile"), LINEAR("linear"); + + private final String name; + + private LayoutType(String name) { + this.name = name; + } + + public String getName() { + return name; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/MethodType.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/MethodType.java new file mode 100644 index 0000000..bd6125e --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/MethodType.java @@ -0,0 +1,28 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +public enum MethodType { + GET, POST +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/ModeType.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/ModeType.java new file mode 100644 index 0000000..9ea461d --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/ModeType.java @@ -0,0 +1,40 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +public enum ModeType { + + MCU("mcu"), SFU("sfu"); + + private final String name; + + private ModeType(String name) { + this.name = name; + } + + public String getName() { + return name; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Notification.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Notification.java new file mode 100644 index 0000000..c6ee276 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Notification.java @@ -0,0 +1,92 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Notification implements GenericBuilder { + + @XmlAttribute + private String deviceIdentifier; + + @XmlAttribute + private String eventGeofencingLatitude; + + @XmlAttribute + private String eventGeofencingLongitude; + + @XmlAttribute + private Integer geofenceRange; + + @XmlAttribute + private String geofenceEvent; + + @XmlAttribute + private String method; + + @XmlAttribute + private String action; + + public Notification deviceIdentifier(String deviceIdentifier) { + this.deviceIdentifier = deviceIdentifier; + return this; + } + public Notification eventGeofencingLatitude(String eventGeofencingLatitude) { + this.eventGeofencingLatitude = eventGeofencingLatitude; + return this; + } + public Notification eventGeofencingLongitude(String eventGeofencingLongitude) { + this.eventGeofencingLongitude = eventGeofencingLongitude; + return this; + } + public Notification geofenceRange(Integer geofenceRange) { + this.geofenceRange = geofenceRange; + return this; + } + public Notification geofenceEvent(GeofenceEventType geofenceEvent) { + this.geofenceEvent = geofenceEvent.getName(); + return this; + } + public Notification method(MethodType method) { + this.method = method.name(); + return this; + } + public Notification action(String action) { + this.action = action; + return this; + } + public Notification build() { + return this; + } + @Override + public String toString() { + return "Notification [deviceIdentifier=" + deviceIdentifier + ", eventGeofencingLatitude=" + + eventGeofencingLatitude + ", eventGeofencingLongitude=" + eventGeofencingLongitude + + ", geofenceRange=" + geofenceRange + ", geofenceEvent=" + geofenceEvent + ", method=" + method + + ", action=" + action + "]"; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Number.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Number.java new file mode 100644 index 0000000..9df3416 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Number.java @@ -0,0 +1,93 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Number { + + @XmlAttribute + private String sendDigits; + + @XmlAttribute + private String url; + + @XmlAttribute + private String method; + + @XmlAttribute + private String statusCallbackEvent; + + @XmlAttribute + private String statusCallback; + + @XmlAttribute + private String statusCallbackMethod; + + @XmlValue + private String value; + + public Number() { + } + + public Number sendDigits(String sendDigits) { + this.sendDigits = sendDigits; + return this; + } + public Number url(String url) { + this.url = url; + return this; + } + public Number method(MethodType method) { + this.method = method.name(); + return this; + } + public Number statusCallbackEvent(StatusCallbackType statusCallbackEvent) { + this.statusCallbackEvent = statusCallbackEvent.getName(); + return this; + } + public Number statusCallback(String statusCallback) { + this.statusCallback = statusCallback; + return this; + } + public Number statusCallbackMethod(MethodType method) { + this.statusCallbackMethod = method.name(); + return this; + } + public Number statusCallbackMethod(String value) { + this.value = value; + return this; + } + @Override + public String toString() { + return "Number [sendDigits=" + sendDigits + ", url=" + url + ", method=" + method + ", statusCallbackEvent=" + + statusCallbackEvent + ", statusCallback=" + statusCallback + ", statusCallbackMethod=" + + statusCallbackMethod + ", value=" + value + "]"; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Pause.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Pause.java new file mode 100755 index 0000000..1e03bb5 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Pause.java @@ -0,0 +1,53 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Pause implements GenericBuilder{ + + @XmlAttribute + private Integer length; + + public Pause() { + } + + public Pause length(Integer length) { + this.length = length; + return this; + } + + public Pause build() { + return this; + } + + @Override + public String toString() { + return "Pause [length=" + length + "]"; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Play.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Play.java new file mode 100755 index 0000000..a93f2f9 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Play.java @@ -0,0 +1,62 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Play implements GenericBuilder{ + + @XmlAttribute + private Integer loop; + + @XmlValue + private String url; + + public Play() { + } + + public Play url(String url) { + this.url = url; + return this; + } + + public Play loop(Integer loop) { + this.loop = loop; + return this; + } + + public Play build() { + return this; + } + + @Override + public String toString() { + return "Play [loop=" + loop + ", url=" + url + "]"; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/ReasonType.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/ReasonType.java new file mode 100644 index 0000000..40c40d2 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/ReasonType.java @@ -0,0 +1,16 @@ +package org.restcomm.connect.java.sdk.rcml; + +public enum ReasonType { + + REJECTED("rejected"), BUSY("busy"); + + private final String name; + + private ReasonType(String name) { + this.name = name; + } + + public String getName() { + return name; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Record.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Record.java new file mode 100755 index 0000000..7d11d00 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Record.java @@ -0,0 +1,108 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Record implements GenericBuilder{ + + @XmlAttribute + private String action; + + @XmlAttribute + private String method; + + @XmlAttribute + private Integer timeout; + + @XmlAttribute + private String finishOnKey; + + @XmlAttribute + private Integer maxLength; + + @XmlAttribute + private Boolean transcribe; + + @XmlAttribute + private String transcribeCallback; + + @XmlAttribute + private Boolean playBeep; + + @XmlAttribute + private String media; + + public Record() { + } + + public Record playBeep(Boolean playBeep) { + this.playBeep = playBeep; + return this; + } + public Record transcribe(Boolean transcribe) { + this.transcribe = transcribe; + return this; + } + public Record maxLength(Integer maxLength) { + this.maxLength = maxLength; + return this; + } + public Record media(String media) { + this.media = media; + return this; + } + public Record transcribeCallback(String transcribeCallback) { + this.transcribeCallback = transcribeCallback; + return this; + } + public Record finishOnKey(String finishOnKey) { + this.finishOnKey = finishOnKey; + return this; + } + public Record action(String action) { + this.action = action; + return this; + } + public Record method(MethodType method) { + this.method = method.name(); + return this; + } + public Record timeout(Integer timeout) { + this.timeout = timeout; + return this; + } + public Record build() { + return this; + } + @Override + public String toString() { + return "Record [action=" + action + ", method=" + method + ", timeout=" + timeout + ", finishOnKey=" + + finishOnKey + ", maxLength=" + maxLength + ", transcribe=" + transcribe + ", transcribeCallback=" + + transcribeCallback + ", playBeep=" + playBeep + ", media=" + media + "]"; + } +} \ No newline at end of file diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Redirect.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Redirect.java new file mode 100755 index 0000000..f43b4a1 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Redirect.java @@ -0,0 +1,62 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + * @author Ricardo Limonta limonta@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Redirect implements GenericBuilder { + + @XmlAttribute + private String method; + + @XmlValue + private String address; + + public Redirect() { + } + + public Redirect address(String address) { + this.address = address; + return this; + } + + public Redirect method(MethodType method) { + this.method = method.name(); + return this; + } + + public Redirect build() { + return this; + } + + @Override + public String toString() { + return "Redirect [method=" + method + ", address=" + address + "]"; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Reject.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Reject.java new file mode 100644 index 0000000..32be19e --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Reject.java @@ -0,0 +1,47 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Reject implements GenericBuilder { + + @XmlAttribute + private String reason; + + public Reject() { + } + + public Reject reason(ReasonType reason) { + this.reason = reason.getName(); + return this; + } + + public Reject build() { + return this; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/ResolutionType.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/ResolutionType.java new file mode 100644 index 0000000..05d4a4f --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/ResolutionType.java @@ -0,0 +1,40 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +public enum ResolutionType { + + CIF("CIF"), FORCIF("4CIF"), SIXTEENCIF("16CIF"), QCIF("QCIF"), VGA("VGA"), HD_720("720p"); + + private final String name; + + private ResolutionType(String name) { + this.name = name; + } + + public String getName() { + return name; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Response.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Response.java new file mode 100644 index 0000000..0932b1d --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Response.java @@ -0,0 +1,155 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElements; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlRootElement(name = "Response") +@XmlAccessorType(XmlAccessType.FIELD) +@SuppressWarnings("all") +public class Response { + + @XmlElements({ + @XmlElement(name = "Say", type = Say.class), + @XmlElement(name = "Record", type = Record.class), + @XmlElement(name = "Dial", type = Dial.class), + @XmlElement(name = "Email", type = Email.class), + @XmlElement(name = "Gather", type = Gather.class), + @XmlElement(name = "Hangup", type = Hangup.class), + @XmlElement(name = "Pause", type = Pause.class), + @XmlElement(name = "Play", type = Play.class), + @XmlElement(name = "Sms", type = Sms.class), + @XmlElement(name = "Redirect", type = Redirect.class), + @XmlElement(name = "Reject", type = Reject.class), + @XmlElement(name = "Fax", type = Fax.class), + @XmlElement(name = "UssdCollect", type = UssdCollect.class), + @XmlElement(name = "UssdMessage", type = UssdMessage.class), + @XmlElement(name = "Language", type = String.class), + @XmlElement(name = "Geolocation", type = Geolocation.class), + }) + private List commands; + + public List getCommands() { + return commands; + } + + public Response() { + commands = new ArrayList(0); + } + + public Response build(){ + return this; + } + + public String toXML(){ + return toXML(false); + } + public String toXML(Boolean pretty){ + try { + StringWriter sw = new StringWriter(); + JAXBContext jaxbContext = JAXBContext.newInstance(Response.class); + Marshaller marshaller = jaxbContext.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, pretty); + marshaller.marshal(this, sw); + return sw.toString(); + } catch (Exception e) { + return "ERROR TO GENERATE XML - "+e.getMessage(); + } + } + + + public Response say(Say builder) { + return addCommand(builder); + } + public Response dial(Dial builder) { + return addCommand(builder); + } + public Response record(Record builder) { + return addCommand(builder); + } + public Response pause(Pause builder) { + return addCommand(builder); + } + public Response reject(Reject builder) { + return addCommand(builder); + } + public Response email(Email builder) { + return addCommand(builder); + } + public Response gather(Gather builder) { + return addCommand(builder); + } + public Response play(Play builder) { + return addCommand(builder); + } + public Response sms(Sms builder) { + return addCommand(builder); + } + public Response redirect(Redirect builder) { + return addCommand(builder); + } + public Response geolocation(Geolocation builder) { + return addCommand(builder); + } + public Response fax(Fax fax) { + commands.add(fax); + return this; + } + public Response language(String language) { + commands.add(language); + return this; + } + public Response ussdCollect(UssdCollect language) { + commands.add(language); + return this; + } + public Response ussdMessage(UssdMessage language) { + commands.add(language); + return this; + } + public Response addCommand(GenericBuilder builder) { + commands.add(builder.build()); + return this; + } + public Response addCommands(List builders) { + for (GenericBuilder genericBuilder : builders) { + commands.add(genericBuilder.build()); + } + return this; + } + public Response hangup() { + commands.add(new Hangup()); + return this; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Say.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Say.java new file mode 100755 index 0000000..c181dcd --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Say.java @@ -0,0 +1,74 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Say implements GenericBuilder { + + @XmlAttribute + private String voice; + + @XmlAttribute + private String language; + + @XmlAttribute + private Integer loop; + + @XmlValue + private String text; + + public Say() { + } + + public Say voice(VoiceType voice) { + this.voice = voice.getName(); + return this; + } + public Say text(String text) { + this.text = text; + return this; + } + public Say loop(Integer loop) { + this.loop = loop; + return this; + } + public Say language(String language) { + this.language = language; + return this; + } + + public Say build(){ + return this; + } + + @Override + public String toString() { + return "Say [voice=" + voice + ", language=" + language + ", loop=" + loop + ", text=" + text + "]"; + } +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Sip.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Sip.java new file mode 100644 index 0000000..5eecac6 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Sip.java @@ -0,0 +1,94 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Sip implements GenericBuilder{ + + @XmlAttribute + private String name; + + @XmlAttribute + private String url; + + @XmlAttribute + private String method; + + @XmlAttribute + private String statusCallbackEvent; + + @XmlAttribute + private String statusCallback; + + @XmlAttribute + private String statusCallbackMethod; + + @XmlValue + private String value; + + public Sip name(String name) { + this.name = name; + return this; + } + public Sip url(String url) { + this.url = url; + return this; + } + public Sip method(MethodType method) { + this.method = method.name(); + return this; + } + public Sip statusCallbackEvent(StatusCallbackType statusCallbackEvent) { + this.statusCallbackEvent = statusCallbackEvent.getName(); + return this; + } + public Sip statusCallback(String statusCallback) { + this.statusCallback = statusCallback; + return this; + } + public Sip statusCallbackMethod(MethodType method) { + this.statusCallbackMethod = method.name(); + return this; + } + public Sip value(String value) { + this.value = value; + return this; + } + + public Sip build() { + return this; + } + @Override + public String toString() { + return "Sip [name=" + name + ", url=" + url + ", method=" + method + ", statusCallbackEvent=" + + statusCallbackEvent + ", statusCallback=" + statusCallback + ", statusCallbackMethod=" + + statusCallbackMethod + ", value=" + value + "]"; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Sms.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Sms.java new file mode 100755 index 0000000..bd95e76 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Sms.java @@ -0,0 +1,95 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Sms implements GenericBuilder { + + @XmlAttribute + private String to; + + @XmlAttribute + private String from; + + @XmlAttribute + private String action; + + @XmlAttribute + private String method; + + @XmlAttribute + private String statusCallback; + + @XmlValue + private String text; + + public Sms() { + } + + @Override + public String toString() { + return "Email [to=" + to + ", cc=" + action + ", Bcc=" + method + ", from=" + from + ", Subject=" + statusCallback + ", text=" + + text + "]"; + } + + public Sms to(String to) { + this.to = to; + return this; + } + + public Sms from(String from) { + this.from = from; + return this; + } + + public Sms action(String action) { + this.action = action; + return this; + } + + public Sms method(MethodType method) { + this.method = method.name(); + return this; + } + + public Sms statusCallback(String statusCallback) { + this.statusCallback = statusCallback; + return this; + } + + public Sms text(String text) { + this.text = text; + return this; + } + + public Sms build() { + return this; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/StatusCallbackType.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/StatusCallbackType.java new file mode 100644 index 0000000..6bae666 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/StatusCallbackType.java @@ -0,0 +1,40 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +public enum StatusCallbackType { + + INITIATED("initiated"), RINGING("ringing"), ANSWERED("answered"), COMPLETED("completed"); + + private String name; + + private StatusCallbackType(String name) { + this.name = name; + } + + public String getName() { + return name; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/UssdCollect.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/UssdCollect.java new file mode 100644 index 0000000..07c8067 --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/UssdCollect.java @@ -0,0 +1,60 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class UssdCollect implements GenericBuilder { + + @XmlAttribute + private String action; + + @XmlElement(name = "UssdMessage") + private List ussdMessage; + + public UssdCollect() { + ussdMessage = new ArrayList(0); + } + + public UssdCollect action(String action) { + this.action = action; + return this; + } + public UssdCollect ussdMessage(UssdMessage ussdMessage) { + this.ussdMessage.add(ussdMessage); + return this; + } + + public UssdCollect build() { + return this; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/UssdMessage.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/UssdMessage.java new file mode 100644 index 0000000..580b50b --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/UssdMessage.java @@ -0,0 +1,53 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlValue; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class UssdMessage implements GenericBuilder { + + @XmlValue + private String text; + + public UssdMessage() { + } + + public UssdMessage text(String text) { + this.text = text; + return this; + } + + public UssdMessage build() { + return this; + } + + @Override + public String toString() { + return "UssdMessage [text=" + text + "]"; + } + +} diff --git a/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Video.java b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Video.java new file mode 100644 index 0000000..cba4aeb --- /dev/null +++ b/restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/rcml/Video.java @@ -0,0 +1,78 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, Telestax Inc and individual contributors + * by the @authors tag. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.restcomm.connect.java.sdk.rcml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +/** + * @author Kleber Damasco kleber.damasco@hashtech.com.br + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class Video implements GenericBuilder