Constructor
new MediaServer(conn, mrf, app, listenPort)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
conn |
esl.Connection
|
inbound connection to freeswitch event socket |
mrf |
Mrf
|
media resource function that instantiated this MediaServer |
app |
object
|
drachtio app |
listenPort |
number
|
tcp port to listen on for outbound event socket connections |
Fires:
Members
cps :Number
current calls per second on the MediaServer
- Source:
Type:
-
Number
currentSessions :Number
current number of active Endpoints on the MediaServer
- Source:
Type:
-
Number
maxSessions :Number
maximum number of active Endpoints allowed on the MediaServer
- Source:
Type:
-
Number
sip :Object
sip addresses and ports that the mediaserver is listening on note that different addresses may be used for ipv4, ipv6, dtls, or udp connections
- Source:
Type:
-
Object
Methods
api(command, callbackopt) → {Promise|Mediaserver}
send a freeswitch API command to the server
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
command |
string
|
command to execute |
|
callback |
MediaServer~apiCallback
|
<optional> |
optional callback that returns api response |
Returns:
- Type:
-
Promise
|Mediaserver
returns a Promise if no callback supplied; otherwise a reference to the mediaserver object
connectCaller(req, res, optsopt, callback) → {Promise|Mediaserver}
connects an incoming call to the media server, producing both an Endpoint and a SIP Dialog upon success
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
req |
Object
|
drachtio request object for incoming call |
|
res |
Object
|
drachtio response object for incoming call |
|
opts |
MediaServer~EndpointOptions
|
<optional> |
options for creating endpoint and responding to caller |
callback |
MediaServer~connectCallerCallback
|
callback invoked on completion of operation |
Returns:
- Type:
-
Promise
|Mediaserver
returns a Promise if no callback supplied; otherwise a reference to the mediaserver object
connected()
returns true if the MediaServer is in the 'connected' state
- Source:
createConference(nameopt, optsopt, callbackopt) → {Promise|Mediaserver}
creates a conference on the media server.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String
|
<optional> |
conference name; if not supplied a unique name will be generated |
opts |
MediaServer~conferenceCreateOptions
|
<optional> |
conference-level configuration options |
callback |
MediaServer~createConferenceCallback
|
<optional> |
callback invoked when conference is created |
Returns:
- Type:
-
Promise
|Mediaserver
returns a Promise if no callback supplied; otherwise a reference to the mediaserver object
createEndpoint(optsopt, callbackopt) → {Promise|Mediaserver}
allocate an Endpoint on the MediaServer, optionally allocating a media session to stream to a remote far end SDP (session description protocol). If no far end SDP is provided, the endpoint is initially created in the inactive state.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
opts |
MediaServer~EndpointOptions
|
<optional> |
create options |
callback |
MediaServer~createEndpointCallback
|
<optional> |
callback that provides error or Endpoint |
Returns:
- Type:
-
Promise
|Mediaserver
returns a Promise if no callback supplied; otherwise a reference to the mediaserver object
hasCapability(a) → {Boolean}
check if the media server has a specific capability
- Source:
Parameters:
Name | Type | Description |
---|---|---|
a |
string
|
named capability - ipv6, ipv4, dtls, or udp |
Returns:
- Type:
-
Boolean
true if the media server supports this capability
Type Definitions
conferenceCreateOptions
Options governing the creation of a conference
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 |
---|---|---|---|---|
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
connectCallerCallback(err, ep, dialog)
This callback provides the response to an attempt connect a caller to the MediaServer.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
err |
Error
|
error encountered while attempting to create the endpoint |
ep |
Endpoint
|
endpoint that was created |
dialog |
Dialog
|
sip dialog that was created |
createConferenceCallback(error, conference)
This callback provides the response to an attempt to create a Conference on the MediaServer.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
error |
Error
|
encountered while attempting to create the conference |
conference |
Conference
|
that was created |
createEndpointCallback(error, endpoint)
This callback provides the response to an attempt to create an Endpoint on the MediaServer.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
error |
Error
|
encountered while attempting to create the endpoint |
endpoint |
Endpoint
|
that was created |
EndpointOptions
Arguments provided when creating an Endpoint on a MediaServer
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
remoteSdp |
String
|
<optional> |
remote session description protocol (if not provided, an initially inactive Endpoint will be created) |
codecs |
Array.<String>
|
<optional> |
array of codecs, in preferred order (e.g. ['PCMU','G722','PCMA']) |
- Source:
Type:
-
Object
Events
connect
connect event triggered when connection is made to the freeswitch media server.
- Source:
error
Error event triggered when connection to freeswitch media server fails.
Properties:
Name | Type | Description |
---|---|---|
message |
String
|
Indicates the reason the connection failed |
- Source:
Type:
-
object
ready
ready event triggered after connecting to the server and verifying it is properly configured and ready to accept calls.
- Source: