-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit de72265
Showing
217 changed files
with
11,328 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Autosave files | ||
*~ | ||
|
||
# build | ||
[Oo]bj/ | ||
[Bb]in/ | ||
packages/ | ||
TestResults/ | ||
*nupkg | ||
|
||
# globs | ||
Makefile.in | ||
*.DS_Store | ||
*.sln.cache | ||
*.suo | ||
*.cache | ||
*.pidb | ||
*.userprefs | ||
*.usertasks | ||
config.log | ||
config.make | ||
config.status | ||
aclocal.m4 | ||
install-sh | ||
autom4te.cache/ | ||
*.user | ||
*.tar.gz | ||
tarballs/ | ||
test-results/ | ||
Thumbs.db | ||
|
||
# Mac bundle stuff | ||
*.dmg | ||
*.app | ||
|
||
# resharper | ||
*_Resharper.* | ||
*.Resharper | ||
|
||
# dotCover | ||
*.dotCover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
language: csharp | ||
solution: Plivo.sln | ||
|
||
matrix: | ||
include: | ||
- dotnet: 1.0.1 | ||
mono: none | ||
dist: trusty | ||
env: DOTNETCORE=1 # optional, can be used to take different code paths in your script | ||
- mono: latest | ||
dotnet: 1.0.1 | ||
dist: trusty | ||
|
||
install: | ||
- 'if [ ${DOTNETCORE} = 1 ]; then | ||
dotnet restore; | ||
dotnet build --framework netstandard1.1 src/Plivo/Plivo.csproj; | ||
dotnet build --framework netcoreapp1.1 tests_netcore/Plivo.NetCore.Test/Plivo.NetCore.Test.csproj; | ||
else | ||
dotnet restore; | ||
nuget restore Plivo.sln; | ||
nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory testrunner; | ||
fi' | ||
|
||
script: | ||
- 'if [ ${DOTNETCORE} = 1 ]; then | ||
dotnet test ./tests_netcore/Plivo.NetCore.Test/Plivo.NetCore.Test.csproj; | ||
else | ||
msbuild /p:Configuration=Release Plivo.sln; | ||
mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./tests/Plivo.Test/bin/Release/Plivo.Test.dll; | ||
fi' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Authors | ||
- Kritarth ([@kritarth3010](https://github.com/kritarth3010)) | ||
- [Sreyantha Chary](https://sreyanth.com?ref=github/plivo-dotnet) ([@sreyanth](https://github.com/sreyanth)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Change Log | ||
|
||
## [v4.0.0-beta1](https://github.com/plivo/plivo-dotnet/tree/v4.0.0-beta1) (2017-10-30) | ||
- The new SDK works with both .NET Framework (4.5+) and .NET Core (1.0+) | ||
- The API interfaces are consistent and guessable | ||
|
||
## Other changes | ||
* 3.0.7 Re-release | ||
* 3.0.6 Added addition verify signature function | ||
* 3.0.5 Added support for RestSharp 105.2.3 | ||
* 3.0.4 Added digitsMatchBLeg parameter to Dial XML. | ||
* 3.0.3 Fixed sorting in Verify function | ||
* 3.0.2 Added answer_time and initiation_time to CDR model. | ||
* 3.0.1 Added beep attribute to Wait XML. | ||
* 3.0.0 Updated RestSharpSigned | ||
* 2.0.2 Added Request API function, stop_speak_member function in Conference API and abstracted all API responses to a parent class PlivoResponse. | ||
* 2.0.1 Added modify_number function. | ||
* 2.0.0 Update and separate bundling of RestSharp client and add RestSharpSigned as nuget package dependency. Signed version enables it to work with modern as well as older projects that still require strongname binaries. | ||
* 1.3.7 Make Verify Signature function public | ||
* 1.3.5 PhoneNumber API | ||
* 1.3.2 Added old_auth_token and auth_token fields to SubAccount response | ||
* 1.3.1 Added log attribute in GetDigits to handle sensitive DTMF info | ||
* 1.3.0 Added Delete Recording API | ||
* 1.2.9 Added minSilence attribute in Wait, async attribute in DTMF, NuGet Update -selfrelayDTMF attribute in Conference, stop_speak() method and invalid_numbers in Call Response and added get_account, get_recordings, get_recording and get_recording_by_call_uuid methods | ||
* 1.2.8 Fixed issue with returning of nested XML object. | ||
* 1.2.7 Added 'recordWhenAlone' attribute in Conference XML. | ||
* 1.2.6 Fixed available number group for renting numbers. | ||
* 1.2.5 Fix issues with packaging. | ||
* 1.2.3 Allow optional parameters on various APIs. | ||
* 1.2.2 Minor change. Fix for speak api method. | ||
* 1.2.0 Additional APIs coverage: incoming carrier and pricing. support for unicode. | ||
* 1.1.7 Minor change. Updated attributes for Conference and Record Elements. | ||
* 1.1.6 Minor change. Updated attributes for GetDigits Element. | ||
* 1.1.5 Minor change. Updated attributes for Conference Element. | ||
* 1.1.4 Minor change. Updated attributes for Record Element. | ||
* 1.1.3 Minor fix for attribute error. | ||
* 1.1.2 Added attribute to XML element Wait. | ||
* 1.1.1 Added method for making bulk calls with sip headers for each. | ||
* 1.1.0 Multilingual speak support html entities. Added the new message APIs. Also updated various model attributes to handle json response. | ||
* 1.0.3 Minor fix to deal with GET request on few resources. | ||
* 1.0.2 Minor fix for PlivoElement.AddWait method. | ||
* 1.0.1 Minor fix for Number API calls. | ||
* 1.0 Supports making Plivo APIs calls and generation of Plivo XML. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (C) 2017, Plivo Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plivo", "src\Plivo\Plivo.csproj", "{EF3352B6-54D2-4731-95B5-D07D01982713}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plivo.Test", "tests\Plivo.Test\Plivo.Test.csproj", "{EDFC32D7-13A7-47F2-9E3D-8250D60B6408}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plivo.NetCore.Test", "tests_netcore\Plivo.NetCore.Test\Plivo.NetCore.Test.csproj", "{72465D60-EA64-47A8-8F6E-E44E2C99BD60}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{EF3352B6-54D2-4731-95B5-D07D01982713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{EF3352B6-54D2-4731-95B5-D07D01982713}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{EF3352B6-54D2-4731-95B5-D07D01982713}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{EF3352B6-54D2-4731-95B5-D07D01982713}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{EDFC32D7-13A7-47F2-9E3D-8250D60B6408}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{EDFC32D7-13A7-47F2-9E3D-8250D60B6408}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{EDFC32D7-13A7-47F2-9E3D-8250D60B6408}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{EDFC32D7-13A7-47F2-9E3D-8250D60B6408}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{72465D60-EA64-47A8-8F6E-E44E2C99BD60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{72465D60-EA64-47A8-8F6E-E44E2C99BD60}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{72465D60-EA64-47A8-8F6E-E44E2C99BD60}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{72465D60-EA64-47A8-8F6E-E44E2C99BD60}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(MonoDevelopProperties) = preSolution | ||
description = A .NET SDK to make voice calls & send SMS using Plivo and to generate Plivo XML | ||
version = 4.0.0-beta1 | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# plivo-dotnet | ||
|
||
[![Build Status](https://travis-ci.org/plivo/plivo-dotnet.svg?branch=4.0)](https://travis-ci.org/plivo/plivo-dotnet) | ||
|
||
The Plivo .NET SDK makes it simpler to integrate communications into your .NET applications using the Plivo REST API. Using the SDK, you will be able to make voice calls, send SMS and generate Plivo XML to control your call flows. | ||
|
||
**Supported .NET versions:** This SDK was written targeting at .NET Standard 1.1, and thus works with .NET Framework 4.5+ and .NET Core 1.0+. [Check here](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) to know about all the other supported platforms. | ||
|
||
## Installation | ||
You can install this SDK either by referencing the .dll file or using NuGet. | ||
|
||
Use the following line to install the latest SDK using the NuGet CLI. | ||
|
||
``` | ||
PM> Install-Package Plivo -Version 4.0.0-beta1 | ||
``` | ||
|
||
You can also use the .NET CLI to install this package as follows | ||
|
||
``` | ||
> dotnet add package Plivo --version 4.0.0-beta1 | ||
``` | ||
|
||
## Getting started | ||
|
||
### Authentication | ||
To make the API requests, you need to create a `PlivoApi` instance and provide it with authentication credentials (which can be found at [https://manage.plivo.com/dashboard/](https://manage.plivo.com/dashboard/)). | ||
|
||
```csharp | ||
var api = new PlivoApi("your_auth_id", "your_auth_token"); | ||
``` | ||
|
||
## The Basics | ||
The SDK uses consistent interfaces to create, retrieve, update, delete and list resources. The pattern followed is as follows: | ||
|
||
```csharp | ||
api.Resource.Create(params); | ||
api.Resource.Get(params); | ||
api.Resource.Update(identifier, params); | ||
api.Resource.Delete(identifier); | ||
api.Resource.List(); | ||
``` | ||
|
||
Using `api.Resource.List()` would list the first 20 resources by default (which is the first page, with `limit` as 20, and `offset` as 0). To get more, you will have to use `limit` and `offset` to get the second page of resources. | ||
|
||
## Examples | ||
|
||
### Send a message | ||
|
||
```csharp | ||
internal class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
var api = new PlivoApi("your_auth_id", "your_auth_token"); | ||
var response = api.Message.Create( | ||
src:"the_source_number", | ||
dst:new List<String>{"the_destination_number"}, | ||
text:"Hello, world!" | ||
); | ||
Console.WriteLine(response); | ||
} | ||
} | ||
``` | ||
|
||
### Make a call | ||
|
||
```csharp | ||
internal class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
var api = new PlivoApi("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN"); | ||
var response = api.Call.Create( | ||
to:new List<String>{"the_to_number"}, | ||
from:"the_from_number", | ||
answerMethod:"GET", | ||
answerUrl:"https://answer.url" | ||
); | ||
Console.WriteLine(response); | ||
} | ||
} | ||
``` | ||
|
||
### Generate Plivo XML | ||
|
||
```csharp | ||
class MainClass | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
Plivo.XML.Response response = new Plivo.XML.Response(); | ||
response.AddSpeak("Hello, world!", | ||
new Dictionary<string, string>() { }); | ||
Console.WriteLine(response.ToString()); | ||
} | ||
} | ||
``` | ||
|
||
This generates the following XML: | ||
|
||
```xml | ||
<Response> | ||
<Speak>Hello, world!</Speak> | ||
</Response> | ||
``` | ||
|
||
### More examples | ||
Refer to the [Plivo API Reference](https://api-reference.plivo.com/latest/net/introduction/overview) for more examples. | ||
|
||
## Reporting issues | ||
Report any feedback or problems with this beta version by [opening an issue on Github](https://github.com/plivo/plivo-dotnet/issues). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.IO; | ||
using Plivo.Exception; | ||
|
||
namespace Plivo.Authentication | ||
{ | ||
/// <summary> | ||
/// Basic auth. | ||
/// </summary> | ||
public class BasicAuth | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="T:plivo.Authentication.BasicAuth"/> class. | ||
/// </summary> | ||
public BasicAuth() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="T:plivo.Authentication.BasicAuth"/> class. | ||
/// </summary> | ||
/// <param name="authId">Auth identifier.</param> | ||
/// <param name="authToken">Auth token.</param> | ||
public BasicAuth(string authId, string authToken) | ||
{ | ||
AuthId = authId; | ||
AuthToken = authToken; | ||
|
||
if (AuthId == null || AuthToken == null) | ||
{ | ||
throw new PlivoAuthenticationException("Authentication credentials not supplied"); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the authentication identifier. | ||
/// </summary> | ||
/// <value>The authentication identifier.</value> | ||
public string AuthId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the authentication token. | ||
/// </summary> | ||
/// <value>The authentication token.</value> | ||
public string AuthToken { get; set; } | ||
} | ||
} |
Oops, something went wrong.