[Asterisk-doc] docs extensions.xml,1.13,1.14
blitzrage
asterisk-doc@lists.digium.com
Wed, 26 May 2004 03:47:54 +0000
Comments:
Update of /cvsroot/asterisk/docs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27678/docs
Modified Files:
extensions.xml
Log Message:
blitzrage
- explain how our second, little more complex, example works. Explain how Background() and Goto() functions work.
Index: extensions.xml
===================================================================
RCS file: /cvsroot/asterisk/docs/extensions.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** extensions.xml 26 May 2004 02:57:13 -0000 1.13
--- extensions.xml 26 May 2004 03:47:37 -0000 1.14
***************
*** 297,300 ****
--- 297,305 ----
<function>Background()</function> and <function>Goto()</function> functions.]
</para>
+
+ <para>
+ Here we will build upon our first example and learn the <function>
+ Background()</function> and <function>Goto()</function> functions.
+ </para>
<informalexample>
***************
*** 326,329 ****
--- 331,380 ----
the movies, but that those will come shortly.]
</para>
+
+ <para>
+ Don't get too worried about the complexity of this example as we will go through
+ each line and explain what is going on. Let's imagine that you've been asked
+ to setup an Asterisk system for a small two-screen movie theatre. When you call
+ into the system you will hear an announcment which explains to press the number
+ of the theatre to listen to the times that movie is playing at. When the user
+ presses 1, they will hear the times of movie playing in theatre 1. Pressing 2
+ get the times for the other movie.
+ </para>
+
+ <para>
+ Lets step through our example very carefully. Again we start each line with the
+ exten =>. When the call comes in, it is going to execute the 's' extensions
+ automatically in numerical priority order. These three lines essencially perform
+ the very same functions from our first example. The difference is the use of
+ the <function>Background()</function> function. With <function>Background()</function>
+ we are able to accept a digit, or keypress, from the user while the sound file
+ is being played. While the current-movies file is being played to the user, lets
+ say the user presses 1. Asterisk will then look for an extension in our current
+ context for the matching number. When Asterisk finds the '1' extension, it will
+ perform all priorities for that extension in order. We won't go into detail at
+ this moment of how to actually record the details about the movies, but that will
+ come shortly.
+ </para>
+
+ <para>
+ Now that the user has pressed '1' Asterisk can perform both priorities for
+ extension 1, which end up being lines 4 and 5. The first priority for
+ extension 1 will use the <function>Playback()</function> function to play
+ the movie times to the caller. After the file finishes playing, it will
+ execute the second priority being the <function>Goto()</function> command.
+ <function>Goto()</function> allows us to send the caller anywhere in our
+ dialplan. The format for <function>Goto()</function> is
+ (context,extension,priority). In our example <command>
+ exten=>1,2,Goto(incoming,s,1)</command> we will send the user back to
+ the first priority of the 's' extension in our current context.
+ </para>
+
+ <para>
+ If the user doesn't press a key before the <function>Background()</function>
+ function finishes playing the file, the third priority of our 's' extension
+ will be performed, hanging up the user. This is perhaps not the best way
+ to answer the phone, but gives us some fundamentals and gets us thinking about
+ how we can move the user around our dialplan.
+ </para>
</sect2>