Giter Club home page Giter Club logo

esl-client

Travis Maven Central

esl-client is a Java-based Event Socket Library for the FreeSWITCH project.

This project is a fork of the unmaintained, original project at https://freeswitch.org/stash/projects/FS/repos/freeswitch-contrib/browse/dvarnes/java/esl-client

Status: In Progress...

Example

package com.ecovate.freeswitch.lb;

import com.google.common.base.Throwables;
import org.freeswitch.esl.client.inbound.Client;
import org.freeswitch.esl.client.inbound.IEslEventListener;
import org.freeswitch.esl.client.internal.IModEslApi.EventFormat;
import org.freeswitch.esl.client.outbound.Context;
import org.freeswitch.esl.client.outbound.IClientHandler;
import org.freeswitch.esl.client.outbound.IClientHandlerFactory;
import org.freeswitch.esl.client.outbound.SocketClient;
import org.freeswitch.esl.client.transport.event.EslEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.InetSocketAddress;

public class FreeSwitchEventListener {

  private static Logger logger = LoggerFactory.getLogger(FreeSwitchEventListener.class);

  public static void main(String[] args) {
    try {

      final Client inboudClient = new Client();
      inboudClient.connect(new InetSocketAddress("localhost", 8021), "ClueCon", 10);
      inboudClient.addEventListener(new IEslEventListener() {
        @Override
        public void onEslEvent(EslEvent eslEvent) {

        }
      });
      inboudClient.setEventSubscriptions(EventFormat.PLAIN, "all");

      final SocketClient outboundServer = new SocketClient(
        new InetSocketAddress("localhost", 8084),
        new IClientHandlerFactory() {
          @Override
          public IClientHandler createClientHandler() {
            return new IClientHandler() {
              @Override
              public void handleEslEvent(Context context, EslEvent eslEvent) {
              }

              @Override
              public void onConnect(Context context, EslEvent eslEvent) {
              }
            };
          }
        });


    } catch (Throwable t) {
      Throwables.propagate(t);
    }
  }

}

Authors

License

esl-client is licensed under the Apache License, version 2.

esl-client's Projects

esl-client icon esl-client

A Fork from http://git.freeswitch.org/git/freeswitch-contrib/tree/dvarnes/java/esl-client

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.