[Asterisk-doc] docs extensions.xml,1.25,1.26

websmith asterisk-doc@lists.digium.com
Mon, 19 Jul 2004 12:47:17 +0000


Comments:
Update of /cvsroot/asterisk/docs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21962

Modified Files:
	extensions.xml 
Log Message:
More work on the first two examples in this chapter.
Index: extensions.xml
===================================================================
RCS file: /cvsroot/asterisk/docs/extensions.xml,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** extensions.xml	19 Jul 2004 01:38:22 -0000	1.25
--- extensions.xml	19 Jul 2004 12:47:12 -0000	1.26
***************
*** 347,372 ****
  			<function>Goto()</function> functions. These two functions will
  			allows us to create more functional dialplan.
  			In this example, let's assume we've been asked by a local movie
! 			theater to create a system where callers can dial in and listen
! 			to pre-recorded movie listings.
  			</para>
- <!-- continue editing from here -->
- <!--
  			<para>
! 			[The key any IVR is the background() application.  it gives you the ability to 
! 			play a recorded sound file, but when the caller presses a key it interrupts the
! 			playback and goes to the corresponding extension]
  			</para>
! -->			
  			<informalexample>
  			<programlisting>
  			[incoming]
! 			exten=&gt;s,1,Answer()<lineannotation> ; Answer the line</lineannotation>
! 			exten=&gt;s,2,Background('current-movies')<lineannotation> ; Play back the 'current movies' sound file</lineannotation>
! 			exten=&gt;s,3,Hangup()<lineannotation> ; Now hangup the line if the caller doesn't press a key</lineannotation>
! 			exten=&gt;1,1,Playback('movie1')<lineannotation> ; Now hangup the line if the caller doesn't press a key</lineannotation>
! 			exten=&gt;1,2,Goto(incoming,s,1)<lineannotation> ; Now go back to the beginning</lineannotation>
! 			exten=&gt;2,1,Playback('movie2')<lineannotation> ; Now hangup the line if the caller doesn't press a key</lineannotation>
! 			exten=&gt;2,2,Goto(incoming,s,1)<lineannotation> ; Now go back to the beginning</lineannotation>
  			</programlisting>
  			</informalexample>
--- 347,404 ----
  			<function>Goto()</function> functions. These two functions will
  			allows us to create more functional dialplan.
+ 			</para>
+ 			<para>
+ 			The key to interactive Asterisk systems is the 
+ 			<function>Background()</function> application.  It gives you 
+ 			the ability to play a recorded sound file, but when the 
+ 			caller presses a key it interrupts the playback and goes to 
+ 			the extension that corresponds with what the caller dialed.
+ 			</para>
+ 			<para>
+ 			Another very useful application is called 
+ 			<function>GoTo()</function>.  As its name implies, it jumps 
+ 			from the current context, extension, and priority to the
+ 			specified context, extension, and priority.  The
+ 			<function>GoTo()</function> application makes it easy to 
+ 			programatically move between different parts of the dialplan.
+ 			The syntax for the <function>GoTo()</function> application calls
+ 			for us to pass the destination context, extension, and priority
+ 			as arguments to the application, like this:
+ 			<informalexample>
+ 			<programlisting>
+ 			exten=><emphasis>extension</emphasis>,<emphasis>priority</emphasis>,
+ 			Goto(<emphasis>context</emphasis>,<emphasis>extension</emphasis>,
+ 			<emphasis>priority</emphasis>)
+ 			</programlisting>
+ 			</informalexample>
+ 			</para>
+ 			<para>
  			In this example, let's assume we've been asked by a local movie
! 			theater to create an interactive system where callers can dial 
! 			in and listen to pre-recorded movie listings.  To make this 
! 			example simple, we'll say that the movie theater only has two
! 			screens.  
  			</para>
  			<para>
! 			We'll also assume that we have three pre-recorded sound files.
! 			The first, called <filename>current-moves.gsm</filename>, says
! 			"Welcome to our movie theater.  To hear what's playing on screen
! 			one, press one.  To hear what's playing on screen two, press two."
! 			The other two sound files, named <filename>movie1.gsm</filename>
! 			and <filename>movie2.gsm</filename> respectively, tell the caller
! 			the information about the movie playing on that particular screen.
  			</para>
! <!-- continue editing from here -->
! 			
  			<informalexample>
  			<programlisting>
  			[incoming]
! 			exten=&gt;s,1,Answer()<!--<lineannotation> ; Answer the line</lineannotation>-->
! 			exten=&gt;s,2,Background('current-movies')<!--<lineannotation> ; Play back the 'current movies' sound file</lineannotation>-->
! 			exten=&gt;s,3,Hangup()<!-- <lineannotation> ; Now hangup the line if the caller doesn't press a key</lineannotation>-->
! 			exten=&gt;1,1,Playback('movie1')<!--<lineannotation> ; Now hangup the line if the caller doesn't press a key</lineannotation>-->
! 			exten=&gt;1,2,Goto(incoming,s,1)<!--<lineannotation> ; Now go back to the beginning</lineannotation>-->
! 			exten=&gt;2,1,Playback('movie2')<!--<lineannotation> ; Now hangup the line if the caller doesn't press a key</lineannotation>-->
! 			exten=&gt;2,2,Goto(incoming,s,1)<!--<lineannotation> ; Now go back to the beginning</lineannotation>-->
  			</programlisting>
  			</informalexample>
***************
*** 389,422 ****
  -->
  			<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 the movie is playing at.  When the user
! 			presses 1, they will hear the times of the movie playing in theatre 1.  Pressing 2
! 			will retrieve the times for the other movie.
! 			</para>
! 
! 			<para>
! 			Lets step through our example very carefully.  Again we start each line with
! 			exten =&gt;.  When the call comes in, it is going to execute the 's' extension
! 			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 <filename>current-movies</filename> 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 
--- 421,446 ----
  -->
  			<para>
! 			Lets step through our example very carefully.  When the call enters the 
! 			system, Asterisk executes the 's' extension automatically, starting 
! 			with priority one.  You may notice that the 's' extesion looks almost
! 			identical to our first example.  The difference is the use of
! 			the <function>Background()</function> function instead of the
! 			<function>Playback()</function>.  With <function>Background()</function>
! 			we are able to accept digits from the caller while the sound file
! 			is being played.  While the <filename>current-movies.gsm</filename> 
! 			file is being played to the caller, lets say the user presses 
! 			<keycap>1</keycap>.  Asterisk will then look for an extension in our 
! 			current context that matches it.  When Asterisk finds the '1' 
! 			extension, it will execute all the priorities for that extension.
  			</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 details 
! 			for screen one.  After the file finishes playing, it will execute 
! 			the second priority, which is a call to the <function>Goto()</function> 
! 			application.  This sends the caller 
  			<function>Goto()</function> allows us to send the caller anywhere in our
  			dialplan.  The format for <function>Goto()</function> is