📄 asteriskchannel.html
字号:
<PRE>void <B>redirectBothLegs</B>(java.lang.String context, java.lang.String exten, int priority) throws <A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A>, <A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></PRE><DL><DD>Redirects this channel and the channel this channel is linked to to a new extension. <p> If this channel is not linked to another channel only this channel is redirected.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>context</CODE> - the destination context.<DD><CODE>exten</CODE> - the destination extension.<DD><CODE>priority</CODE> - the destination priority.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A></CODE> - if the redirect action cannot be sent to Asterisk.<DD><CODE><A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></CODE> - if this channel had been hung up before the redirect was sent.<DT><B>Since:</B></DT> <DD>0.3</DD></DL></DD></DL><HR><A NAME="getVariable(java.lang.String)"><!-- --></A><H3>getVariable</H3><PRE>java.lang.String <B>getVariable</B>(java.lang.String variable) throws <A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A>, <A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></PRE><DL><DD>Returns the value of the given channel variable. <p> Currently Asterisk does not support the retrieval of built-in variables like EXTEN or CALLERIDNUM but only custom variables set via Asterisk's Set command or via <A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#setVariable(java.lang.String, java.lang.String)"><CODE>setVariable(String, String)</CODE></A>.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>variable</CODE> - the name of the channel variable to return.<DT><B>Returns:</B><DD>the value of the channel variable or <code>null</code> if it is not set.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A></CODE> - if the get variable action cannot be sent to Asterisk.<DD><CODE><A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></CODE> - if this channel had been hung up before the variable was requested.<DT><B>Since:</B></DT> <DD>0.3</DD></DL></DD></DL><HR><A NAME="setVariable(java.lang.String, java.lang.String)"><!-- --></A><H3>setVariable</H3><PRE>void <B>setVariable</B>(java.lang.String variable, java.lang.String value) throws <A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A>, <A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></PRE><DL><DD>Sets the value of the given channel variable.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>variable</CODE> - the name of the channel variable to set.<DD><CODE>value</CODE> - the value of the channel variable to set.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A></CODE> - if the set variable action cannot be sent to Asterisk.<DD><CODE><A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></CODE> - if this channel had been hung up before the variable was set.<DT><B>Since:</B></DT> <DD>0.3</DD></DL></DD></DL><HR><A NAME="playDtmf(java.lang.String)"><!-- --></A><H3>playDtmf</H3><PRE>void <B>playDtmf</B>(java.lang.String digit) throws <A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A>, <A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A>, java.lang.IllegalArgumentException</PRE><DL><DD>Plays the given DTMF digit on this channel. <p> Available since Asterisk 1.2.8<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>digit</CODE> - the DTMF digit to play.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A></CODE> - if the play DTMF action cannot be sent to Asterisk.<DD><CODE><A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></CODE> - if this channel had been hung up before the DTMF digit was set.<DD><CODE>java.lang.IllegalArgumentException</CODE> - if the digit is <code>null</code>.<DT><B>Since:</B></DT> <DD>0.3</DD></DL></DD></DL><HR><A NAME="startMonitoring(java.lang.String)"><!-- --></A><H3>startMonitoring</H3><PRE>void <B>startMonitoring</B>(java.lang.String filename) throws <A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A>, <A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></PRE><DL><DD>Starts monitoring (recording) this channel. <p> The format of the files is "wav", they are not mixed. <p> The files are called <i>filename</i>-in.wav and <i>filename</i>-out.wav.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>filename</CODE> - the basename of the files created in the monitor spool directory. If <code>null</code> the channel name (with slashed replaced by dashes) is used.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A></CODE> - if the monitor action cannot be sent to Asterisk.<DD><CODE><A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></CODE> - if this channel had been hung up before starting monitoring.<DT><B>Since:</B></DT> <DD>0.3</DD><DT><B>See Also:</B><DD><A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#stopMonitoring()"><CODE>stopMonitoring()</CODE></A>, <A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#pauseMonitoring()"><CODE>pauseMonitoring()</CODE></A></DL></DD></DL><HR><A NAME="startMonitoring(java.lang.String, java.lang.String)"><!-- --></A><H3>startMonitoring</H3><PRE>void <B>startMonitoring</B>(java.lang.String filename, java.lang.String format) throws <A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A>, <A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></PRE><DL><DD>Starts monitoring (recording) this channel using the given audio format. <p> The files are not mixed. <p> The files are called <i>filename</i>-in.<i>format</i> and <i>filename</i>-out.<i>format</i>.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>filename</CODE> - the basename of the files created in the monitor spool directory. If <code>null</code> the channel name (with slashed replaced by dashes) is used.<DD><CODE>format</CODE> - the audio recording format. If <code>null</code> wav is used.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A></CODE> - if the monitor action cannot be sent to Asterisk.<DD><CODE><A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></CODE> - if this channel had been hung up before starting monitoring.<DT><B>Since:</B></DT> <DD>0.3</DD><DT><B>See Also:</B><DD><A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#stopMonitoring()"><CODE>stopMonitoring()</CODE></A>, <A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#pauseMonitoring()"><CODE>pauseMonitoring()</CODE></A></DL></DD></DL><HR><A NAME="startMonitoring(java.lang.String, java.lang.String, boolean)"><!-- --></A><H3>startMonitoring</H3><PRE>void <B>startMonitoring</B>(java.lang.String filename, java.lang.String format, boolean mix) throws <A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A>, <A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></PRE><DL><DD>Starts monitoring (recording) this channel using the given audio format and optionally mixing input and output data after recording is finished. <p> Mixing is done by soxmix by default (which has to be installed on your Asterisk server). You can use your own script by setting the variable <code>MONITOR_EXEC</code> to your custom script before starting monitoring the channel. Your script is then called with 3 arguments, the two leg files and a target mixed file name which is the same as the leg file names without the in/out designator, i.e. <i>filename</i>.<i>format</i>.<br> The two leg files are only removed by Asterisk if <code>MONITOR_EXEC</code> is not set. If you use a custom script and want to remove them, just let your script do this.<br> To pass additional arguments to your script you can set the variable <code>MONITOR_EXEC_ARGS</code> to a list of arguments (separated by spaces). <p> Example: <pre> AsteriskChannel c; [...] c.setVariable(AsteriskChannel.VARIABLE_MONITOR_EXEC, "/usr/local/bin/2wav2mp3"); c.startMonitoring("my-recording", "wav", true); </pre> Side note: <tt>2wav2mp3</tt> is a nice script by Dietmar Zlabinger to mix the two legs to a stero mp3 file, for details see <a href="http://www.voip-info.org/wiki/view/Monitor+stereo-example">voip-info.org</a>.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>filename</CODE> - the basename of the file(s) created in the monitor spool directory. If <code>null</code> the channel name (with slashed replaced by dashes) is used.<DD><CODE>format</CODE> - the audio recording format. If <code>null</code> wav is used.<DD><CODE>mix</CODE> - <code>true</code> to mix input and output data together after recording is finished, <code>false</code> to not mix them.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A></CODE> - if the monitor action cannot be sent to Asterisk.<DD><CODE><A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></CODE> - if this channel had been hung up before starting monitoring.<DT><B>Since:</B></DT> <DD>0.3</DD><DT><B>See Also:</B><DD><A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#VARIABLE_MONITOR_EXEC"><CODE>VARIABLE_MONITOR_EXEC</CODE></A>, <A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#VARIABLE_MONITOR_EXEC_ARGS"><CODE>VARIABLE_MONITOR_EXEC_ARGS</CODE></A>, <A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#stopMonitoring()"><CODE>stopMonitoring()</CODE></A>, <A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#pauseMonitoring()"><CODE>pauseMonitoring()</CODE></A></DL></DD></DL><HR><A NAME="changeMonitoring(java.lang.String)"><!-- --></A><H3>changeMonitoring</H3><PRE>void <B>changeMonitoring</B>(java.lang.String filename) throws <A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A>, <A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A>, java.lang.IllegalArgumentException</PRE><DL><DD>Changes the filename of a previously started monitoring. <p> If the channel exists but is not currently monitored your request is ignored and a warning message is written to Asterisk's CLI. <p> Use with care, this doesn't always seem to work.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>filename</CODE> - the basename of the file(s) created in the monitor spool directory.<DT><B>Throws:</B><DD><CODE><A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A></CODE> - if the change monitor action cannot be sent to Asterisk.<DD><CODE><A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></CODE> - if this channel had been hung up before changing monitoring.<DD><CODE>java.lang.IllegalArgumentException</CODE> - if filename is <code>null</code>.<DT><B>Since:</B></DT> <DD>0.3</DD><DT><B>See Also:</B><DD><A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#stopMonitoring()"><CODE>stopMonitoring()</CODE></A>, <A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#pauseMonitoring()"><CODE>pauseMonitoring()</CODE></A></DL></DD></DL><HR><A NAME="stopMonitoring()"><!-- --></A><H3>stopMonitoring</H3><PRE>void <B>stopMonitoring</B>() throws <A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A>, <A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></PRE><DL><DD>Stops monitoring this channel. <p> If the channel exists but is not currently monitored your request is ignored.<P><DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../org/asteriskjava/live/ManagerCommunicationException.html" title="class in org.asteriskjava.live">ManagerCommunicationException</A></CODE> - if the stop monitor action cannot be sent to Asterisk.<DD><CODE><A HREF="../../../org/asteriskjava/live/NoSuchChannelException.html" title="class in org.asteriskjava.live">NoSuchChannelException</A></CODE> - if this channel had been hung up before stopping monitoring.<DT><B>Since:</B></DT> <DD>0.3</DD><DT><B>See Also:</B><DD><A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#startMonitoring(java.lang.String)"><CODE>startMonitoring(String)</CODE></A>, <A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#startMonitoring(java.lang.String, java.lang.String)"><CODE>startMonitoring(String, String)</CODE></A>, <A HREF="../../../org/asteriskjava/live/AsteriskChannel.html#startMonitoring(java.lang.String, java.lang.String, boolean)"><CODE>startMonitoring(String, String, boolean)</CODE></A></DL></DD></DL><HR><A NAME="pauseMonitoring()"><!-- --></A><H3>pauseMonitoring</H3><PRE>voi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -