📄 defaultmanagerconnection.html
字号:
<DL><DD>Creates a new instance.<P></DL><HR><A NAME="DefaultManagerConnection(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>DefaultManagerConnection</H3><PRE>public <B>DefaultManagerConnection</B>(java.lang.String hostname, java.lang.String username, java.lang.String password)</PRE><DL><DD>Creates a new instance with the given connection parameters using Asterisk's default port.<P><DL><DT><B>Parameters:</B><DD><CODE>hostname</CODE> - the hostname of the Asterisk server to connect to.<DD><CODE>username</CODE> - the username to use for login<DD><CODE>password</CODE> - the password to use for login</DL></DL><HR><A NAME="DefaultManagerConnection(java.lang.String, int, java.lang.String, java.lang.String)"><!-- --></A><H3>DefaultManagerConnection</H3><PRE>public <B>DefaultManagerConnection</B>(java.lang.String hostname, int port, java.lang.String username, java.lang.String password)</PRE><DL><DD>Creates a new instance with the given connection parameters.<P><DL><DT><B>Parameters:</B><DD><CODE>hostname</CODE> - the hostname of the Asterisk server to connect to.<DD><CODE>port</CODE> - the port where Asterisk listens for incoming Manager API connections, usually 5038.<DD><CODE>username</CODE> - the username to use for login<DD><CODE>password</CODE> - the password to use for login</DL></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="setHostname(java.lang.String)"><!-- --></A><H3>setHostname</H3><PRE>public void <B>setHostname</B>(java.lang.String hostname)</PRE><DL><DD>Sets the hostname of the Asterisk server to connect to. <p> Default is <code>localhost</code>.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>hostname</CODE> - the hostname to connect to</DL></DD></DL><HR><A NAME="setPort(int)"><!-- --></A><H3>setPort</H3><PRE>public void <B>setPort</B>(int port)</PRE><DL><DD>Sets the port to use to connect to the Asterisk server. This is the port specified in Asterisk's <code>manager.conf</code> file. <p> Default is 5038.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>port</CODE> - the port to connect to</DL></DD></DL><HR><A NAME="setSsl(boolean)"><!-- --></A><H3>setSsl</H3><PRE>public void <B>setSsl</B>(boolean ssl)</PRE><DL><DD>Sets whether to use SSL. <p> Default is false.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>ssl</CODE> - <code>true</code> to use SSL for the connection, <code>false</code> for a plain text connection.<DT><B>Since:</B></DT> <DD>0.3</DD></DL></DD></DL><HR><A NAME="setUsername(java.lang.String)"><!-- --></A><H3>setUsername</H3><PRE>public void <B>setUsername</B>(java.lang.String username)</PRE><DL><DD>Sets the username to use to connect to the Asterisk server. This is the username specified in Asterisk's <code>manager.conf</code> file.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>username</CODE> - the username to use for login</DL></DD></DL><HR><A NAME="setPassword(java.lang.String)"><!-- --></A><H3>setPassword</H3><PRE>public void <B>setPassword</B>(java.lang.String password)</PRE><DL><DD>Sets the password to use to connect to the Asterisk server. This is the password specified in Asterisk's <code>manager.conf</code> file.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>password</CODE> - the password to use for login</DL></DD></DL><HR><A NAME="setDefaultTimeout(long)"><!-- --></A><H3>setDefaultTimeout</H3><PRE>public void <B>setDefaultTimeout</B>(long defaultTimeout)</PRE><DL><DD><B>Deprecated.</B> <I>use <A HREF="../../../org/asteriskjava/manager/DefaultManagerConnection.html#setDefaultResponseTimeout(long)"><CODE>setDefaultResponseTimeout(long)</CODE></A> instead</I><P><DD>Sets the time in milliseconds the synchronous sendAction methods <A HREF="../../../org/asteriskjava/manager/DefaultManagerConnection.html#sendAction(org.asteriskjava.manager.action.ManagerAction)"><CODE>sendAction(ManagerAction)</CODE></A> will wait for a response before throwing a TimeoutException. <p> Default is 2000.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>defaultTimeout</CODE> - default timeout in milliseconds</DL></DD></DL><HR><A NAME="setDefaultResponseTimeout(long)"><!-- --></A><H3>setDefaultResponseTimeout</H3><PRE>public void <B>setDefaultResponseTimeout</B>(long defaultResponseTimeout)</PRE><DL><DD>Sets the time in milliseconds the synchronous method <A HREF="../../../org/asteriskjava/manager/DefaultManagerConnection.html#sendAction(org.asteriskjava.manager.action.ManagerAction)"><CODE>sendAction(ManagerAction)</CODE></A> will wait for a response before throwing a TimeoutException. <p> Default is 2000.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>defaultResponseTimeout</CODE> - default response timeout in milliseconds<DT><B>Since:</B></DT> <DD>0.2</DD></DL></DD></DL><HR><A NAME="setDefaultEventTimeout(long)"><!-- --></A><H3>setDefaultEventTimeout</H3><PRE>public void <B>setDefaultEventTimeout</B>(long defaultEventTimeout)</PRE><DL><DD>Sets the time in milliseconds the synchronous method <A HREF="../../../org/asteriskjava/manager/DefaultManagerConnection.html#sendEventGeneratingAction(org.asteriskjava.manager.action.EventGeneratingAction)"><CODE>sendEventGeneratingAction(EventGeneratingAction)</CODE></A> will wait for a response and the last response event before throwing a TimeoutException. <p> Default is 5000.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>defaultEventTimeout</CODE> - default event timeout in milliseconds<DT><B>Since:</B></DT> <DD>0.2</DD></DL></DD></DL><HR><A NAME="setSleepTime(long)"><!-- --></A><H3>setSleepTime</H3><PRE>public void <B>setSleepTime</B>(long sleepTime)</PRE><DL><DD><B>Deprecated.</B> <I>no longer needed as we now use an interrupt based response checking approach.</I><P><DD>This method is deprecated and will be removed in Asterisk-Java 0.4. <p> It does nothing.<P><DD><DL></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="setKeepAliveAfterAuthenticationFailure(boolean)"><!-- --></A><H3>setKeepAliveAfterAuthenticationFailure</H3><PRE>public void <B>setKeepAliveAfterAuthenticationFailure</B>(boolean keepAliveAfterAuthenticationFailure)</PRE><DL><DD>Set to <code>true</code> to try reconnecting to ther asterisk serve even if the reconnection attempt threw an AuthenticationFailedException. <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -