Skip to content

Implementation of RCML Java Builder SDK. #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
15d9676
Implementation of RCML Java Builder SDK.
Nov 10, 2017
1764a20
Ajustes no package
kleberdamasco Nov 10, 2017
cef09ff
Junit tests
kleberdamasco Nov 10, 2017
1a99084
Created a method to generate xml
kleberdamasco Nov 10, 2017
394789d
Xml builder
kleberdamasco Nov 10, 2017
64972aa
Copyright and Author
kleberdamasco Nov 13, 2017
4cc88d9
Adjust verb names.
Nov 13, 2017
f0e9834
Adjust verb names and attributes.
Nov 13, 2017
9e592a0
Adjust verb names and attributes.
Nov 14, 2017
fc883d9
Class adjusts
kleberdamasco Nov 14, 2017
1407911
Enums and verbs
kleberdamasco Nov 16, 2017
f9b5fdc
Class adjust
kleberdamasco Nov 16, 2017
2398c32
Class adjust
kleberdamasco Nov 16, 2017
ba69d9f
Adjust verb names and attributes.
Nov 16, 2017
0642cd3
Adjust verb names and attributes.
Nov 16, 2017
4a36265
Class adjusts
kleberdamasco Nov 16, 2017
6930562
New verbs
kleberdamasco Nov 16, 2017
bd1e055
Merge origin/master
Nov 16, 2017
5639ef8
Remove target folder.
Nov 16, 2017
0a5f3a5
Class adjusts and new Verbs/Nouns
kleberdamasco Nov 17, 2017
d42ec68
Class adjusts
kleberdamasco Nov 17, 2017
730010d
Implementation of unit tests.
Nov 17, 2017
8657cd9
Class adjusts
kleberdamasco Nov 17, 2017
899764a
Merge remote-tracking branch 'origin/master'
kleberdamasco Nov 17, 2017
ca94455
Class adjusts
kleberdamasco Nov 17, 2017
5015f62
Class adjusts
kleberdamasco Nov 17, 2017
9ea0312
Class adjusts
kleberdamasco Nov 17, 2017
79b864e
Class adjusts
kleberdamasco Nov 17, 2017
f64eb8e
Implementation of unit tests.
Nov 17, 2017
175abd5
Tests junit
kleberdamasco Nov 17, 2017
a1f0742
Merge remote-tracking branch 'origin/master'
kleberdamasco Nov 17, 2017
19d7eec
Tests Junit
kleberdamasco Nov 20, 2017
8bc1911
Class adjusts
kleberdamasco Nov 20, 2017
34c5113
Remote System.out.println...
Nov 20, 2017
ebf908b
Remove IDE config files.
Dec 13, 2017
4832944
Update README.md
rlimonta Dec 22, 2017
9e37952
Changed the visibility of one method and created another.
kleberdamasco Jan 4, 2018
026d4b7
Merge remote-tracking branch 'origin/master'
kleberdamasco Jan 4, 2018
08cdbae
Update README.md
rlimonta Jan 31, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman" language="en">Welcome to Restcomm Connect!</Say>
</Response>
```
1 change: 1 addition & 0 deletions restcomm-connect.java.sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target/
22 changes: 0 additions & 22 deletions restcomm-connect.java.sdk/.project

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 5 additions & 0 deletions restcomm-connect.java.sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
<artifactId>wiremock-body-transformer</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 [email protected]
*/
@XmlAccessorType(XmlAccessType.FIELD)
public class Client implements GenericBuilder<Client>{

@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;
}
}
Original file line number Diff line number Diff line change
@@ -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 [email protected]
*/
@XmlAccessorType(XmlAccessType.FIELD)
public class Conference implements GenericBuilder<Conference>{

@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 + "]";
}
}
Loading