Skip to content

signalwire-community/compatibility-api-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Wrapper for SignalWire Compatibility APIs

An Unofficial Java API wrapper that allows for the rapid development and integration of Java-based applications with the SignalWire API.

⚠️ Disclaimer:

The libraries in this repository are NOT supported by SignalWire. SignalWire will not answer support questions about the code in this repository, and is not responsible for fixing issues.

This library automates the process of consuming the Signalwire API by providing a wide range of helper methods that allow for quick development and testing.

Documentation

The documentation for the SignalWire API can be found here

Getting Started

Dependencies

<dependency>
    <groupId>io.github.signalwire-community</groupId>
    <artifactId>compatibility-api-java</artifactId>
    <version>1.0.2</version>
</dependency>

Usage

Initialize SignalWireClient

SignalWireClient client = new SignalWireClient(projectId,apiToken,spaceName);

This class give you access to the voice, message, accounts, phonenumber repository

Get your project Id and API token from your signalWire space. for more information click here

Sending a Message

NewMessageResponse response = client.message().create(to,from,body);

The above Line takes the to, from and body parameter to send an email.

Making a Phone call

Call response = client.voice().create(from,url,to,record,statusCallback);

The above statement returns the call object which includes all information about the placed call

List of Accounts

AccountResponse response = client.accounts().getAccounts();

Returns the list of accounts within the project space

Create an XML bin

The Library consist f a helper method that generates an xml string that can be used to create an XML bin on SignalWire

// Generate the XML String    
VoiceResponse response = new VoiceResponse.Builder()
        .say(null,"Hello world")
        .say(null,"Welcome to the unofficial SW java library")
        .build();

String xml = response.getResponse(); // This returns the content in raw xml file

// Create an XML bin on SignalWire
Bin bin = client.xml().create("new_bin_title",xml)

Create a Sip endpoint

You can create a SIP endpoint using the below snippet

List<String> ciphers = new ArrayList<>();
ciphers.add("AEAD_AES_256_GCM_8");
ciphers.add("AES_256_CM_HMAC_SHA1_80");
ciphers.add("AES_CM_128_HMAC_SHA1_80");
ciphers.add("AES_256_CM_HMAC_SHA1_32");
ciphers.add("AES_CM_128_HMAC_SHA1_32");

List<String > codecs = new ArrayList<>();
codecs.add("OPUS");
codecs.add("G722");
codecs.add("PCMU");
codecs.add("PCMA");
codecs.add("VP8");
codecs.add("H264");
SipResponse.Sip create = client.sip().create("testing-sip","password","testing", "+1444433344",ciphers, codecs,"required")

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages