Infrastructure.Telecom 1.0.4

dotnet add package Infrastructure.Telecom --version 1.0.4
                    
NuGet\Install-Package Infrastructure.Telecom -Version 1.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Infrastructure.Telecom" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Infrastructure.Telecom" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Infrastructure.Telecom" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Infrastructure.Telecom --version 1.0.4
                    
#r "nuget: Infrastructure.Telecom, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Infrastructure.Telecom@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Infrastructure.Telecom&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Infrastructure.Telecom&version=1.0.4
                    
Install as a Cake Tool

Infrastructure.Telecom

A .NET library for integrating with Olax GSM devices (tested on Olax Ultra U80_21B44). It lets you send SMS, read messages, manage your device, and more — all through a clean, async API.


Requirements

  • .NET Standard 2.1 or later
  • An Olax Ultra device connected to your local network
  • The device's local IP address, username, and password

Installation

dotnet add package Infrastructure.Telecom

Or via the NuGet Package Manager:

Install-Package Infrastructure.Telecom

Setup

1. Add configuration to appsettings.json

{
  "TelecomSettings": {
    "Host": "http://192.168.0.1",
    "Username": "admin",
    "Password": "your-password",
    "DeviceType": "Olax"
  }
}

Host is the base URL of your Olax device on the local network.


2. Register the service in Program.cs / Startup.cs

Using appsettings.json (recommended):

builder.Services.AddTelecomService();

Or pass configuration directly in code:

builder.Services.AddTelecomService(new BaseConfiguration
{
    Host = "http://192.168.0.1",
    Username = "admin",
    Password = "your-password"
});

Usage

Inject IOlaxTelecomService into your class:

public class MyService
{
    private readonly IOlaxTelecomService _telecom;

    public MyService(IOlaxTelecomService telecom)
    {
        _telecom = telecom;
    }
}

Send SMS

Simple way:

await _telecom.SendSMSAsync("+84901234567", "Hello from Infrastructure.Telecom!");

Using request object:

var request = new CreateSMSRequest("+84901234567", "Hello!");
await _telecom.SendSMSAsync(request);

Read Messages

// Get all messages
var all = await _telecom.GetSMSsAsync();

// Get only new (unread) messages
var newMessages = await _telecom.GetNewSMSsAsync();

// Get read messages
var oldMessages = await _telecom.GetOldSMSsAsync();

// Get sent messages
var sent = await _telecom.GetSentSMSsAsync();

Each message is a MessageDto:

Property Type Description
Id int Message ID
Number string Sender/receiver number
Content string Message text
Date DateTimeOffset Message timestamp

By default, up to 500 messages are returned. You can pass a custom pageSize:

var messages = await _telecom.GetSMSsAsync(pageSize: 100);

Manage Messages

// Mark a message as read
await _telecom.MarkOldSMSAsync(messageId);

// Delete a specific message
await _telecom.DeleteSMSAsync(messageId);

// Delete all messages
await _telecom.DeleteAllSMSAsync();

Device Information & Control

// Get device info
DeviceDto device = await _telecom.GetDeviceAsync();
Console.WriteLine(device.PhoneNumber);
Console.WriteLine(device.NetworkType);
Console.WriteLine(device.SignalStrength);

// Check if the SMS module is ready
bool isReady = await _telecom.GetSMSReadyAsync();

// Reboot the device
await _telecom.RebootDeviceAsync();

// Turn off the device
await _telecom.TurnOffDeviceAsync();

// Reset the IP
await _telecom.ResetIPAsync();

DeviceDto key properties:

Property Description
PhoneNumber SIM card phone number
SSID Wi-Fi network name
NetworkType Network type (4G, LTE...)
SignalStrength Signal strength value
IsNetworkConnect Whether the device is online
Imei Device IMEI
SoftwareVersion Firmware version

Custom Validation

By default, all SMS requests pass validation. You can add your own rules by implementing ITelecomValidator:

public class MyTelecomValidator : ITelecomValidator
{
    public Task<bool> SendSMSValidateAsync(CreateSMSRequest request)
    {
        // Example: block empty content
        bool isValid = !string.IsNullOrWhiteSpace(request.Content)
                    && !string.IsNullOrWhiteSpace(request.PhoneNumber);

        return Task.FromResult(isValid);
    }
}

Then register your validator before calling AddTelecomService:

builder.Services.AddTransient<ITelecomValidator, MyTelecomValidator>();
builder.Services.AddTelecomService();

If validation fails, a SmsRuleViolationException is thrown:

try
{
    await _telecom.SendSMSAsync(request);
}
catch (SmsRuleViolationException ex)
{
    Console.WriteLine(ex.Message); // "SMS sending failed: violates compliance rules."
}

Full Example

// Program.cs
builder.Services.AddTelecomService();

// MyController.cs
public class NotificationController : ControllerBase
{
    private readonly IOlaxTelecomService _telecom;

    public NotificationController(IOlaxTelecomService telecom)
    {
        _telecom = telecom;
    }

    [HttpPost("send")]
    public async Task<IActionResult> Send(string phone, string message)
    {
        await _telecom.SendSMSAsync(phone, message);
        return Ok("SMS sent.");
    }

    [HttpGet("inbox")]
    public async Task<IActionResult> Inbox()
    {
        var messages = await _telecom.GetNewSMSsAsync();
        return Ok(messages);
    }
}
Product 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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4 122 3/30/2026
1.0.3 279 9/11/2025
1.0.2 284 6/16/2025
1.0.1 314 3/29/2025
1.0.0 437 9/7/2023