ExotelSdk 1.2.0
dotnet add package ExotelSdk --version 1.2.0
NuGet\Install-Package ExotelSdk -Version 1.2.0
<PackageReference Include="ExotelSdk" Version="1.2.0" />
paket add ExotelSdk --version 1.2.0
#r "nuget: ExotelSdk, 1.2.0"
// Install ExotelSdk as a Cake Addin #addin nuget:?package=ExotelSdk&version=1.2.0 // Install ExotelSdk as a Cake Tool #tool nuget:?package=ExotelSdk&version=1.2.0
Exotel SDK (C-Sharp)
ExotelSdk is a C# library built on top of .Net Standard 2.0. This makes it extremely easy to implement Exotel's RESTful APIs to integrate Call and Sending SMS using Exotel's Rest API. For more details please visit Exotel Developer portal
Installation
The library is hosted on NuGet. You can install the same to your project using both Package Manager and .Net CLI.
Installing ExotelSdk using NuGet Package Manager Console
PM>Install-Package ExotelSdk
This will install the packages and its dependencies to your project and you can start using the methods just by importing the ExotelSdk namespace.
using ExotelSdk; // This is important
// Other codes are removed for clarity
ExotelConnect c = new ExotelConnect("<your_sid>", "<your_api_key>", "<your_api_token>");
var response =await c.ConnectTwoNumbersAsync("<your_from_phone_number>", "<your_to_phone_number>", "<your_exotel_phone_number>");
if (response.IsSuccess)
Console.WriteLine("Success");
else
Console.WriteLine("Fail");
API References
The project contains extension methods for the followings.
Api Reference Details
ConnectTwoNumbersAsync()
This API will connect two numbers. It connects From Number first. Once the person at the From end picks up the phone, it will connect to the number provided as To. You can choose which number should be connected first by adding that number in the From field.
/// from : The phone number that will be called first. If not set, our system will try to match it with a country and make a call. If landline number, prefix it with STD code; Ex: 080XXXX2400
/// to : Your customer's phone number. If landline number, prefix it with STD code; Ex: 080XXXX2400
/// callerId : This is your ExoPhone/Exotel Virtual Number
/// timeLimit : The time limit (in seconds) that you want this call to last. The call will be cut after this time
/// timeOut : The time (in seconds) to ring the called parties (both first and second call leg)
/// statusCallback : An HTTP POST request will be made to this URL depending on what events are subscribed using ‘StatusCallbackEvents’.
/// isRecord : Record the conversation of your call. The RecordingUrl will be sent to the StatusCallback URL if this is set to 'true' and the call conversation happens.
public async Task<ExotelResponse> ConnectTwoNumbersAsync(string from, string to, string callerId, int? timeLimit = null,
int? timeOut = null, string statusCallback = null, bool isRecord = true);
Example
// Other codes are removed for clarity
ExotelConnect c = new ExotelConnect("<your_sid>", "<your_api_key>", "<your_api_token>");
var response =await c.ConnectTwoNumbersAsync("<your_from_phone_number>", "<your_to_phone_number>", "<your_exotel_phone_number>");
Click here to check the Official documentation
GetCallDetails()
Gets the call details(including Status, Price, etc.).
/// callReferenceId : Call Reference Id
public async Task<ExotelResponse> GetCallDetails(string callReferenceId);
Example
// Other codes are removed for clarity
ExotelConnect c = new ExotelConnect("<your_sid>", "<your_api_key>", "<your_api_token>");
var response =await c.GetCallDetails("<sid_for_call>");
Click here to check the Official documentation
SendSms()
This API will send an SMS to the specified To number.
/// from : Specify one of your ExoPhone
/// to : Mobile number to which SMS has to be sent.
/// messageBody : Content of your SMS; Max Length of the body cannot exceed 2000 characters
/// encodingType : Message type of SMS; "plain" or "unicode"
/// priority : Priority of the SMS; "normal" or "high". Business critical operations like sending verification codes, confirming appointments etc which require immediate SMS delivery should opt for high priority.
public async Task<ExotelResponse> SendSms(string from, string to, string messageBody, string encodingType = "", string priority = "");
Example
// Other codes are removed for clarity
ExotelConnect c = new ExotelConnect("<your_sid>", "<your_api_key>", "<your_api_token>");
var response =await c.SendSms("<your_from_phone_number>","<your_to_phone_number","<your_message_body>");
Click here to check the Official documentation
GetSmsDetails()
Gets the SMS details
/// smsReferenceId : SMS reference Id
public async Task<ExotelResponse> GetSmsDetails(string smsReferenceId);
Example
// Other codes are removed for clarity
ExotelConnect c = new ExotelConnect("<your_sid>", "<your_api_key>", "<your_api_token>");
var response =await c.GetSmsDetails("<your_sms_sid>");
Click here to check the Official documentation
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 12.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Adds SMS endpoints.