Endpoint

Endpoint

A media resource on a freeswitch-based MediaServer that is capable of play, record, signal detection, and signal generation Note: This constructor should not be called directly: rather, call MediaServer#createEndpoint to create an instance of an Endpoint on a MediaServer

Constructor

new Endpoint(conn, dialog, ms, optsopt)

Source:
Parameters:
Name Type Attributes Description
conn esl.Connection

outbound connection from a media server for one session

dialog Dialog

SIP Dialog to Freeswitch

ms MediaServer

MediaServer that contains this Endpoint

opts Endpoint~createOptions <optional>

configuration options

Members

conf :Object

conference name and memberId associated with the conference that the endpoint is currently joined to

Source:
Type:
  • Object

conn

Source:

local :Endpoint~NetworkConnection

defines the local network connection of the Endpoint

Source:
Type:

mediaserver

Source:

remote :Endpoint~NetworkConnection

defines the remote network connection of the Endpoint

Source:
Type:

secure :Boolean

is secure media being transmitted (i.e. DLTS-SRTP)

Source:
Type:
  • Boolean

sip :Endpoint~SipInfo

defines the SIP signaling parameters of the Endpoint

Source:
Type:

srf

Source:

Methods

api(command, argsopt, callbackopt) → {Promise|Endpoint}

call a freeswitch api method

Source:
Parameters:
Name Type Attributes Description
command string

command name

args string <optional>

command arguments

callback Endpoint~mediaOperationsCallback <optional>

callback function

Returns:
Type:
Promise | Endpoint

if no callback specified, a Promise that resolves with the response is returned otherwise a reference to the endpoint object

bridge(other, callbackopt) → {Promise|Endpoint}

bridge two endpoints together

Source:
Parameters:
Name Type Attributes Description
other Endpoint | string

an Endpoint or uuid of a channel to bridge with

callback Endpoint~operationCallback <optional>

callback invoked when bridge operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

confDeaf(callbackopt) → {Promise|Endpoint}

deaf the member

Source:
Parameters:
Name Type Attributes Description
callback Endpoint~mediaOperationCallback <optional>

callback invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

confHup(callbackopt) → {Promise|Endpoint}

kick the member out of the conference without exit sound

Source:
Parameters:
Name Type Attributes Description
callback Endpoint~mediaOperationCallback <optional>

callback invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

confKick(callbackopt) → {Promise|Endpoint}

kick the member out of the conference

Source:
Parameters:
Name Type Attributes Description
callback Endpoint~mediaOperationCallback <optional>

callback invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

confMute(callbackopt) → {Promise|Endpoint}

mute the member

Source:
Parameters:
Name Type Attributes Description
callback Endpoint~mediaOperationCallback <optional>

callback invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

confPlay(string, optsopt, callbackopt) → {Promise|Endpoint}

play a file to the member

Source:
Parameters:
Name Type Attributes Description
string

file - file to play

opts Endpoint~playOptions <optional>

play options

callback Endpoint~mediaOperationCallback <optional>

callback invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the ConferenceConnection object

confUndeaf(callbackopt) → {Promise|Endpoint}

undeaf the member

Source:
Parameters:
Name Type Attributes Description
callback Endpoint~mediaOperationCallback <optional>

callback invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

confUnmute(callbackopt) → {Promise|Endpoint}

unmute the member

Source:
Parameters:
Name Type Attributes Description
callback Endpoint~mediaOperationCallback <optional>

callback invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

connected()

returns true if the Endpoint is in the 'connected' state

Source:

destroy(callbackopt) → {Promise|Endpoint}

Releases an Endpoint and associated resources

Source:
Parameters:
Name Type Attributes Description
callback Endpoint~operationsCallback <optional>

callback function invoked after endpoint has been released

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

execute(app, argsopt, cb)

execute a freeswitch application on the endpoint

Source:
Parameters:
Name Type Attributes Description
app string

application to execute

args string | Array <optional>

arguments

cb Endpoint~mediaOperationCallback

callback invoked when a CHANNEL_EXECUTE_COMPLETE is received for the application

execute(app, argopt, callbackopt) → {Promise|Endpoint}

execute a freeswitch application

Source:
Parameters:
Name Type Attributes Description
app string

application name

arg string <optional>

application arguments, if any

callback Endpoint~mediaOperationsCallback <optional>

callback function

Returns:
Type:
Promise | Endpoint

if no callback specified, a Promise that resolves with the response is returned otherwise a reference to the endpoint object

export(param, value, callbackopt) → {Promise}

export a parameter on the Endpoint

Source:
Parameters:
Name Type Attributes Description
param String | Object

parameter name or dictionary of param-value pairs

value String

parameter value

callback Endpoint~operationCallback <optional>

callback return results

Returns:
Type:
Promise

a promise is returned if no callback is supplied

getChannelVariables(includeMediaopt, callbackopt) → {Promise|Endpoint}

retrieve channel variables for the endpoint

Source:
Parameters:
Name Type Attributes Description
includeMedia boolean <optional>

if true, retrieve rtp counters (e.g. variable_rtp_audio_in_raw_bytes, etc)

callback Endpoint~getChannelVariablesCallback <optional>

callback function invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

join(conf, optsopt, callbackopt) → {Promise|Endpoint}

join an endpoint into a conference

Source:
Parameters:
Name Type Attributes Description
conf String | Conference

name of a conference or a Conference instance

opts Endpoint~confJoinOptions <optional>

options governing the connection between the endpoint and the conference

callback Endpoint~confJoinCallback <optional>

callback invoked when join operation is completed

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

modify(sdp, callbackopt)

modify the endpoint by changing attributes of the media connection

Source:
Parameters:
Name Type Attributes Description
sdp string

'hold', 'unhold', or a session description protocol

callback Endpoint~modifyCallback <optional>

callback invoked when operation has completed

play(file, cbopt) → {Promise|Endpoint}

play an audio file on the endpoint

Source:
Parameters:
Name Type Attributes Description
file string | Array

file (or array of files) to play

cb Endpoint~playOperationCallback <optional>

callback function invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

playCollect(opts, callbackopt) → {Promise|Endpoint}

play an audio file and collect digits

Source:
Parameters:
Name Type Attributes Description
opts Endpoint~playCollectOptions

playcollect options

callback Endpoint~playCollectOperationCallback <optional>

callback function invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

record(file, opts, callbackopt) → {Promise|Endpoint}

record to a file from the endpoint's input stream

Source:
Parameters:
Name Type Attributes Description
file string

file to record to

opts Endpoint~recordOptions

record command options

callback endpointRecordCallback <optional>

callback invoked with response to record command

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

say(text, opts, callbackopt) → {Promise|Endpoint}

Speak a phrase that requires grammar rules

Source:
Parameters:
Name Type Attributes Description
text string

phrase to speak

opts Endpoint~sayOptions

say command options

callback Endpoint~playOperationCallback <optional>

callback function invoked when operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

set(param, value, callbackopt) → {Promise}

set a parameter on the Endpoint

Source:
Parameters:
Name Type Attributes Description
param String | Object

parameter name or dictionary of param-value pairs

value String

parameter value

callback Endpoint~operationCallback <optional>

callback return results

Returns:
Type:
Promise

a promise is returned if no callback is supplied

transfer(newConf, cbopt)

transfer a member to a new conference

Source:
Parameters:
Name Type Attributes Description
newConf String

name of new conference to transfer to

cb ConferenceConnection~mediaOperationsCallback <optional>

callback invoked when transfer has completed

unbridge(callbackopt) → {Promise|Endpoint}

Park an endpoint that is currently bridged with another endpoint

Source:
Parameters:
Name Type Attributes Description
callback Endpoint~operationCallback <optional>

callback invoked when bridge operation completes

Returns:
Type:
Promise | Endpoint

returns a Promise if no callback supplied; otherwise a reference to the Endpoint object

Type Definitions

confJoinCallback(err, obj)

This callback provides the response to a join request.

Source:
Parameters:
Name Type Description
err Error

error returned from freeswitch, if any

obj Object

an object containing {memberId, conferenceUuid} properties

confJoinOptions

Options governing a join operation between an endpoint and a conference

Properties:
Properties
Name Type Attributes Default Description
pin string <optional>

entry pin for the conference

profile string <optional>
default

conference profile to use

flags Object <optional>

parameters governing the connection of the endpoint to the conference

Name Type Attributes Default Description
mute boolean <optional>
false

enter the conference muted

deaf boolean <optional>
false

enter the conference deaf'ed (can not hear)

muteDetect boolean <optional>
false

Play the mute_detect_sound when talking detected by this conferee while muted

distDtmf boolean <optional>
false

Send any DTMF from this member to all participants

moderator boolean <optional>
false

Flag member as a moderator

nomoh boolean <optional>
false

Disable music on hold when this member is the only member in the conference

endconf boolean <optional>
false

Ends conference when all members with this flag leave the conference after profile param endconf-grace-time has expired

mintwo boolean <optional>
false

End conference when it drops below 2 participants after a member enters with this flag

ghost boolean <optional>
false

Do not count member in conference tally

joinOnly boolean <optional>
false

Only allow joining a conference that already exists

positional boolean <optional>
false

Process this member for positional audio on stereo outputs

noPositional boolean <optional>
false

Do not process this member for positional audio on stereo outputs

joinVidFloor boolean <optional>
false

Locks member as the video floor holder

noMinimizeEncoding boolean <optional>

Bypass the video transcode minimizer and encode the video individually for this member

vmute boolean <optional>
false

Enter conference video muted

secondScreen boolean <optional>
false

Open a 'view only' connection to the conference, without impacting the conference count or data.

waitMod boolean <optional>
false

Members will wait (with music) until a member with the 'moderator' flag set enters the conference

audioAlways boolean <optional>
false

Do not use energy detection to choose which participants to mix; instead always mix audio from all members

videoBridgeFirstTwo boolean <optional>
false

In mux mode, If there are only 2 people in conference, you will see only the other member

videoMuxingPersonalCanvas boolean <optional>
false

In mux mode, each member will get their own canvas and they will not see themselves

videoRequiredForCanvas boolean <optional>
false

Only video participants will be shown on the canvas (no avatars)

Source:
Type:
  • Object

createCallback(error, ep)

This callback is invoked when an endpoint has been created and is ready for commands.

Source:
Parameters:
Name Type Description
error Error
ep Endpoint

the Endpoint

createOptions

Options governing the creation of an Endpoint

Properties:
Name Type Attributes Description
debugDir string <optional>

directory into which message trace files; the presence of this param will enable debug tracing

codecs string | array <optional>

preferred codecs; array order indicates order of preference

Source:
Type:
  • Object

destroyCallback(error,)

This callback is invoked when an endpoint has been destroyed / released.

Source:
Parameters:
Name Type Description
error, Error

if any

endpointOperationCallback(err)

This callback provides the response to a endpoint operation request of some kind.

Source:
Parameters:
Name Type Description
err Error

null if operation succeeds; otherwises provides an indication of the error

getChannelVariablesCallback(err, obj)

This callback is invoked when the response is received to a command executed on the endpoint

Source:
Parameters:
Name Type Description
err Error

error returned from freeswitch, if any

obj Object

an object with key-value pairs where the key is channel variable name and the value is the associated value

joinOperationCallback(err, conn)

This callback is invoked when a join operation between an Endpoint and a conference has completed

Source:
Parameters:
Name Type Description
err Error

error returned from join request

conn ConferenceConnection

object representing the connection of this participant to the conference

mediaOperationCallback(err, response)

This callback is invoked when the response is received to a command executed on the endpoint

Source:
Parameters:
Name Type Description
err Error

error returned from freeswitch, if any

response Object

response to the command

mediaOperationsCallback(err, results)

This callback is invoked when a freeswitch command has completed on the endpoint

Source:
Parameters:
Name Type Description
err Error

error returned from play request

results object

freeswitch results

modifyCallback(err)

This callback provides the response to a modifySession request.

Source:
Parameters:
Name Type Description
err Error

non-success sip response code received from far end

NetworkConnection

Information describing either the local or remote end of a connection to an Endpoint

Properties:
Name Type Description
sdp String

session description protocol offered

Source:
Type:
  • Object

operationCallback(err)

This callback is invoked when an operation has completed on the endpoint

Source:
Parameters:
Name Type Description
err Error

error returned from play request

playCollectOperationCallback(err, results)

This callback is invoked when a media operation has completed

Source:
Parameters:
Name Type Description
err Error

error returned from play request

results object

results of the operation

Name Type Description
digits String

digits collected, if any

terminatorUsed String

termination key pressed, if any

playbackSeconds String

number of seconds of audio played

playbackMilliseconds String

number of fractional milliseconds of audio played

playCollectOptions

Options governing a play command

Properties:
Name Type Attributes Default Description
file String

file to play as a prompt

min number <optional>
0

minimum number of digits to collect

max number <optional>
128

maximum number of digits to collect

tries number <optional>
1

number of times to prompt before returning failure

invalidFile String <optional>
silence_stream://250

file or prompt to play when invalid digits are entered

timeout number <optional>
120000

total timeout in millseconds to wait for digits after prompt completes

terminators String <optional>
#

one or more keys which, if pressed, will terminate digit collection and return collected digits

varName String <optional>
myDigitBuffer

name of freeswitch variable to use to collect digits

regexp String <optional>
\\d+

regular expression to use to govern digit collection

digitTimeout number <optional>
8000

inter-digit timeout, in milliseconds

Source:
Type:
  • Object

playOperationCallback(err, results)

This callback is invoked when a media operation has completed

Source:
Parameters:
Name Type Description
err Error

error returned from play request

results object

results of the operation

Name Type Description
playbackSeconds String

number of seconds of audio played

playbackMilliseconds String

number of fractional milliseconds of audio played

recordOptions

Options governing a record command

Properties:
Name Type Attributes Description
timeLimitSecs number <optional>

max duration of recording in seconds

silenceThresh number <optional>

energy levels below this are considered silence

silenceHits number <optional>

number of packets of silence after which to terminate the recording

Source:
Type:
  • Object

sayOptions

Options governing a say command

Properties:
Name Type Attributes Default Description
sayType String

describes the type word or phrase that is being spoken; must be one of the following: 'number', 'items', 'persons', 'messages', 'currency', 'time_measurement', 'current_date', 'current_time', 'current_date_time', 'telephone_number', 'telephone_extensio', 'url', 'ip_address', 'email_address', 'postal_address', 'account_number', 'name_spelled', 'name_phonetic', 'short_date_time'.

sayMethod String

method of speaking; must be one of the following: 'pronounced', 'iterated', 'counted'.

lang String <optional>
en

language to speak

gender String <optional>

gender of voice to use, if provided must be one of: 'feminine','masculine','neuter'.

Source:
Type:
  • Object

SipInfo

Information describing the SIP Dialog that established the Endpoint

Properties:
Name Type Description
callId String

SIP Call-ID

Source:
Type:
  • Object

Events

destroy

destroy event triggered when the Endpoint is destroyed by the media server.

Source: