Location: PHPKode > scripts > PHP AGI > phpagi-2.20/api-docs/__examplesource/exsource__home_phpagi_devel_phpagi_examples_dtmf.php_eb30ab5fd2d98b4b41f251416fc7ed37.html
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Get DTMF tones from the user and say the digits</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
						<h1>Get DTMF tones from the user and say the digits</h1>
<div class="listing">
<div class="src-code"><ol><li><div class="src-line">#!/usr/local/bin/php&nbsp;-q</div></li>
<li><div class="src-line"><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;<a href="http://www.php.net/set_time_limit">set_time_limit</a><span class="src-sym">(</span><span class="src-num">30</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;require<span class="src-sym">(</span><span class="src-str">'phpagi.php'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;<a href="http://www.php.net/error_reporting">error_reporting</a><span class="src-sym">(</span><span class="src-id">E_ALL</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-var">$agi&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../phpAGI/AGI.html">AGI</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-var">$agi</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI.html#methodanswer">answer</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-var">$cid&nbsp;</span>=&nbsp;<span class="src-var">$agi</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI.html#methodparse_callerid">parse_callerid</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-var">$agi</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI.html#methodtext2wav">text2wav</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">Hello,&nbsp;{<span class="src-var">$cid</span><span class="src-sym">[</span><span class="src-str">'name'</span><span class="src-sym">]</span><span class="src-sym">}</span>.</span><span class="src-str">&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;do</div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$agi</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI.html#methodtext2wav">text2wav</a><span class="src-sym">(</span><span class="src-str">'Enter&nbsp;some&nbsp;numbers&nbsp;and&nbsp;then&nbsp;press&nbsp;the&nbsp;pound&nbsp;key.&nbsp;Press&nbsp;1&nbsp;1&nbsp;1&nbsp;followed&nbsp;by&nbsp;the&nbsp;pound&nbsp;key&nbsp;to&nbsp;quit.'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$result&nbsp;</span>=&nbsp;<span class="src-var">$agi</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI.html#methodget_data">get_data</a><span class="src-sym">(</span><span class="src-str">'beep'</span><span class="src-sym">,&nbsp;</span><span class="src-num">3000</span><span class="src-sym">,&nbsp;</span><span class="src-num">20</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$keys&nbsp;</span>=&nbsp;<span class="src-var">$result</span><span class="src-sym">[</span><span class="src-str">'result'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$agi</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI.html#methodtext2wav">text2wav</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">You&nbsp;entered&nbsp;<span class="src-var">$keys</span></span><span class="src-str">&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">while</span><span class="src-sym">(</span><span class="src-var">$keys&nbsp;</span>!=&nbsp;<span class="src-str">'111'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-var">$agi</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI.html#methodtext2wav">text2wav</a><span class="src-sym">(</span><span class="src-str">'Goodbye'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;<span class="src-var">$agi</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI.html#methodhangup">hangup</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><span class="src-php">?&gt;</span></div></li>
</ol></div>
</div>
	<p class="notes" id="credit">
		Documentation generated on Thu, 30 Sep 2010 02:22:03 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.2</a>
	</p>
	</body>
</html>
Return current item: PHP AGI