Class Context
java.lang.Object
com.bytedesk.call.esl.client.internal.Context
- All Implemented Interfaces:
IModEslApi
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.bytedesk.call.esl.client.internal.IModEslApi
IModEslApi.EventFormat, IModEslApi.LoggingLevel -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final io.netty.channel.Channelprivate final AbstractEslClientHandler -
Constructor Summary
ConstructorsConstructorDescriptionContext(io.netty.channel.Channel channel, AbstractEslClientHandler clientHandler) -
Method Summary
Modifier and TypeMethodDescriptionaddEventFilter(String eventHeader, String valueToFilter) Add an event filter to the current set of event filters on this connection.Cancel any existing event subscription.Disable any logging previously enabled with setLogLevel().booleancanSend()voiddeleteEventFilter(String eventHeader, String valueToFilter) Delete an event filter from the current set of event filters on this connection.sendApiCommand(String command, String arg) Sends a FreeSWITCH API command to the server and blocks, waiting for an immediate response from the server.sendBackgroundApiCommand(String command, String arg) Submit a FreeSWITCH API command to the server to be executed in background mode.sendCommand(String command) Sends a mod_event_socket command to FreeSWITCH server and blocks, waiting for an immediate response from the server.sendMessage(SendMsg sendMsg) Send aSendMsgcommand to FreeSWITCH.setEventSubscriptions(IModEslApi.EventFormat format, String events) Set the current event subscription for this connection to the server.Enable log output.
-
Field Details
-
handler
-
channel
private final io.netty.channel.Channel channel
-
-
Constructor Details
-
Context
-
-
Method Details
-
canSend
public boolean canSend()- Specified by:
canSendin interfaceIModEslApi
-
sendCommand
Sends a mod_event_socket command to FreeSWITCH server and blocks, waiting for an immediate response from the server. The outcome of the command from the server is returned in anEslMessageobject.- Parameters:
command- a mod_event_socket command to send- Returns:
- an
EslMessagecontaining command results
-
sendApiCommand
Sends a FreeSWITCH API command to the server and blocks, waiting for an immediate response from the server. The outcome of the command from the server is returned in anEslMessageobject.- Specified by:
sendApiCommandin interfaceIModEslApi- Parameters:
command- API command to sendarg- command arguments- Returns:
- an
EslMessagecontaining command results
-
sendBackgroundApiCommand
Submit a FreeSWITCH API command to the server to be executed in background mode. A synchronous response from the server provides a UUID to identify the job execution results. When the server has completed the job execution it fires a BACKGROUND_JOB Event with the execution results. Note that this Client must be subscribed in the normal way to BACKGROUND_JOB Events, in order to receive this event.- Specified by:
sendBackgroundApiCommandin interfaceIModEslApi- Parameters:
command- API command to sendarg- command arguments- Returns:
- String Job-UUID that the server will tag result event with.
-
setEventSubscriptions
Set the current event subscription for this connection to the server. Examples of the events argument are:ALL CHANNEL_CREATE CHANNEL_DESTROY HEARTBEAT CUSTOM conference::maintenance CHANNEL_CREATE CHANNEL_DESTROY CUSTOM conference::maintenance sofia::register sofia::expire
Subsequent calls to this method replaces any previous subscriptions that were set. Note: current implementation can only process 'plain' events.- Specified by:
setEventSubscriptionsin interfaceIModEslApi- Parameters:
format- can be { plain | xml }events- { all | space separated list of events }- Returns:
- a
CommandResponsewith the server's response.
-
cancelEventSubscriptions
Cancel any existing event subscription.- Specified by:
cancelEventSubscriptionsin interfaceIModEslApi- Returns:
- a
CommandResponsewith the server's response.
-
addEventFilter
Add an event filter to the current set of event filters on this connection. Any of the event headers can be used as a filter. Note that event filters follow 'filter-in' semantics. That is, when a filter is applied only the filtered values will be received. Multiple filters can be added to the current connection. Example filters:eventHeader valueToFilter ---------------------------------- Event-Name CHANNEL_EXECUTE Channel-State CS_NEW- Specified by:
addEventFilterin interfaceIModEslApi- Parameters:
eventHeader- to filter onvalueToFilter- the value to match- Returns:
- a
CommandResponsewith the server's response.
-
deleteEventFilter
Delete an event filter from the current set of event filters on this connection. See- Specified by:
deleteEventFilterin interfaceIModEslApi- Parameters:
eventHeader- to removevalueToFilter- to remove- Returns:
- a
CommandResponsewith the server's response.
-
sendMessage
Send aSendMsgcommand to FreeSWITCH. This client requires that theSendMsghas a call UUID parameter.- Specified by:
sendMessagein interfaceIModEslApi- Parameters:
sendMsg- aSendMsgwith call UUID- Returns:
- a
CommandResponsewith the server's response.
-
setLoggingLevel
Enable log output.- Specified by:
setLoggingLevelin interfaceIModEslApi- Parameters:
level- using the same values as in console.conf- Returns:
- a
CommandResponsewith the server's response.
-
cancelLogging
Disable any logging previously enabled with setLogLevel().- Specified by:
cancelLoggingin interfaceIModEslApi- Returns:
- a
CommandResponsewith the server's response.
-
closeChannel
public void closeChannel()
-