esl 0.1.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 50

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.

dependencies:
  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('example.com', 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.authenticate('ClueCon');
      break;
    default:
      break;
  }
});

conn.connect('example.com', 8021);

Log trace

Every esl connection object has its own logger object that is muted by default. It uses the "logging" package[1] from pub.dartlang.org, 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()
                             ..log.onRecord.listen(print);

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


[1] https://pub.dartlang.org/packages/logging

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:


dependencies:
  esl: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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';
  
Version Uploaded Documentation Archive
0.1.0 Sep 14, 2018 Go to the documentation of esl 0.1.0 Download esl 0.1.0 archive
0.0.19 Jun 21, 2016 Go to the documentation of esl 0.0.19 Download esl 0.0.19 archive
0.0.19-1 Jun 21, 2016 Go to the documentation of esl 0.0.19-1 Download esl 0.0.19-1 archive
0.0.16-beta Aug 8, 2015 Go to the documentation of esl 0.0.16-beta Download esl 0.0.16-beta archive
Popularity:
Describes how popular the package is relative to other packages. [more]
8
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, other

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

Health suggestions

Format lib/packet_transformer.dart.

Run dartfmt to format lib/packet_transformer.dart.

Format lib/src/connection.dart.

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

Format lib/src/response.dart.

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

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use esl.dart.

Dependencies

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