Location: PHPKode > scripts > PHP AGI > phpagi-2.20/api-docs/__filesource/fsource_phpAGI__phpagi-asmanager.php.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>File Source for phpagi-asmanager.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
						<h1>Source for file phpagi-asmanager.php</h1>
<p>Documentation is available at <a href="../phpAGI/_phpagi-asmanager.php.html">phpagi-asmanager.php</a></p>
<div class="src-code">
<div class="src-code"><ol><li><div class="src-line"><a name="a1"></a><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line"><a name="a2"></a>&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;phpagi-asmanager.php&nbsp;:&nbsp;PHP&nbsp;Asterisk&nbsp;Manager&nbsp;functions</span></div></li>
<li><div class="src-line"><a name="a4"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;Website:&nbsp;http://phpagi.sourceforge.net</span></div></li>
<li><div class="src-line"><a name="a5"></a><span class="src-doc">&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a6"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;$Id:&nbsp;phpagi-asmanager.php,v&nbsp;1.10&nbsp;2005/05/25&nbsp;18:43:48&nbsp;pinhole&nbsp;Exp&nbsp;$</span></div></li>
<li><div class="src-line"><a name="a7"></a><span class="src-doc">&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a8"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;Copyright&nbsp;(c)&nbsp;2004&nbsp;-&nbsp;2010&nbsp;Matthew&nbsp;Asham&nbsp;&lt;hide@address.com&gt;,&nbsp;David&nbsp;Eder&nbsp;&lt;hide@address.com&gt;&nbsp;and&nbsp;others</span></div></li>
<li><div class="src-line"><a name="a9"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;All&nbsp;Rights&nbsp;Reserved.</span></div></li>
<li><div class="src-line"><a name="a10"></a><span class="src-doc">&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a11"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;This&nbsp;software&nbsp;is&nbsp;released&nbsp;under&nbsp;the&nbsp;terms&nbsp;of&nbsp;the&nbsp;GNU&nbsp;Lesser&nbsp;General&nbsp;Public&nbsp;License&nbsp;v2.1</span></div></li>
<li><div class="src-line"><a name="a12"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;&nbsp;A&nbsp;copy&nbsp;of&nbsp;which&nbsp;is&nbsp;available&nbsp;from&nbsp;http://www.gnu.org/copyleft/lesser.html</span></div></li>
<li><div class="src-line"><a name="a13"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;</span></div></li>
<li><div class="src-line"><a name="a14"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;We&nbsp;would&nbsp;be&nbsp;happy&nbsp;to&nbsp;list&nbsp;your&nbsp;phpagi&nbsp;based&nbsp;application&nbsp;on&nbsp;the&nbsp;phpagi</span></div></li>
<li><div class="src-line"><a name="a15"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;website.&nbsp;&nbsp;Drop&nbsp;me&nbsp;an&nbsp;Email&nbsp;if&nbsp;you'd&nbsp;like&nbsp;us&nbsp;to&nbsp;list&nbsp;your&nbsp;program.</span></div></li>
<li><div class="src-line"><a name="a16"></a><span class="src-doc">&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a17"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@package</span><span class="src-doc">&nbsp;phpAGI</span></div></li>
<li><div class="src-line"><a name="a18"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@version</span><span class="src-doc">&nbsp;2.0</span></div></li>
<li><div class="src-line"><a name="a19"></a><span class="src-doc">&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a20"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a21"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a22"></a>&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a23"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;Written&nbsp;for&nbsp;PHP&nbsp;4.3.4,&nbsp;should&nbsp;work&nbsp;with&nbsp;older&nbsp;PHP&nbsp;4.x&nbsp;versions.</span></div></li>
<li><div class="src-line"><a name="a24"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;Please&nbsp;submit&nbsp;bug&nbsp;reports,&nbsp;patches,&nbsp;etc&nbsp;to&nbsp;http://sourceforge.net/projects/phpagi/</span></div></li>
<li><div class="src-line"><a name="a25"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;Gracias.&nbsp;:)</span></div></li>
<li><div class="src-line"><a name="a26"></a><span class="src-doc">&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a27"></a><span class="src-doc">&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a28"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a29"></a>&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/class_exists">class_exists</a><span class="src-sym">(</span><span class="src-str">'AGI'</span><span class="src-sym">))</span></div></li>
<li><div class="src-line"><a name="a30"></a>&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a31"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-inc">require_once</span><span class="src-sym">(</span><span class="src-id">dirname</span><span class="src-sym">(</span>__FILE__<span class="src-sym">)&nbsp;</span>.&nbsp;<span class="src-id">DIRECTORY_SEPARATOR&nbsp;</span>.&nbsp;<span class="src-str">'phpagi.php'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a32"></a>&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a33"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a34"></a>&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a35"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;Asterisk&nbsp;Manager&nbsp;class</span></div></li>
<li><div class="src-line"><a name="a36"></a><span class="src-doc">&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a37"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@link</span><span class="src-doc">&nbsp;http://www.voip-info.org/wiki-Asterisk+config+manager.conf</span></div></li>
<li><div class="src-line"><a name="a38"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@link</span><span class="src-doc">&nbsp;http://www.voip-info.org/wiki-Asterisk+manager+API</span></div></li>
<li><div class="src-line"><a name="a39"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@example</span><span class="src-doc">&nbsp;examples/sip_show_peer.php&nbsp;Get&nbsp;information&nbsp;about&nbsp;a&nbsp;sip&nbsp;peer</span></div></li>
<li><div class="src-line"><a name="a40"></a><span class="src-doc">&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@package</span><span class="src-doc">&nbsp;phpAGI</span></div></li>
<li><div class="src-line"><a name="a41"></a><span class="src-doc">&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a42"></a>&nbsp;&nbsp;<span class="src-key">class&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html">AGI_AsteriskManager</a></div></li>
<li><div class="src-line"><a name="a43"></a>&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a44"></a>&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a45"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Config&nbsp;variables</span></div></li>
<li><div class="src-line"><a name="a46"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a47"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">array&nbsp;</span></div></li>
<li><div class="src-line"><a name="a48"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@access</span><span class="src-doc">&nbsp;public</span></div></li>
<li><div class="src-line"><a name="a49"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a50"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">$config</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a51"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a52"></a>&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a53"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Socket</span></div></li>
<li><div class="src-line"><a name="a54"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a55"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@access</span><span class="src-doc">&nbsp;public</span></div></li>
<li><div class="src-line"><a name="a56"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a57"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$socket">$socket</a>&nbsp;=&nbsp;<span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a58"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a59"></a>&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a60"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Server&nbsp;we&nbsp;are&nbsp;connected&nbsp;to</span></div></li>
<li><div class="src-line"><a name="a61"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a62"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@access</span><span class="src-doc">&nbsp;public</span></div></li>
<li><div class="src-line"><a name="a63"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">string&nbsp;</span></div></li>
<li><div class="src-line"><a name="a64"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a65"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$server">$server</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a66"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a67"></a>&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a68"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Port&nbsp;on&nbsp;the&nbsp;server&nbsp;we&nbsp;are&nbsp;connected&nbsp;to</span></div></li>
<li><div class="src-line"><a name="a69"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a70"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@access</span><span class="src-doc">&nbsp;public</span></div></li>
<li><div class="src-line"><a name="a71"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">integer&nbsp;</span></div></li>
<li><div class="src-line"><a name="a72"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a73"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$port">$port</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a74"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a75"></a>&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a76"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Parent&nbsp;AGI</span></div></li>
<li><div class="src-line"><a name="a77"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a78"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@access</span><span class="src-doc">&nbsp;private</span></div></li>
<li><div class="src-line"><a name="a79"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">AGI&nbsp;</span></div></li>
<li><div class="src-line"><a name="a80"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a81"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$pagi">$pagi</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a82"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a83"></a>&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a84"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Event&nbsp;Handlers</span></div></li>
<li><div class="src-line"><a name="a85"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a86"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@access</span><span class="src-doc">&nbsp;private</span></div></li>
<li><div class="src-line"><a name="a87"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">array&nbsp;</span></div></li>
<li><div class="src-line"><a name="a88"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a89"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$event_handlers">$event_handlers</a><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a90"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a91"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a92"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Whether&nbsp;we're&nbsp;successfully&nbsp;logged&nbsp;in</span></div></li>
<li><div class="src-line"><a name="a93"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a94"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@access</span><span class="src-doc">&nbsp;private</span></div></li>
<li><div class="src-line"><a name="a95"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@var&nbsp;</span><span class="src-doc-type">boolean&nbsp;</span></div></li>
<li><div class="src-line"><a name="a96"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a97"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$_logged_in">$_logged_in</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a98"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a99"></a>&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a100"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Constructor</span></div></li>
<li><div class="src-line"><a name="a101"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a102"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc-var">$config&nbsp;</span><span class="src-doc">is&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;config&nbsp;file&nbsp;to&nbsp;parse&nbsp;or&nbsp;a&nbsp;parent&nbsp;agi&nbsp;from&nbsp;which&nbsp;to&nbsp;read&nbsp;the&nbsp;config</span></div></li>
<li><div class="src-line"><a name="a103"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc-var">$optconfig&nbsp;</span><span class="src-doc">is&nbsp;an&nbsp;array&nbsp;of&nbsp;configuration&nbsp;vars&nbsp;and&nbsp;vals,&nbsp;stuffed&nbsp;into&nbsp;$this-&gt;config['asmanager']</span></div></li>
<li><div class="src-line"><a name="a104"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a105"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodAGI_AsteriskManager">AGI_AsteriskManager</a><span class="src-sym">(</span><span class="src-var">$config</span>=<span class="src-id">NULL</span><span class="src-sym">,&nbsp;</span><span class="src-var">$optconfig</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></div></li>
<li><div class="src-line"><a name="a106"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a107"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;load&nbsp;config</span></div></li>
<li><div class="src-line"><a name="a108"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$config</span><span class="src-sym">)&nbsp;</span>&amp;&amp;&nbsp;<a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$config</span><span class="src-sym">))</span></div></li>
<li><div class="src-line"><a name="a109"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a>&nbsp;=&nbsp;<a href="http://www.php.net/parse_ini_file">parse_ini_file</a><span class="src-sym">(</span><span class="src-var">$config</span><span class="src-sym">,&nbsp;</span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a110"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif</span><span class="src-sym">(</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-id"><a href="../phpAGI/_phpagi.php.html#defineDEFAULT_PHPAGI_CONFIG">DEFAULT_PHPAGI_CONFIG</a></span><span class="src-sym">))</span></div></li>
<li><div class="src-line"><a name="a111"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a>&nbsp;=&nbsp;<a href="http://www.php.net/parse_ini_file">parse_ini_file</a><span class="src-sym">(</span><span class="src-id"><a href="../phpAGI/_phpagi.php.html#defineDEFAULT_PHPAGI_CONFIG">DEFAULT_PHPAGI_CONFIG</a></span><span class="src-sym">,&nbsp;</span><span class="src-id">true</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a112"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a113"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;If&nbsp;optconfig&nbsp;is&nbsp;specified,&nbsp;stuff&nbsp;vals&nbsp;and&nbsp;vars&nbsp;into&nbsp;'asmanager'&nbsp;config&nbsp;array.</span></div></li>
<li><div class="src-line"><a name="a114"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$optconfig&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$var</span>=&gt;<span class="src-var">$val</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a115"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-var">$var</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$val</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a116"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a117"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;add&nbsp;default&nbsp;values&nbsp;to&nbsp;config&nbsp;for&nbsp;uninitialized&nbsp;values</span></div></li>
<li><div class="src-line"><a name="a118"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'server'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'server'</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-str">'localhost'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a119"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'port'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'port'</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-num">5038</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a120"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'username'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'username'</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-str">'phpagi'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a121"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'secret'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'secret'</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-str">'phpagi'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a122"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a123"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a124"></a>&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a125"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Send&nbsp;a&nbsp;request</span></div></li>
<li><div class="src-line"><a name="a126"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a127"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc-var">$action&nbsp;</span></div></li>
<li><div class="src-line"><a name="a128"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc-var">$parameters&nbsp;</span></div></li>
<li><div class="src-line"><a name="a129"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">of&nbsp;parameters</span></div></li>
<li><div class="src-line"><a name="a130"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a131"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-var">$action</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span>=<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">))</span></div></li>
<li><div class="src-line"><a name="a132"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a133"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$req&nbsp;</span>=&nbsp;<span class="src-str">&quot;</span><span class="src-str">Action:&nbsp;<span class="src-var">$action</span>\r\n</span><span class="src-str">&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a134"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">foreach</span><span class="src-sym">(</span><span class="src-var">$parameters&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$var</span>=&gt;<span class="src-var">$val</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a135"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$req&nbsp;</span>.=&nbsp;<span class="src-str">&quot;</span><span class="src-str"><span class="src-var">$var</span>:&nbsp;<span class="src-var">$val</span>\r\n</span><span class="src-str">&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a136"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$req&nbsp;</span>.=&nbsp;<span class="src-str">&quot;\r\n&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a137"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/fwrite">fwrite</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$socket">socket</a><span class="src-sym">,&nbsp;</span><span class="src-var">$req</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a138"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodwait_response">wait_response</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a139"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a140"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a141"></a>&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a142"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Wait&nbsp;for&nbsp;a&nbsp;response</span></div></li>
<li><div class="src-line"><a name="a143"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a144"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;If&nbsp;a&nbsp;request&nbsp;was&nbsp;just&nbsp;sent,&nbsp;this&nbsp;will&nbsp;return&nbsp;the&nbsp;response.</span></div></li>
<li><div class="src-line"><a name="a145"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Otherwise,&nbsp;it&nbsp;will&nbsp;loop&nbsp;forever,&nbsp;handling&nbsp;events.</span></div></li>
<li><div class="src-line"><a name="a146"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a147"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">boolean&nbsp;</span><span class="src-doc-var">$allow_timeout&nbsp;</span><span class="src-doc">if&nbsp;the&nbsp;socket&nbsp;times&nbsp;out,&nbsp;return&nbsp;an&nbsp;empty&nbsp;array</span></div></li>
<li><div class="src-line"><a name="a148"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">array&nbsp;</span><span class="src-doc">of&nbsp;parameters,&nbsp;empty&nbsp;on&nbsp;timeout</span></div></li>
<li><div class="src-line"><a name="a149"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a150"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodwait_response">wait_response</a><span class="src-sym">(</span><span class="src-var">$allow_timeout</span>=<span class="src-id">false</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a151"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a152"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$timeout&nbsp;</span>=&nbsp;<span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a153"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do</div></li>
<li><div class="src-line"><a name="a154"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a155"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$type&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a156"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a157"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a158"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$buffer&nbsp;</span>=&nbsp;<a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><a href="http://www.php.net/fgets">fgets</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$socket">socket</a><span class="src-sym">,&nbsp;</span><span class="src-num">4096</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a159"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">while</span><span class="src-sym">(</span><span class="src-var">$buffer&nbsp;</span>!=&nbsp;<span class="src-str">''</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a160"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a161"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$a&nbsp;</span>=&nbsp;<a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$buffer</span><span class="src-sym">,&nbsp;</span><span class="src-str">':'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a162"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$a</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a163"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a164"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$parameters</span><span class="src-sym">))&nbsp;</span><span class="src-comm">//&nbsp;first&nbsp;line&nbsp;in&nbsp;a&nbsp;response?</span></div></li>
<li><div class="src-line"><a name="a165"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a166"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$type&nbsp;</span>=&nbsp;<a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$buffer</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a167"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$buffer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a&nbsp;</span>+&nbsp;<span class="src-num">2</span><span class="src-sym">)&nbsp;</span>==&nbsp;<span class="src-str">'Follows'</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a168"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a169"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;A&nbsp;follows&nbsp;response&nbsp;means&nbsp;there&nbsp;is&nbsp;a&nbsp;miltiline&nbsp;field&nbsp;that&nbsp;follows.</span></div></li>
<li><div class="src-line"><a name="a170"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'data'</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-str">''</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a171"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$buff&nbsp;</span>=&nbsp;<a href="http://www.php.net/fgets">fgets</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$socket">socket</a><span class="src-sym">,&nbsp;</span><span class="src-num">4096</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a172"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">while</span><span class="src-sym">(</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$buff</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-num">6</span><span class="src-sym">)&nbsp;</span>!=&nbsp;<span class="src-str">'--END&nbsp;'</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a173"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a174"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'data'</span><span class="src-sym">]&nbsp;</span>.=&nbsp;<span class="src-var">$buff</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a175"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$buff&nbsp;</span>=&nbsp;<a href="http://www.php.net/fgets">fgets</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$socket">socket</a><span class="src-sym">,&nbsp;</span><span class="src-num">4096</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a176"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a177"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a178"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a179"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a180"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;store&nbsp;parameter&nbsp;in&nbsp;$parameters</span></div></li>
<li><div class="src-line"><a name="a181"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$buffer</span><span class="src-sym">,&nbsp;</span><span class="src-num">0</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a</span><span class="src-sym">)</span><span class="src-sym">]&nbsp;</span>=&nbsp;<a href="http://www.php.net/substr">substr</a><span class="src-sym">(</span><span class="src-var">$buffer</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a&nbsp;</span>+&nbsp;<span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a182"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a183"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$buffer&nbsp;</span>=&nbsp;<a href="http://www.php.net/trim">trim</a><span class="src-sym">(</span><a href="http://www.php.net/fgets">fgets</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$socket">socket</a><span class="src-sym">,&nbsp;</span><span class="src-num">4096</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a184"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a185"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a186"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;process&nbsp;response</span></div></li>
<li><div class="src-line"><a name="a187"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">switch</span><span class="src-sym">(</span><span class="src-var">$type</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a188"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a189"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">''</span>:&nbsp;<span class="src-comm">//&nbsp;timeout&nbsp;occured</span></div></li>
<li><div class="src-line"><a name="a190"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$timeout&nbsp;</span>=&nbsp;<span class="src-var">$allow_timeout</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a191"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a192"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'event'</span>:</div></li>
<li><div class="src-line"><a name="a193"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodprocess_event">process_event</a><span class="src-sym">(</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a194"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a195"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">case&nbsp;</span><span class="src-str">'response'</span>:</div></li>
<li><div class="src-line"><a name="a196"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a197"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">default</span>:</div></li>
<li><div class="src-line"><a name="a198"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodlog">log</a><span class="src-sym">(</span><span class="src-str">'Unhandled&nbsp;response&nbsp;packet&nbsp;from&nbsp;Manager:&nbsp;'&nbsp;</span>.&nbsp;<a href="http://www.php.net/print_r">print_r</a><span class="src-sym">(</span><span class="src-var">$parameters</span><span class="src-sym">,&nbsp;</span><span class="src-id">true</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a199"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a200"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a201"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">while</span><span class="src-sym">(</span><span class="src-var">$type&nbsp;</span>!=&nbsp;<span class="src-str">'response'&nbsp;</span>&amp;&amp;&nbsp;<span class="src-sym">!</span><span class="src-var">$timeout</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a202"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a203"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a204"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a205"></a>&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a206"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Connect&nbsp;to&nbsp;Asterisk</span></div></li>
<li><div class="src-line"><a name="a207"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a208"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@example</span><span class="src-doc">&nbsp;examples/sip_show_peer.php&nbsp;Get&nbsp;information&nbsp;about&nbsp;a&nbsp;sip&nbsp;peer</span></div></li>
<li><div class="src-line"><a name="a209"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a210"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc-var">$server&nbsp;</span></div></li>
<li><div class="src-line"><a name="a211"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc-var">$username&nbsp;</span></div></li>
<li><div class="src-line"><a name="a212"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">string&nbsp;</span><span class="src-doc-var">$secret&nbsp;</span></div></li>
<li><div class="src-line"><a name="a213"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">boolean&nbsp;</span><span class="src-doc">true&nbsp;on&nbsp;success</span></div></li>
<li><div class="src-line"><a name="a214"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a215"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodconnect">connect</a><span class="src-sym">(</span><span class="src-var">$server</span>=<span class="src-id">NULL</span><span class="src-sym">,&nbsp;</span><span class="src-var">$username</span>=<span class="src-id">NULL</span><span class="src-sym">,&nbsp;</span><span class="src-var">$secret</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a216"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a217"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;use&nbsp;config&nbsp;if&nbsp;not&nbsp;specified</span></div></li>
<li><div class="src-line"><a name="a218"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$server</span><span class="src-sym">))&nbsp;</span><span class="src-var">$server&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'server'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a219"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$username</span><span class="src-sym">))&nbsp;</span><span class="src-var">$username&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'username'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a220"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$secret</span><span class="src-sym">))&nbsp;</span><span class="src-var">$secret&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'secret'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a221"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a222"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;get&nbsp;port&nbsp;from&nbsp;server&nbsp;if&nbsp;specified</span></div></li>
<li><div class="src-line"><a name="a223"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><a href="http://www.php.net/strpos">strpos</a><span class="src-sym">(</span><span class="src-var">$server</span><span class="src-sym">,&nbsp;</span><span class="src-str">':'</span><span class="src-sym">)&nbsp;</span>!==&nbsp;<span class="src-id">false</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a224"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a225"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$c&nbsp;</span>=&nbsp;<a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">':'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$server</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a226"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$server">server</a>&nbsp;=&nbsp;<span class="src-var">$c</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a227"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$port">port</a>&nbsp;=&nbsp;<span class="src-var">$c</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a228"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a229"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else</span></div></li>
<li><div class="src-line"><a name="a230"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a231"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$server">server</a>&nbsp;=&nbsp;<span class="src-var">$server</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a232"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$port">port</a>&nbsp;=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$config">config</a><span class="src-sym">[</span><span class="src-str">'asmanager'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-str">'port'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a233"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a234"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a235"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;connect&nbsp;the&nbsp;socket</span></div></li>
<li><div class="src-line"><a name="a236"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$errno&nbsp;</span>=&nbsp;<span class="src-var">$errstr&nbsp;</span>=&nbsp;<span class="src-id">NULL</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a237"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$socket">socket</a>&nbsp;=&nbsp;<span class="src-sym">@</span><a href="http://www.php.net/fsockopen">fsockopen</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$server">server</a><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$port">port</a><span class="src-sym">,&nbsp;</span><span class="src-var">$errno</span><span class="src-sym">,&nbsp;</span><span class="src-var">$errstr</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a238"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$socket">socket</a>&nbsp;==&nbsp;<span class="src-id">false</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a239"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a240"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodlog">log</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">Unable&nbsp;to&nbsp;connect&nbsp;to&nbsp;manager&nbsp;{<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$server">server</a><span class="src-sym">}</span>:{<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$port">port</a><span class="src-sym">}</span>&nbsp;(<span class="src-var">$errno</span>):&nbsp;<span class="src-var">$errstr</span><span class="src-str"></span><span class="src-str">"</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a241"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-id">false</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a242"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a243"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a244"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;read&nbsp;the&nbsp;header</span></span></div></li>
<li><div class="src-line"><a name="a245"></a></span><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$str</span>&nbsp;=&nbsp;<span class="src-id">fgets</span><span class="src-sym">(</span><span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$socket">socket</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a246"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$str&nbsp;</span>==&nbsp;<span class="src-id">false</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a247"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a248"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;a&nbsp;problem.</span></span></div></li>
<li><div class="src-line"><a name="a249"></a></span><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodlog">log</a><span class="src-sym">(</span><span class="src-str">&quot;Asterisk&nbsp;Manager&nbsp;header&nbsp;not&nbsp;received.&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a250"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a251"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a252"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else</span></span></div></li>
<li><div class="src-line"><a name="a253"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a254"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;note:&nbsp;don't&nbsp;$this-&gt;log($str)&nbsp;until&nbsp;someone&nbsp;looks&nbsp;to&nbsp;see&nbsp;why&nbsp;it&nbsp;mangles&nbsp;the&nbsp;logging</span></span></div></li>
<li><div class="src-line"><a name="a255"></a></span><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a256"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a257"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;login</span></span></div></li>
<li><div class="src-line"><a name="a258"></a></span><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$res</span>&nbsp;=&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'login'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Username'</span>=&gt;<span class="src-var">$username</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Secret'</span>=&gt;<span class="src-var">$secret</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a259"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$res</span><span class="src-sym">[</span><span class="src-str">'Response'</span><span class="src-sym">]&nbsp;</span>!=&nbsp;<span class="src-str">'Success'</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a260"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a261"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$_logged_in">_logged_in</a>&nbsp;=&nbsp;<span class="src-id">FALSE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a262"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodlog">log</a><span class="src-sym">(</span><span class="src-str">&quot;Failed&nbsp;to&nbsp;login.&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a263"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methoddisconnect">disconnect</a><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a264"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a265"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a266"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$_logged_in">_logged_in</a>&nbsp;=&nbsp;<span class="src-id">TRUE</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a267"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">true</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a268"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a269"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a270"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a271"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Disconnect</span></div></li>
<li><div class="src-line"><a name="a272"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a273"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@example&nbsp;examples/sip_show_peer.php&nbsp;Get&nbsp;information&nbsp;about&nbsp;a&nbsp;sip&nbsp;peer</span></div></li>
<li><div class="src-line"><a name="a274"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a275"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">disconnect</span><span class="src-sym">(</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a276"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a277"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$_logged_in">_logged_in</a>==<span class="src-id">TRUE</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a278"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-id">logoff</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a279"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-id">fclose</span><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$socket">socket</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a280"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a281"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a282"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;*********************************************************************************************************</span></span></div></li>
<li><div class="src-line"><a name="a283"></a></span><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;COMMANDS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**</span></span></div></li>
<li><div class="src-line"><a name="a284"></a></span><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;*********************************************************************************************************</span></span></div></li>
<li><div class="src-line"><a name="a285"></a></span><span class="src-str"><span class="src-comm"></span></span></div></li>
<li><div class="src-line"><a name="a286"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a287"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Set&nbsp;Absolute&nbsp;Timeout</span></div></li>
<li><div class="src-line"><a name="a288"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a289"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Hangup&nbsp;a&nbsp;channel&nbsp;after&nbsp;a&nbsp;certain&nbsp;time.</span></div></li>
<li><div class="src-line"><a name="a290"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a291"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+AbsoluteTimeout</span></div></li>
<li><div class="src-line"><a name="a292"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel&nbsp;Channel&nbsp;name&nbsp;to&nbsp;hangup</span></div></li>
<li><div class="src-line"><a name="a293"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;integer&nbsp;$timeout&nbsp;Maximum&nbsp;duration&nbsp;of&nbsp;the&nbsp;call&nbsp;(sec)</span></div></li>
<li><div class="src-line"><a name="a294"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a295"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">AbsoluteTimeout</span><span class="src-sym">(</span><span class="src-var">$channel</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$timeout</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a296"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a297"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'AbsoluteTimeout'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Timeout'</span>=&gt;<span class="src-var">$timeout</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a298"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a299"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a300"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a301"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Change&nbsp;monitoring&nbsp;filename&nbsp;of&nbsp;a&nbsp;channel</span></div></li>
<li><div class="src-line"><a name="a302"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a303"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ChangeMonitor</span></div></li>
<li><div class="src-line"><a name="a304"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel&nbsp;the&nbsp;channel&nbsp;to&nbsp;record.</span></div></li>
<li><div class="src-line"><a name="a305"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$file&nbsp;the&nbsp;new&nbsp;name&nbsp;of&nbsp;the&nbsp;file&nbsp;created&nbsp;in&nbsp;the&nbsp;monitor&nbsp;spool&nbsp;directory.</span></div></li>
<li><div class="src-line"><a name="a306"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a307"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">ChangeMonitor</span><span class="src-sym">(</span><span class="src-var">$channel</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$file</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a308"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a309"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ChangeMontior'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">,&nbsp;</span><span class="src-str">'File'</span>=&gt;<span class="src-var">$file</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a310"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a311"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a312"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a313"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Execute&nbsp;Command</span></div></li>
<li><div class="src-line"><a name="a314"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a315"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@example&nbsp;examples/sip_show_peer.php&nbsp;Get&nbsp;information&nbsp;about&nbsp;a&nbsp;sip&nbsp;peer</span></div></li>
<li><div class="src-line"><a name="a316"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Command</span></div></li>
<li><div class="src-line"><a name="a317"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+CLI</span></div></li>
<li><div class="src-line"><a name="a318"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$command</span></div></li>
<li><div class="src-line"><a name="a319"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a320"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a321"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">Command</span><span class="src-sym">(</span><span class="src-var">$command</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a322"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a323"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Command'</span>=&gt;<span class="src-var">$command</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a324"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'ActionID'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$actionid</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a325"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'Command'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a326"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a327"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a328"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a329"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Enable/Disable&nbsp;sending&nbsp;of&nbsp;events&nbsp;to&nbsp;this&nbsp;manager</span></div></li>
<li><div class="src-line"><a name="a330"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a331"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Events</span></div></li>
<li><div class="src-line"><a name="a332"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$eventmask&nbsp;is&nbsp;either&nbsp;'on',&nbsp;'off',&nbsp;or&nbsp;'system,call,log'</span></div></li>
<li><div class="src-line"><a name="a333"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a334"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">Events</span><span class="src-sym">(</span><span class="src-var">$eventmask</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a335"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a336"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'Events'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'EventMask'</span>=&gt;<span class="src-var">$eventmask</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a337"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a338"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a339"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a340"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Check&nbsp;Extension&nbsp;Status</span></div></li>
<li><div class="src-line"><a name="a341"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a342"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ExtensionState</span></div></li>
<li><div class="src-line"><a name="a343"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$exten&nbsp;Extension&nbsp;to&nbsp;check&nbsp;state&nbsp;on</span></div></li>
<li><div class="src-line"><a name="a344"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$context&nbsp;Context&nbsp;for&nbsp;extension</span></div></li>
<li><div class="src-line"><a name="a345"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a346"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a347"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">ExtensionState</span><span class="src-sym">(</span><span class="src-var">$exten</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$context</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a348"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a349"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Exten'</span>=&gt;<span class="src-var">$exten</span><span class="src-sym">,</span>&nbsp;<span class="src-str">'Context'</span>=&gt;<span class="src-var">$context</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a350"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'ActionID'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$actionid</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a351"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ExtensionState'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a352"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a353"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a354"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a355"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Gets&nbsp;a&nbsp;Channel&nbsp;Variable</span></div></li>
<li><div class="src-line"><a name="a356"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a357"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+GetVar</span></div></li>
<li><div class="src-line"><a name="a358"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+variables</span></div></li>
<li><div class="src-line"><a name="a359"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel&nbsp;Channel&nbsp;to&nbsp;read&nbsp;variable&nbsp;from</span></div></li>
<li><div class="src-line"><a name="a360"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$variable</span></div></li>
<li><div class="src-line"><a name="a361"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a362"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a363"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">GetVar</span><span class="src-sym">(</span><span class="src-var">$channel</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$variable</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a364"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a365"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">,</span>&nbsp;<span class="src-str">'Variable'</span>=&gt;<span class="src-var">$variable</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a366"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'ActionID'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$actionid</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a367"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'GetVar'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a368"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a369"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a370"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a371"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Hangup&nbsp;Channel</span></div></li>
<li><div class="src-line"><a name="a372"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a373"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Hangup</span></div></li>
<li><div class="src-line"><a name="a374"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel&nbsp;The&nbsp;channel&nbsp;name&nbsp;to&nbsp;be&nbsp;hungup</span></div></li>
<li><div class="src-line"><a name="a375"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a376"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">Hangup</span><span class="src-sym">(</span><span class="src-var">$channel</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a377"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a378"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'Hangup'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a379"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a380"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a381"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a382"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;List&nbsp;IAX&nbsp;Peers</span></div></li>
<li><div class="src-line"><a name="a383"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a384"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+IAXpeers</span></div></li>
<li><div class="src-line"><a name="a385"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a386"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">IAXPeers</span><span class="src-sym">(</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a387"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a388"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'IAXPeers'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a389"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a390"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a391"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a392"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;List&nbsp;available&nbsp;manager&nbsp;commands</span></div></li>
<li><div class="src-line"><a name="a393"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a394"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ListCommands</span></div></li>
<li><div class="src-line"><a name="a395"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a396"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a397"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">ListCommands</span><span class="src-sym">(</span><span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a398"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a399"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a400"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ListCommands'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'ActionID'</span>=&gt;<span class="src-var">$actionid</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a401"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else</span></div></li>
<li><div class="src-line"><a name="a402"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ListCommands'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a403"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a404"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a405"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a406"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Logoff&nbsp;Manager</span></div></li>
<li><div class="src-line"><a name="a407"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a408"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Logoff</span></div></li>
<li><div class="src-line"><a name="a409"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a410"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">Logoff</span><span class="src-sym">(</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a411"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a412"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'Logoff'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a413"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a414"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a415"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a416"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Check&nbsp;Mailbox&nbsp;Message&nbsp;Count</span></div></li>
<li><div class="src-line"><a name="a417"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a418"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Returns&nbsp;number&nbsp;of&nbsp;new&nbsp;and&nbsp;old&nbsp;messages.</span></div></li>
<li><div class="src-line"><a name="a419"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Message:&nbsp;Mailbox&nbsp;Message&nbsp;Count</span></div></li>
<li><div class="src-line"><a name="a420"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Mailbox:&nbsp;&lt;mailboxid&gt;</span></div></li>
<li><div class="src-line"><a name="a421"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;NewMessages:&nbsp;&lt;count&gt;</span></div></li>
<li><div class="src-line"><a name="a422"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;OldMessages:&nbsp;&lt;count&gt;</span></div></li>
<li><div class="src-line"><a name="a423"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a424"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+MailboxCount</span></div></li>
<li><div class="src-line"><a name="a425"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$mailbox&nbsp;Full&nbsp;mailbox&nbsp;ID&nbsp;&lt;mailbox&gt;@&lt;vm-context&gt;</span></div></li>
<li><div class="src-line"><a name="a426"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a427"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a428"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">MailboxCount</span><span class="src-sym">(</span><span class="src-var">$mailbox</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a429"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a430"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Mailbox'</span>=&gt;<span class="src-var">$mailbox</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a431"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'ActionID'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$actionid</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a432"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'MailboxCount'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a433"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a434"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a435"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a436"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Check&nbsp;Mailbox</span></div></li>
<li><div class="src-line"><a name="a437"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a438"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Returns&nbsp;number&nbsp;of&nbsp;messages.</span></div></li>
<li><div class="src-line"><a name="a439"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Message:&nbsp;Mailbox&nbsp;Status</span></div></li>
<li><div class="src-line"><a name="a440"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Mailbox:&nbsp;&lt;mailboxid&gt;</span></div></li>
<li><div class="src-line"><a name="a441"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Waiting:&nbsp;&lt;count&gt;</span></div></li>
<li><div class="src-line"><a name="a442"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a443"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+MailboxStatus</span></div></li>
<li><div class="src-line"><a name="a444"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$mailbox&nbsp;Full&nbsp;mailbox&nbsp;ID&nbsp;&lt;mailbox&gt;@&lt;vm-context&gt;</span></div></li>
<li><div class="src-line"><a name="a445"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a446"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a447"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">MailboxStatus</span><span class="src-sym">(</span><span class="src-var">$mailbox</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a448"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span>&nbsp;&nbsp;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a449"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Mailbox'</span>=&gt;<span class="src-var">$mailbox</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a450"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'ActionID'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$actionid</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a451"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'MailboxStatus'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a452"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a453"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a454"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a455"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Monitor&nbsp;a&nbsp;channel</span></div></li>
<li><div class="src-line"><a name="a456"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a457"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Monitor</span></div></li>
<li><div class="src-line"><a name="a458"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel</span></div></li>
<li><div class="src-line"><a name="a459"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$file</span></div></li>
<li><div class="src-line"><a name="a460"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$format</span></div></li>
<li><div class="src-line"><a name="a461"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;boolean&nbsp;$mix</span></div></li>
<li><div class="src-line"><a name="a462"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a463"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">Monitor</span><span class="src-sym">(</span><span class="src-var">$channel</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$file</span>=<span class="src-id">NULL</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$format</span>=<span class="src-id">NULL</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$mix</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a464"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a465"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a466"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'File'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$file</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a467"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$format</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Format'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$format</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a468"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-id">is_null</span><span class="src-sym">(</span><span class="src-var">$file</span><span class="src-sym">))</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Mix'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-sym">(</span><span class="src-var">$mix</span><span class="src-sym">)</span>&nbsp;?&nbsp;<span class="src-str">'true'</span>&nbsp;:&nbsp;<span class="src-str">'false'</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a469"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'Monitor'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a470"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a471"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a472"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a473"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Originate&nbsp;Call</span></div></li>
<li><div class="src-line"><a name="a474"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a475"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Originate</span></div></li>
<li><div class="src-line"><a name="a476"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel&nbsp;Channel&nbsp;name&nbsp;to&nbsp;call</span></div></li>
<li><div class="src-line"><a name="a477"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$exten&nbsp;Extension&nbsp;to&nbsp;use&nbsp;(requires&nbsp;'Context'&nbsp;and&nbsp;'Priority')</span></div></li>
<li><div class="src-line"><a name="a478"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$context&nbsp;Context&nbsp;to&nbsp;use&nbsp;(requires&nbsp;'Exten'&nbsp;and&nbsp;'Priority')</span></div></li>
<li><div class="src-line"><a name="a479"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$priority&nbsp;Priority&nbsp;to&nbsp;use&nbsp;(requires&nbsp;'Exten'&nbsp;and&nbsp;'Context')</span></div></li>
<li><div class="src-line"><a name="a480"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$application&nbsp;Application&nbsp;to&nbsp;use</span></div></li>
<li><div class="src-line"><a name="a481"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$data&nbsp;Data&nbsp;to&nbsp;use&nbsp;(requires&nbsp;'Application')</span></div></li>
<li><div class="src-line"><a name="a482"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;integer&nbsp;$timeout&nbsp;How&nbsp;long&nbsp;to&nbsp;wait&nbsp;for&nbsp;call&nbsp;to&nbsp;be&nbsp;answered&nbsp;(in&nbsp;ms)</span></div></li>
<li><div class="src-line"><a name="a483"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$callerid&nbsp;Caller&nbsp;ID&nbsp;to&nbsp;be&nbsp;set&nbsp;on&nbsp;the&nbsp;outgoing&nbsp;channel</span></div></li>
<li><div class="src-line"><a name="a484"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$variable&nbsp;Channel&nbsp;variable&nbsp;to&nbsp;set&nbsp;(VAR1=value1|VAR2=value2)</span></div></li>
<li><div class="src-line"><a name="a485"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$account&nbsp;Account&nbsp;code</span></div></li>
<li><div class="src-line"><a name="a486"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;boolean&nbsp;$async&nbsp;true&nbsp;fast&nbsp;origination</span></div></li>
<li><div class="src-line"><a name="a487"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a488"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a489"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">Originate</span><span class="src-sym">(</span><span class="src-var">$channel</span><span class="src-sym">,</span></span></div></li>
<li><div class="src-line"><a name="a490"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$exten</span>=<span class="src-id">NULL</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$context</span>=<span class="src-id">NULL</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$priority</span>=<span class="src-id">NULL</span><span class="src-sym">,</span></span></div></li>
<li><div class="src-line"><a name="a491"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$application</span>=<span class="src-id">NULL</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$data</span>=<span class="src-id">NULL</span><span class="src-sym">,</span></span></div></li>
<li><div class="src-line"><a name="a492"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$timeout</span>=<span class="src-id">NULL</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$callerid</span>=<span class="src-id">NULL</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$variable</span>=<span class="src-id">NULL</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$account</span>=<span class="src-id">NULL</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$async</span>=<span class="src-id">NULL</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a493"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a494"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a495"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a496"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$exten</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Exten'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$exten</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a497"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$context</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Context'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$context</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a498"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$priority</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Priority'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$priority</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a499"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a500"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$application</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Application'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$application</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a501"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$data</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Data'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$data</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a502"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a503"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$timeout</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Timeout'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$timeout</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a504"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$callerid</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'CallerID'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$callerid</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a505"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$variable</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Variable'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$variable</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a506"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$account</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Account'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$account</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a507"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-id">is_null</span><span class="src-sym">(</span><span class="src-var">$async</span><span class="src-sym">))</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Async'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-sym">(</span><span class="src-var">$async</span><span class="src-sym">)</span>&nbsp;?&nbsp;<span class="src-str">'true'</span>&nbsp;:&nbsp;<span class="src-str">'false'</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a508"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'ActionID'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$actionid</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a509"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a510"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'Originate'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a511"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span>&nbsp;&nbsp;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a512"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a513"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a514"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;List&nbsp;parked&nbsp;calls</span></div></li>
<li><div class="src-line"><a name="a515"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a516"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ParkedCalls</span></div></li>
<li><div class="src-line"><a name="a517"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a518"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a519"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">ParkedCalls</span><span class="src-sym">(</span><span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a520"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a521"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a522"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ParkedCalls'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'ActionID'</span>=&gt;<span class="src-var">$actionid</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a523"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else</span></div></li>
<li><div class="src-line"><a name="a524"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ParkedCalls'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a525"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a526"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a527"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a528"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Ping</span></div></li>
<li><div class="src-line"><a name="a529"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a530"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Ping</span></div></li>
<li><div class="src-line"><a name="a531"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a532"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">Ping</span><span class="src-sym">(</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a533"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a534"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'Ping'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a535"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a536"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a537"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a538"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Queue&nbsp;Add</span></div></li>
<li><div class="src-line"><a name="a539"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a540"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueAdd</span></div></li>
<li><div class="src-line"><a name="a541"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$queue</span></div></li>
<li><div class="src-line"><a name="a542"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$interface</span></div></li>
<li><div class="src-line"><a name="a543"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;integer&nbsp;$penalty</span></div></li>
<li><div class="src-line"><a name="a544"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a545"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">QueueAdd</span><span class="src-sym">(</span><span class="src-var">$queue</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$interface</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$penalty</span>=<span class="src-num">0</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a546"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a547"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Queue'</span>=&gt;<span class="src-var">$queue</span><span class="src-sym">,</span>&nbsp;<span class="src-str">'Interface'</span>=&gt;<span class="src-var">$interface</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a548"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$penalty</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Penalty'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$penalty</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a549"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'QueueAdd'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a550"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a551"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a552"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a553"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Queue&nbsp;Remove</span></div></li>
<li><div class="src-line"><a name="a554"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a555"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueRemove</span></div></li>
<li><div class="src-line"><a name="a556"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$queue</span></div></li>
<li><div class="src-line"><a name="a557"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$interface</span></div></li>
<li><div class="src-line"><a name="a558"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a559"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">QueueRemove</span><span class="src-sym">(</span><span class="src-var">$queue</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$interface</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a560"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a561"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'QueueRemove'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Queue'</span>=&gt;<span class="src-var">$queue</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Interface'</span>=&gt;<span class="src-var">$interface</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a562"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a563"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a564"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a565"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Queues</span></div></li>
<li><div class="src-line"><a name="a566"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a567"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Queues</span></div></li>
<li><div class="src-line"><a name="a568"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a569"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">Queues</span><span class="src-sym">(</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a570"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a571"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'Queues'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a572"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a573"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a574"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a575"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Queue&nbsp;Status</span></div></li>
<li><div class="src-line"><a name="a576"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a577"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+QueueStatus</span></div></li>
<li><div class="src-line"><a name="a578"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a579"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a580"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">QueueStatus</span><span class="src-sym">(</span><span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a581"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a582"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a583"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'QueueStatus'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'ActionID'</span>=&gt;<span class="src-var">$actionid</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a584"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else</span></div></li>
<li><div class="src-line"><a name="a585"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'QueueStatus'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a586"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a587"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a588"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a589"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Redirect</span></div></li>
<li><div class="src-line"><a name="a590"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a591"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Redirect</span></div></li>
<li><div class="src-line"><a name="a592"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel</span></div></li>
<li><div class="src-line"><a name="a593"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$extrachannel</span></div></li>
<li><div class="src-line"><a name="a594"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$exten</span></div></li>
<li><div class="src-line"><a name="a595"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$context</span></div></li>
<li><div class="src-line"><a name="a596"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$priority</span></div></li>
<li><div class="src-line"><a name="a597"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a598"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">Redirect</span><span class="src-sym">(</span><span class="src-var">$channel</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$extrachannel</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$exten</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$context</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$priority</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a599"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a600"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'Redirect'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">,&nbsp;</span><span class="src-str">'ExtraChannel'</span>=&gt;<span class="src-var">$extrachannel</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Exten'</span>=&gt;<span class="src-var">$exten</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a601"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-str">'Context'</span>=&gt;<span class="src-var">$context</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Priority'</span>=&gt;<span class="src-var">$priority</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a602"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a603"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a604"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a605"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Set&nbsp;the&nbsp;CDR&nbsp;UserField</span></div></li>
<li><div class="src-line"><a name="a606"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a607"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+SetCDRUserField</span></div></li>
<li><div class="src-line"><a name="a608"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$userfield</span></div></li>
<li><div class="src-line"><a name="a609"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel</span></div></li>
<li><div class="src-line"><a name="a610"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$append</span></div></li>
<li><div class="src-line"><a name="a611"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a612"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">SetCDRUserField</span><span class="src-sym">(</span><span class="src-var">$userfield</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$channel</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$append</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a613"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a614"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'UserField'</span>=&gt;<span class="src-var">$userfield</span><span class="src-sym">,</span>&nbsp;<span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a615"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$append</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Append'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$append</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a616"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'SetCDRUserField'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a617"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a618"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a619"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a620"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Set&nbsp;Channel&nbsp;Variable</span></div></li>
<li><div class="src-line"><a name="a621"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a622"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+SetVar</span></div></li>
<li><div class="src-line"><a name="a623"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel&nbsp;Channel&nbsp;to&nbsp;set&nbsp;variable&nbsp;for</span></div></li>
<li><div class="src-line"><a name="a624"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$variable&nbsp;name</span></div></li>
<li><div class="src-line"><a name="a625"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$value</span></div></li>
<li><div class="src-line"><a name="a626"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a627"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">SetVar</span><span class="src-sym">(</span><span class="src-var">$channel</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$variable</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$value</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a628"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a629"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'SetVar'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Variable'</span>=&gt;<span class="src-var">$variable</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Value'</span>=&gt;<span class="src-var">$value</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a630"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a631"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a632"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a633"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Channel&nbsp;Status</span></div></li>
<li><div class="src-line"><a name="a634"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a635"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+Status</span></div></li>
<li><div class="src-line"><a name="a636"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel</span></div></li>
<li><div class="src-line"><a name="a637"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a638"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a639"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">Status</span><span class="src-sym">(</span><span class="src-var">$channel</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a640"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a641"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parameters</span>&nbsp;=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a642"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'ActionID'</span><span class="src-sym">]</span>&nbsp;=&nbsp;<span class="src-var">$actionid</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a643"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'Status'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parameters</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a644"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a645"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a646"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a647"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Stop&nbsp;monitoring&nbsp;a&nbsp;channel</span></div></li>
<li><div class="src-line"><a name="a648"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a649"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+StopMonitor</span></div></li>
<li><div class="src-line"><a name="a650"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$channel</span></div></li>
<li><div class="src-line"><a name="a651"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a652"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">StopMonitor</span><span class="src-sym">(</span><span class="src-var">$channel</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a653"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a654"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'StopMonitor'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'Channel'</span>=&gt;<span class="src-var">$channel</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a655"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a656"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a657"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a658"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Dial&nbsp;over&nbsp;Zap&nbsp;channel&nbsp;while&nbsp;offhook</span></div></li>
<li><div class="src-line"><a name="a659"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a660"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDialOffhook</span></div></li>
<li><div class="src-line"><a name="a661"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$zapchannel</span></div></li>
<li><div class="src-line"><a name="a662"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$number</span></div></li>
<li><div class="src-line"><a name="a663"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a664"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">ZapDialOffhook</span><span class="src-sym">(</span><span class="src-var">$zapchannel</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$number</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a665"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a666"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ZapDialOffhook'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'ZapChannel'</span>=&gt;<span class="src-var">$zapchannel</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Number'</span>=&gt;<span class="src-var">$number</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a667"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a668"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a669"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a670"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Toggle&nbsp;Zap&nbsp;channel&nbsp;Do&nbsp;Not&nbsp;Disturb&nbsp;status&nbsp;OFF</span></div></li>
<li><div class="src-line"><a name="a671"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a672"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDNDoff</span></div></li>
<li><div class="src-line"><a name="a673"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$zapchannel</span></div></li>
<li><div class="src-line"><a name="a674"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a675"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">ZapDNDoff</span><span class="src-sym">(</span><span class="src-var">$zapchannel</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a676"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a677"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ZapDNDoff'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'ZapChannel'</span>=&gt;<span class="src-var">$zapchannel</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a678"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a679"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a680"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a681"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Toggle&nbsp;Zap&nbsp;channel&nbsp;Do&nbsp;Not&nbsp;Disturb&nbsp;status&nbsp;ON</span></div></li>
<li><div class="src-line"><a name="a682"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a683"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapDNDon</span></div></li>
<li><div class="src-line"><a name="a684"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$zapchannel</span></div></li>
<li><div class="src-line"><a name="a685"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a686"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">ZapDNDon</span><span class="src-sym">(</span><span class="src-var">$zapchannel</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a687"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a688"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ZapDNDon'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'ZapChannel'</span>=&gt;<span class="src-var">$zapchannel</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a689"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a690"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a691"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a692"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Hangup&nbsp;Zap&nbsp;Channel</span></div></li>
<li><div class="src-line"><a name="a693"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a694"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapHangup</span></div></li>
<li><div class="src-line"><a name="a695"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$zapchannel</span></div></li>
<li><div class="src-line"><a name="a696"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a697"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">ZapHangup</span><span class="src-sym">(</span><span class="src-var">$zapchannel</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a698"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a699"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ZapHangup'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'ZapChannel'</span>=&gt;<span class="src-var">$zapchannel</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a700"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a701"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a702"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a703"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Transfer&nbsp;Zap&nbsp;Channel</span></div></li>
<li><div class="src-line"><a name="a704"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a705"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapTransfer</span></div></li>
<li><div class="src-line"><a name="a706"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$zapchannel</span></div></li>
<li><div class="src-line"><a name="a707"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a708"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">ZapTransfer</span><span class="src-sym">(</span><span class="src-var">$zapchannel</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a709"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a710"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ZapTransfer'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'ZapChannel'</span>=&gt;<span class="src-var">$zapchannel</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a711"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a712"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a713"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a714"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Zap&nbsp;Show&nbsp;Channels</span></div></li>
<li><div class="src-line"><a name="a715"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a716"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@link&nbsp;http://www.voip-info.org/wiki-Asterisk+Manager+API+Action+ZapShowChannels</span></div></li>
<li><div class="src-line"><a name="a717"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$actionid&nbsp;message&nbsp;matching&nbsp;variable</span></div></li>
<li><div class="src-line"><a name="a718"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a719"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">ZapShowChannels</span><span class="src-sym">(</span><span class="src-var">$actionid</span>=<span class="src-id">NULL</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a720"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a721"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$actionid</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a722"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ZapShowChannels'</span><span class="src-sym">,&nbsp;</span><span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'ActionID'</span>=&gt;<span class="src-var">$actionid</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a723"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else</span></div></li>
<li><div class="src-line"><a name="a724"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodsend_request">send_request</a><span class="src-sym">(</span><span class="src-str">'ZapShowChannels'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a725"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a726"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a727"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;*********************************************************************************************************</span></span></div></li>
<li><div class="src-line"><a name="a728"></a></span><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;**&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MISC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;**</span></span></div></li>
<li><div class="src-line"><a name="a729"></a></span><span class="src-str"><span class="src-comm"></span>&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;*********************************************************************************************************</span></span></div></li>
<li><div class="src-line"><a name="a730"></a></span><span class="src-str"><span class="src-comm"></span></span></div></li>
<li><div class="src-line"><a name="a731"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;<span class="src-comm">/*</span></span></div></li>
<li><div class="src-line"><a name="a732"></a></span><span class="src-str"><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Log&nbsp;a&nbsp;message</span></span></div></li>
<li><div class="src-line"><a name="a733"></a></span><span class="src-str"><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;*</span></span></div></li>
<li><div class="src-line"><a name="a734"></a></span><span class="src-str"><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$message</span></span></div></li>
<li><div class="src-line"><a name="a735"></a></span><span class="src-str"><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;integer&nbsp;$level&nbsp;from&nbsp;1&nbsp;to&nbsp;4</span></span></div></li>
<li><div class="src-line"><a name="a736"></a></span><span class="src-str"><span class="src-comm">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></span></div></li>
<li><div class="src-line"><a name="a737"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">log</span><span class="src-sym">(</span><span class="src-var">$message</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$level</span>=<span class="src-num">1</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a738"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a739"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$pagi">pagi</a>&nbsp;!=&nbsp;<span class="src-id">false</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a740"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><span class="src-var">pagi</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI.html#methodconlog">conlog</a><span class="src-sym">(</span><span class="src-var">$message</span><span class="src-sym">,&nbsp;</span><span class="src-var">$level</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a741"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else</span></div></li>
<li><div class="src-line"><a name="a742"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-id">error_log</span><span class="src-sym">(</span><span class="src-id">date</span><span class="src-sym">(</span><span class="src-str">'r'</span><span class="src-sym">)&nbsp;</span>.&nbsp;<span class="src-str">'&nbsp;-&nbsp;'&nbsp;</span>.&nbsp;<span class="src-var">$message</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a743"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a744"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a745"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a746"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Add&nbsp;event&nbsp;handler</span></div></li>
<li><div class="src-line"><a name="a747"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a748"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Known&nbsp;Events&nbsp;include&nbsp;(&nbsp;http://www.voip-info.org/wiki-asterisk+manager+events&nbsp;)</span></div></li>
<li><div class="src-line"><a name="a749"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Link&nbsp;-&nbsp;Fired&nbsp;when&nbsp;two&nbsp;voice&nbsp;channels&nbsp;are&nbsp;linked&nbsp;together&nbsp;and&nbsp;voice&nbsp;data&nbsp;exchange&nbsp;commences.</span></div></li>
<li><div class="src-line"><a name="a750"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Unlink&nbsp;-&nbsp;Fired&nbsp;when&nbsp;a&nbsp;link&nbsp;between&nbsp;two&nbsp;voice&nbsp;channels&nbsp;is&nbsp;discontinued,&nbsp;for&nbsp;example,&nbsp;just&nbsp;before&nbsp;call&nbsp;completion.</span></div></li>
<li><div class="src-line"><a name="a751"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Newexten&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a752"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Hangup&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a753"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Newchannel&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a754"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Newstate&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a755"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Reload&nbsp;-&nbsp;Fired&nbsp;when&nbsp;the&nbsp;&quot;RELOAD&quot;&nbsp;console&nbsp;command&nbsp;is&nbsp;executed.</span></div></li>
<li><div class="src-line"><a name="a756"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Shutdown&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a757"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;ExtensionStatus&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a758"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Rename&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a759"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Newcallerid&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a760"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Alarm&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a761"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;AlarmClear&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a762"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Agentcallbacklogoff&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a763"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Agentcallbacklogin&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a764"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Agentlogoff&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a765"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;MeetmeJoin&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a766"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;MessageWaiting&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a767"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;join&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a768"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;leave&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a769"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;AgentCalled&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a770"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;ParkedCall&nbsp;-&nbsp;Fired&nbsp;after&nbsp;ParkedCalls</span></div></li>
<li><div class="src-line"><a name="a771"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Cdr&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a772"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;ParkedCallsComplete&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a773"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;QueueParams&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a774"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;QueueMember&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a775"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;QueueStatusEnd&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a776"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Status&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a777"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;StatusComplete&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a778"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;ZapShowChannels&nbsp;-&nbsp;Fired&nbsp;after&nbsp;ZapShowChannels</span></div></li>
<li><div class="src-line"><a name="a779"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;ZapShowChannelsComplete&nbsp;-</span></div></li>
<li><div class="src-line"><a name="a780"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a781"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$event&nbsp;type&nbsp;or&nbsp;*&nbsp;for&nbsp;default&nbsp;handler</span></div></li>
<li><div class="src-line"><a name="a782"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$callback&nbsp;function</span></div></li>
<li><div class="src-line"><a name="a783"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;boolean&nbsp;sucess</span></div></li>
<li><div class="src-line"><a name="a784"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a785"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">add_event_handler</span><span class="src-sym">(</span><span class="src-var">$event</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$callback</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a786"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a787"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$event</span>&nbsp;=&nbsp;<span class="src-id">strtolower</span><span class="src-sym">(</span><span class="src-var">$event</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a788"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$event_handlers">event_handlers</a><span class="src-sym">[</span><span class="src-var">$event</span><span class="src-sym">]</span><span class="src-sym">))</span></div></li>
<li><div class="src-line"><a name="a789"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a790"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodlog">log</a><span class="src-sym">(</span><span class="src-str"></span><span class="src-str">"</span><span class="src-var">$event</span>&nbsp;handler&nbsp;is&nbsp;already&nbsp;defined,&nbsp;not&nbsp;over-writing.<span class="src-str">"</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a791"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-id">false</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a792"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a793"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$event_handlers">event_handlers</a><span class="src-sym">[</span><span class="src-var">$event</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-var">$callback</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a794"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-id">true</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a795"></a>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a796"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a797"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;/**</span></div></li>
<li><div class="src-line"><a name="a798"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Process&nbsp;event</span></div></li>
<li><div class="src-line"><a name="a799"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a800"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@access&nbsp;private</span></div></li>
<li><div class="src-line"><a name="a801"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;array&nbsp;$parameters</span></div></li>
<li><div class="src-line"><a name="a802"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;mixed&nbsp;result&nbsp;of&nbsp;event&nbsp;handler&nbsp;or&nbsp;false&nbsp;if&nbsp;no&nbsp;handler&nbsp;was&nbsp;found</span></div></li>
<li><div class="src-line"><a name="a803"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a804"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function</span>&nbsp;<span class="src-id">process_event</span><span class="src-sym">(</span><span class="src-var">$parameters</span><span class="src-sym">)</span></span></div></li>
<li><div class="src-line"><a name="a805"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a806"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$ret</span>&nbsp;=&nbsp;<span class="src-id">false</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a807"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$e</span>&nbsp;=&nbsp;<span class="src-id">strtolower</span><span class="src-sym">(</span><span class="src-var">$parameters</span><span class="src-sym">[</span><span class="src-str">'Event'</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a808"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodlog">log</a><span class="src-sym">(</span><span class="src-str"></span><span class="src-str">"</span>Got&nbsp;event..&nbsp;<span class="src-var">$e</span><span class="src-str">"</span><span class="src-sym">)</span><span class="src-sym">;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a809"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a810"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$handler</span>&nbsp;=&nbsp;<span class="src-str">''</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a811"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$event_handlers">event_handlers</a><span class="src-sym">[</span><span class="src-var">$e</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-var">$handler&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$event_handlers">event_handlers</a><span class="src-sym">[</span><span class="src-var">$e</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a812"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">elseif</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$event_handlers">event_handlers</a><span class="src-sym">[</span><span class="src-str">'*'</span><span class="src-sym">]</span><span class="src-sym">))&nbsp;</span><span class="src-var">$handler&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$event_handlers">event_handlers</a><span class="src-sym">[</span><span class="src-str">'*'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a813"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a814"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(</span><span class="src-id">function_exists</span><span class="src-sym">(</span><span class="src-var">$handler</span><span class="src-sym">))</span></div></li>
<li><div class="src-line"><a name="a815"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">{</span></span></div></li>
<li><div class="src-line"><a name="a816"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodlog">log</a><span class="src-sym">(</span><span class="src-str"></span><span class="src-str">"</span>Execute&nbsp;handler&nbsp;<span class="src-var">$handler</span><span class="src-str">"</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a817"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$ret</span>&nbsp;=&nbsp;<span class="src-var">$handler</span><span class="src-sym">(</span><span class="src-var">$e</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$parameters</span><span class="src-sym">,</span>&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$server">server</a><span class="src-sym">,&nbsp;</span><span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#var$port">port</a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a818"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-str"><span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a819"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">else</span></span></div></li>
<li><div class="src-line"><a name="a820"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$this</span></span><span class="src-sym">-&gt;</span><a href="../phpAGI/AGI_AsteriskManager.html#methodlog">log</a><span class="src-sym">(</span><span class="src-str"></span><span class="src-str">"</span>No&nbsp;event&nbsp;handler&nbsp;for&nbsp;event&nbsp;'<span class="src-var">$e</span>'<span class="src-str">"</span><span class="src-sym">)</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a821"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return</span>&nbsp;<span class="src-var">$ret</span><span class="src-sym">;</span></span></div></li>
<li><div class="src-line"><a name="a822"></a></span><span class="src-str">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
<li><div class="src-line"><a name="a823"></a></span><span class="src-str">&nbsp;&nbsp;<span class="src-sym">}</span></span></div></li>
</ol></div>
</div>
	<p class="notes" id="credit">
		Documentation generated on Thu, 30 Sep 2010 02:21:47 -0700 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.2</a>
	</p>
	</body>
</html>
Return current item: PHP AGI