interface.html

来自「Intercom 是一个 Unix系统上灵活的语音传输软件。支持标准音频压缩比如」· HTML 代码 · 共 312 行

HTML
312
字号
<HTML><HEAD><TITLE>Interfacing With Intercom</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.77+"><LINKREL="HOME"TITLE="Intercom"HREF="intercom.html"><LINKREL="PREVIOUS"TITLE="Command Aliases"HREF="customize-alias.html"><LINKREL="NEXT"TITLE="Executing external programs"HREF="interface-exec.html"></HEAD><BODYCLASS="CHAPTER"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Intercom: Version 0.15 Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="customize-alias.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="interface-exec.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="INTERFACE"></A>Chapter 5. Interfacing With Intercom</H1><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><AHREF="interface.html#INTERFACE-HOOKS">Introduction to Hooks</A></DT><DT><AHREF="interface-exec.html">Executing external programs</A></DT><DT><AHREF="interface-if.html">Conditionals</A></DT><DT><AHREF="interface-final.html">Putting it all Together</A></DT></DL></DIV><P>This chapter is for those who wish to extend Intercom in ways forwhich it was not necessarily designed.  In order to get the most from thischapter, you will want some experience with a programming or scriptinglanguage such as bash, PERL, or C.  Any language should do as Intercom'scallouts are general.</P><P>Intercom provides a way by which a shell command can decide whatIntercom should do on a certain event.  This allows the user to do things assimple as playing a sound when an Incoming call comes in or as complex asimplementing time restrictions and blacklists.  This chapter describes thesemethods and includes examples whenever possible.</P><DIVCLASS="NOTE"><P></P><TABLECLASS="NOTE"WIDTH="100%"BORDER="0"><TR><TDWIDTH="25"ALIGN="CENTER"VALIGN="TOP"><IMGSRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/note.gif"HSPACE="5"ALT="Note"></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The implementation should be fairly easy for any shellprogrammer to understand; however, I am a programmer and not a technicalwriter.  If something is unclear, do not hesitate to contactme.</P></TD></TR></TABLE></DIV><DIVCLASS="SECTION"><H1CLASS="SECTION"><ANAME="INTERFACE-HOOKS"></A>Introduction to Hooks</H1><P>Intercom can execute a given command when a certain event occurs.  Bycommand, I refer to an Intercom command and not a Unix shell command.  Hooksare administered through the <BCLASS="COMMAND">hook</B> command and areautomatically saved with the <BCLASS="COMMAND">save</B> command.</P><P>To add a command-hook, you pass the event type and the command toexecute to the <BCLASS="COMMAND">hook add</B> command.  The command you specifywill be executed whenever that particular event is triggered.  The currentlydefined event types are as follows.</P><P></P><UL><LI><P>call_incoming - Triggered on an Incoming call.  At the pointof the trigger, Intercom is ready to either accept or reject the call unlessa previous hook of this type has changed the state</P></LI><LI><P>call_outgoing - Triggered when an outgoing call is placed. The event is triggered after a connection to the remote host has succeededbut before the call is actually answered or rejected by the calledparty.</P></LI><LI><P>call_connect - Triggered just as a call is connected.  Thisevent is triggered both when we are the caller or the callrecipient.</P></LI><LI><P>hangup_lc - Event which is triggered when our end terminatedan established call.</P></LI><LI><P>hangup_rmt - Triggered when the remote party hasdisconnected a call.</P></LI></UL><DIVCLASS="NOTE"><P></P><TABLECLASS="NOTE"WIDTH="100%"BORDER="0"><TR><TDWIDTH="25"ALIGN="CENTER"VALIGN="TOP"><IMGSRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/note.gif"HSPACE="5"ALT="Note"></TD><TDALIGN="LEFT"VALIGN="TOP"><P>You can have more than one hook for an event type.  Hooks areexecuted in the order in which they were added.</P></TD></TR></TABLE></DIV><P>As a simple example of a hook, we can automatically answer incomingcalls unconditionally with the following command.</P><P><TTCLASS="PROMPT">intercom: </TT><BCLASS="COMMAND">hook add call_incoming answer</B></P><P>Or, to reject all incoming calls, execute the followingcommand.</P><P><TTCLASS="PROMPT">intercom: </TT><BCLASS="COMMAND">hook add call_incoming hangup</B></P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="customize-alias.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="intercom.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="interface-exec.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Command Aliases</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top">&nbsp;</TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Executing external programs</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?