Skip to content

Issue#16 available phone numbers #22

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 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
19a6fcf
Notifications added
mithileshkarnati Jun 27, 2017
0941175
second
mithileshkarnati Jun 27, 2017
b2d28de
second
mithileshkarnati Jun 27, 2017
6f0540a
ASCII doc added
mithileshkarnati Jun 27, 2017
9eaca5b
Final patch for Notification API, this closes #4
mithileshkarnati Jun 27, 2017
09820f0
Final patch for Notification API, this closes #4
mithileshkarnati Jun 27, 2017
9257dd1
Final patch for Notification API, this closes #4
mithileshkarnati Jun 27, 2017
9734e54
Final patch for Notification API, this closes #4
mithileshkarnati Jun 28, 2017
834b125
Final Patch for Notification API, this closes #4
mithileshkarnati Jun 28, 2017
91a47dd
Final patch for SMS API,this closes #7
mithileshkarnati Jun 28, 2017
47bce0b
Final patch for Notification API,this closes #4
mithileshkarnati Jun 28, 2017
a76d7b6
Final patch for SMS API,this closes #7
mithileshkarnati Jun 28, 2017
d7dd737
ASCII doc for SMS api added
mithileshkarnati Jun 28, 2017
07a00be
Final patch for SMS API, this fixes #7
mithileshkarnati Jun 28, 2017
1c2626c
First Commit
mithileshkarnati Jun 29, 2017
d94f073
Email ASCCI doc created
mithileshkarnati Jun 29, 2017
030c84d
Final Patch for Email API, this fixes #9
mithileshkarnati Jun 29, 2017
44e724b
First
mithileshkarnati Jun 29, 2017
b58c9e4
Final Patch for Recordings API, this fixes #12
mithileshkarnati Jun 29, 2017
ead99ae
Final patch for Recordings API, this fixes #12
mithileshkarnati Jun 29, 2017
5edbd8a
Final patch for Transcription API, this closes #14
mithileshkarnati Jun 29, 2017
57041eb
Commit without Participants subresource
mithileshkarnati Jun 30, 2017
1df00fd
Only Doc Left
mithileshkarnati Jun 30, 2017
b80be9d
First
mithileshkarnati Jul 3, 2017
ec0af1c
Final Patch for Conference Api, this closes #18
mithileshkarnati Jul 3, 2017
110ecb8
Final Patch for AvailablePhoneNumbers API, this closes #16
mithileshkarnati Jul 5, 2017
0f0839b
Final Patch for AvailablePhoneNumbers API, this closes #16
mithileshkarnati Jul 5, 2017
37e1d0b
Final Patch for AvailablePhoneNumbers API, this closes #16
mithileshkarnati Jul 5, 2017
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
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# restcomm-sdk-java
The Java SDK for RestComm REST API

- To build the Project, after downloading the zip and extracting it from GitHub, navigate to the folder containing the pom.xml
file and buiild the project using the following command in the terminal

```sh
$ mvn package
```
- Now when this command is executed, the compilation,validation and testing will be done and after the successful completion of them, a jar file will be generated in the target folder.

- Include the jar file in your build path to get Started.

Java version: 1.8.0_131

This is an SDK for RestComm REST API,
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

140 changes: 140 additions & 0 deletions restcomm-connect.java.sdk/src/main/asciidoc/AvailablePhoneNumbers.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
= Restcomm JAVA Sdk - AvailablePhoneNumbers

[[AvailablePhoneNumbers]]
== AvailablePhoneNumbers

The *AvailablePhoneNumbers* subresources let you search for incoming local and toll-free phone numbers that are available for you to purchase from a Telestax partner.

== Fetching List of PhoneNumbers

=== Fetching the Default List

The Default AvailablePhoneNumbers List can be fetched by using the following code snippet

....
AvailablePhoneNumberList List = AvailablePhoneNumberList.getList("US","Local");
....

Here, we are trying to fetch the Numbers from USA, which has an ISOCountryCode - "US" and we intend to fetch the Local PhoneNumbers, thus the second Parameter "Local".

=== Fetching a Filtered List

A Filtered AvailablePhoneNumbers List can be fetched by using the getFilteredList() method of the class AvailablePhoneNumberList

....
AvailablePhoneNumberList List = AvailablePhoneNumberList.getFilteredList("US","Local").SmsEnabled("true").Filter();
....

The above mentioned code snippet fetches the similar List which is mentioned above, but it contains only those with the SmsEnabled property set to "true".

==== List of FilterParameters
[cols=",",options="header",]
|===============================================================================================================================================================================================================================================================================
|Parameter |Methods
|AreaCode |AreaCode().
|Contains |Contains().
|SmsEnabled |SmsEnabled().
|MmsEnabled |MmsEnabled().
|VoiceEnabled |VoiceEnabled().
|ExcludeAllAddressRequired |ExcludeAllAddressRequired().
|ExcludeLocalAddressRequired |ExcludeLocalAddressRequired().
|ExcludeForeignAddressRequired |ExcludeForeignAddressRequired().
|Beta |Beta().
===============================================================================================================================================================================================================================================================================

== Accessing the Fetched AvailablePhoneNumberList

The size of the Fetched List can be known by
....
int size = List.size();
....

The PhoneNumber from the fetched AvailablePhoneNumberList Object can be obtained by
....
PhoneNumber JackNumber = List.get(1);
....

The fields of the PhoneNumber can be accessed by using the following methods
....
String Number;
Number = JackNumber.getPhone_number();
....


The Following are the fields available for the PhoneNumbers fetched

=== Local

==== US/Canada Numbers
[cols=",",options="header",]
|===============================================================================================================================================================================================================================
|Fields |method
|FriendlyName |getFriendly_name().
|PhoneNumber |getPhone_number().
|Lata |getLata().
|RateCenter |getRate_center().
|Latitude |getLatitude().
|Longitude |getLongitude().
|Region |getRegion().
|PostalCode |getPostal_code().
|IsoCountry |getIso_country().
|VoiceCapable|voice_capable().
|SmsCapable|sms_capable().
|MmsCapable|mms_capable().
|FaxCapable|fax_capable().
===============================================================================================================================================================================================================================

==== Other Numbers
[cols=",",options="header",]
|
===============================================================================================================================================================================================================================
|Fields |method
|FriendlyName |getFriendly_name().
|PhoneNumber |getPhone_number().
|IsoCountry |getIso_country().
|VoiceCapable|voice_capable().
|SmsCapable|sms_capable().
|MmsCapable|mms_capable().
|FaxCapable|fax_capable().
===============================================================================================================================================================================================================================

=== Mobile
[cols=",",options="header",]
|
===============================================================================================================================================================================================================================
|Fields |method
|FriendlyName |getFriendly_name().
|PhoneNumber |getPhone_number().
|IsoCountry |getIso_country().
|VoiceCapable|voice_capable().
|SmsCapable|Sms_capable().
|MmsCapable|Mms_capable().
|FaxCapable|Fax_capable().
|AddressRequirements|Address_requirements().
===============================================================================================================================================================================================================================

=== TollFree
[cols=",",options="header",]
|
===============================================================================================================================================================================================================================
|Fields |method
|FriendlyName |getFriendly_name().
|PhoneNumber |getPhone_number().
|IsoCountry |getIso_country().
|VoiceCapable|voice_capable().
|SmsCapable|Sms_capable().
|MmsCapable|Mms_capable().
|FaxCapable|Fax_capable().
|AddressRequirements|Address_requirements().
===============================================================================================================================================================================================================================



NOTE: The Default Account from which we fetch the AvailablePhoneNumberList is the Main Account.

If we want to change the Default Account to any specific SubAccount , use the following method before Fetching the AvailablePhoneNumber(s)
....
AvailablePhoneNumberList.SubAccountAccess(SubAccountSid);
AvailablePhoneNumberList List = AvailablePhoneNumberList.getList();
....

Empty file.
Empty file.
141 changes: 141 additions & 0 deletions restcomm-connect.java.sdk/src/main/asciidoc/Notifications.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
= Restcomm JAVA Sdk - Notifications

[[Notifications]]
== Notifications

A *Notification* resource represents a single log entry made by RestComm while handling your calls or your use of the Restful APIs. It is very useful for debugging purposes. The Notifications list resource represents the set of notifications generated for an account.


From here onwards, by a Notification, we refer to a Notification Resource Object

=== Fetching a Notification

A Notification with a given Sid can be fetched by the following code snippet
....
String Sid;
.
.
.
Notification CallNotification = Notification.getNotification(Sid);
....

=== Accessing the Fetched Notification

A Field of a Notification Object can be accessed by using the corresponding getMethod for that Field
....
String Message;
Message = CallNotification.getMessage_text().
....

==== List of Fields
[cols=",",options="header",]
|===============================================================================================================================================================================================================================
|Property |Method
|Sid | getSid().
|DateCreated |getDate_created().
|DateUpdated |getDate_updated().
|AccountSid |getAccount_sid().
|CallSid |getCall_sid().
|ApiVersion |getApi_version().
|Log |getLog().
|ErrorCode |getErrorCode().
|MoreInfo |getMore_info().
|MessageText |getMessage_text().
|MessageDate |getMessage_date().
|RequestUrl |getRequest_url().
|RequestMethod |getRequest_method().
|RequestVariables |getRequest_variables().
|ResponseHeaders |getResponse_headers().
|ResponseBody |getResponse_body().
|Uri |getUri().
|===============================================================================================================================================================================================================================

== Fetching List of Notifications

=== Fetching the Default List

The Default Notifications List can be fetched by using the following code

....
NotificationList List = NotificationList.getList();
....

=== Fetching a Filtered List

A Filtered Notifications List can be fetched by using the getFilteredList() method of the class NotificationList

....
NotificationList List = NotificationList.getFilteredList().ErrorCode("1").MessageText("Hello World").Filter();
....

The above mentioned code snippet fetches the Notifications with ErrorCode = 1 and MessageText = Hello World

==== List of FilterParameters
[cols=",",options="header",]
|===============================================================================================================================================================================================================================
|Parameter |Method
|StartTime |StartTime().
|EndTime |EndTime().
|ErrorCode |ErrorCode().
|MessageText |MessageText().
|RequestUrl |RequestUrl().
|===============================================================================================================================================================================================================================

In addition to these, the regular Paging paramters can also be used similar to the FilterParameters
....
NotificationList List = NotificationList.getFilteredList().PageSize("1").Filter().
....

==== List of PagingParameters
[cols=",",options="header",]
|===============================================================================================================================================================================================================================
|Paramter |Method
|Page |Page().
|NumPages |NumPages().
|PageSize |PageSize().
|Total |Total().
|Start |Start().
|End |End().
|===============================================================================================================================================================================================================================

== Accessing the Fetched NotificationList

The size of the Fetched List can be known by
....
int size = CallNotification.size();
....

The a Notification from the fetched NotificationList Object can be obtained by
....
Notification a = CallNotification.get(1);
....

== Additional Paging Information
We can also access the Additional Paging Information by using the Methods of NotificationList
....
String Uri;
Uri = CallNotification.getpreviouspageuri();
....

The API returns URIs to the next, previous, first and last pages of the returned list as shown in the table below:

=== Request Parameters

[cols=",",options="header",]
|============================================================
|Parameter |Method
|Uri |geturi().
|Firstpageuri |getfirstpageuri().
|Nextpageuri |getnextpageuri().
|Previouspageuri |getpreviouspageuri().
|Lastpageuri |getlastpageuri().
|============================================================

NOTE: The Default Account from which we fetch the Notifications is the Main Account.

If we want to change the Default Account to any specific SubAccount , use the following method before Fetching the Notification(s)
....
NotifactionList.SubAccountAccess(SubAccountSid);
NotificationList List = NotificationList.getList();
....

Loading