public class ManagerConnectionFactory extends Object
ManagerConnection
s.
It creates new connections in state
ManagerConnectionState.INITIAL
. Before
you can start using such a connection (i.e. sending
ManagerAction
s you must
ManagerConnection.login()
to change its state
to ManagerConnectionState.CONNECTED
.
Example:
ManagerConnectionFactory factory; ManagerConnection connection; factory = new ManagerConnectionFactory("localhost", "manager", "secret"); connection = factory.createManagerConnection(); connection.login(); ... connection.logoff();If want you can use the factory to create multiple connections to the same server by calling
createManagerConnection()
multiple times.ManagerConnection
Constructor and Description |
---|
ManagerConnectionFactory(String hostname,
int port,
String username,
String password)
Creates a new ManagerConnectionFactory with the given connection data.
|
ManagerConnectionFactory(String hostname,
String username,
String password)
Creates a new ManagerConnectionFactory with the given connection data and
the default port 5038.
|
Modifier and Type | Method and Description |
---|---|
ManagerConnection |
createManagerConnection()
Returns a new ManagerConnection in state
ManagerConnectionState.CONNECTED . |
ManagerConnection |
createSecureManagerConnection()
Returns a new SSL secured ManagerConnection in state
ManagerConnectionState.CONNECTED . |
public ManagerConnectionFactory(String hostname, String username, String password)
hostname
- the hostname of the Asterisk server to connect to.username
- the username to use for login as defined in Asterisk's manager.conf
.password
- the password to use for login as defined in Asterisk's manager.conf
.public ManagerConnectionFactory(String hostname, int port, String username, String password)
hostname
- the hostname of the Asterisk server to connect to.port
- the port where Asterisk listens for incoming Manager API
connections, usually 5038.username
- the username to use for login as defined in Asterisk's manager.conf
.password
- the password to use for login as defined in Asterisk's manager.conf
.public ManagerConnection createManagerConnection()
ManagerConnectionState.CONNECTED
.public ManagerConnection createSecureManagerConnection()
ManagerConnectionState.CONNECTED
.Copyright © 2004–2020. All rights reserved.