Changeset 8217
- Timestamp:
- 08/27/09 13:50:33 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/branches/2.6/amp_conf/agi-bin/phpagi-asmanager.php
r5265 r8217 225 225 } 226 226 227 // connect the socket 227 // connect the socket, set a 10 second timeout for the connection, this gives us plenty of time to connect 228 228 $errno = $errstr = NULL; 229 $this->socket = @fsockopen($this->server, $this->port, $errno, $errstr );229 $this->socket = @fsockopen($this->server, $this->port, $errno, $errstr, 10); 230 230 if($this->socket == false) 231 231 { 232 232 $this->log("Unable to connect to manager {$this->server}:{$this->port} ($errno): $errstr"); 233 233 return false; 234 } 235 234 } else 235 // Set a 2 second timeout for read/write commands 236 stream_set_timeout($this->socket, 2); 237 236 238 // read the header 237 239 $str = fgets($this->socket); … … 252 254 { 253 255 $this->log("Failed to login."); 254 $this->disconnect( );256 $this->disconnect(TRUE); 255 257 return false; 256 258 } … … 263 265 * @example examples/sip_show_peer.php Get information about a sip peer 264 266 */ 265 function disconnect() 266 { 267 function disconnect($dontlogoff=NULL) 268 { 269 if (!$dontlogoff) 267 270 $this->logoff(); 268 271 fclose($this->socket);
