esl 0.1.0

  • Readme
  • Changelog
  • Installing
  • 37

libesl-dart #

FreeSWITCH event socket client library written in Dart

The project is in an early state and contributions/bug reports are very welcome. See the examples directory for usage.

Basic usage #

You need to add the esl library to your pubspec.yaml.

  esl: '<0.1.0'

And import it in your sources.

import 'package:esl/esl.dart' as esl;

Connecting #

esl.Connection conn = new esl.Connection();
conn.connect('', 8021);

Authenticating #

The first thing you will need to do after having connected, is authenticate. Libesl-dart is fully asynchronous and uses streams for the events, responses and requests coming from the FreeSWITCH server.

This means that the way you handle authentication, is that you setup a listener for auth/request requests coming from the server.

Example code #

esl.Connection conn = new esl.Connection();
conn.requestStream.listen((esl.Packet packet) {
  switch (packet.contentType) {
    case (esl.ContentType.authRequest):

conn.connect('', 8021);

Log trace #

Every esl connection object has its own logger object that is muted by default. It uses the "logging" package[1] from, so you may need to include this package in your project.

In order to tap into the log trace you need to set an onRecord handler. This can be done at any time, but makes most sense doing at instantiation.

Example code #

esl.Connection conn = new esl.Connection()

This makes every log entry go to the root Logger, and inherit its loglevel.


Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

0.1.0 #

  • Breaking changes: see 0.0.99

0.0.99 #

  • Breaking changes:

    • Made log field in Connection private (breaking)
    • Class field excludedFields in Channel class is no longer public.
    • Connection.connect no longer returns the Socket object.
    • Connection class no longer connects for you. A connected socket must be passed to the constructor.
    • Packets no longer parses the payload, but just stores the bytes.
    • The Event, Response and Reply classes are no longer derived from the Packet class. This means that you must update your listener type, if you use the general Packet type.
    • Notice stream of Connection object now spawns typed Notice objects, rather than Packet objects.
    • Response.rawLength renamed to content
    • Event.contentAsMap renamed to fields . Event.field function removed. Use Event.fields Map instead.
  • Non-breaking

  • Added utility authentication handler function

  • Branched out packet transformer to seperate library.

  • Cleaned up API documentation.

0.0.21 #

  • Made fields headerBuffer and bodyBuffer private. These were, unintentially, left public but were never intended to be exposed.
  • Closed #9 Socket Writes may cause async errors.

0.0.20 #

Breaking change release. Removed the un-dartly named functions and constants that was deprecated in 0.0.19.

0.0.19-1 #

Patch release with documentation generated.

0.0.19 #

  • Addition of notice stream for disconnect notice
  • Deprecated most of the un-dartly named functions and constants
  • Added job-uuid parameter for bgapi
  • Minor bugfixes

0.0.16-beta #

  • Initial beta release

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  esl: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:esl/esl.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21


Detected platforms: Flutter, other

Primary library: package:esl/esl.dart with components: io.

Health issues and suggestions

Fix lib/src/connection.dart. (-26.12 points)

Analysis of lib/src/connection.dart failed with 1 error, 3 hints:

line 32 col 20: The argument type 'PacketTransformer' can't be assigned to the parameter type 'StreamTransformer<Uint8List, dynamic>'.

line 103 col 54: Use = to separate a named parameter from its default value.

line 128 col 58: Use = to separate a named parameter from its default value.

line 138 col 53: Use = to separate a named parameter from its default value.

Fix lib/src/peer_list.dart. (-0.50 points)

Analysis of lib/src/peer_list.dart reported 1 hint:

line 29 col 62: Use = to separate a named parameter from its default value.

Format lib/packet_transformer.dart.

Run dartfmt to format lib/packet_transformer.dart.

Format lib/src/response.dart.

Run dartfmt to format lib/src/response.dart.

Maintenance suggestions

The package description is too short. (-17 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is getting outdated. (-7.40 points)

The package was last published 56 weeks ago.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and esl.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <3.0.0
logging >=0.11.3 <1.0.0 0.11.3+2
Dev dependencies
test >=0.12.34 <2.0.0