Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A GoLang FreeSWITCH ESL Library

License

NotificationsYou must be signed in to change notification settings

percipia/eslgo

Repository files navigation

PkgGoDevGitHub Workflow StatusGo Report CardTotal alertsGitHub license

eslgo is aFreeSWITCH™ ESL library for GoLang.eslgo was written from the ground up in idiomatic Go for use in our production products tested handling thousands of calls per second.

Install

go get github.com/percipia/eslgo
github.com/percipia/eslgo v1.4.1

Overview

  • Inbound ESL Connection
  • Outbound ESL Server
  • Event listeners by UUID or All events
    • Unique-Id
    • Application-UUID
    • Job-UUID
  • Context support for canceling requests
  • All command types abstracted out
    • You can also send custom data by implementing theCommand interface
      • BuildMessage() string
  • Basic Helpers for common tasks
    • DTMF
    • Call origination
    • Call answer/hangup
    • Audio playback

Examples

There are some buildable examples under theexample directory as well

Outbound ESL Server

package mainimport ("context""fmt""github.com/percipia/eslgo""log")funcmain() {// Start listening, this is a blocking functionlog.Fatalln(eslgo.ListenAndServe(":8084",handleConnection))}funchandleConnection(ctx context.Context,conn*eslgo.Conn,response*eslgo.RawResponse) {fmt.Printf("Got connection! %#v\n",response)// Place the call in the foreground(api) to user 100 and playback an audio file as the bLeg and no exported variablesresponse,err:=conn.OriginateCall(ctx,false, eslgo.Leg{CallURL:"user/100"}, eslgo.Leg{CallURL:"&playback(misc/ivr-to_hear_screaming_monkeys.wav)"},map[string]string{})fmt.Println("Call Originated: ",response,err)}

Inbound ESL Client

package mainimport ("context""fmt""github.com/percipia/eslgo""time")funcmain() {// Connect to FreeSWITCHconn,err:=eslgo.Dial("127.0.0.1:8021","ClueCon",func() {fmt.Println("Inbound Connection Disconnected")})iferr!=nil {fmt.Println("Error connecting",err)return}// Create a basic contextctx,cancel:=context.WithTimeout(context.Background(),5*time.Minute)defercancel()// Place the call in the background(bgapi) to user 100 and playback an audio file as the bLeg and no exported variablesresponse,err:=conn.OriginateCall(ctx,true, eslgo.Leg{CallURL:"user/100"}, eslgo.Leg{CallURL:"&playback(misc/ivr-to_hear_screaming_monkeys.wav)"},map[string]string{})fmt.Println("Call Originated: ",response,err)// Close the connection after sleeping for a bittime.Sleep(60*time.Second)conn.ExitAndClose()}

[8]ページ先頭

©2009-2025 Movatter.jp