<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
<font face="Helvetica, Arial, sans-serif">Hello list,<br>
<br>
I don't really understand how AMI works.<br>
<br>
I read some information and examples on the net, but they all show
how you login to the AMI, give an action and receive a response.
The end.<br>
I guess you just re-run the script every time you want the action
to be executed.<br>
<br>
How then does this work when you use events ? If I want to use
"PeerStatus" to monitor the state of a SIP peer, how can I run a
script on change of peer status ?<br>
<br>
If I make a php script to login and send an event, where does
every status change then go to ??<br>
<br>
<br>
<i>/* Connection details */<br>
$manager_host = "127.0.0.1";<br>
$manager_user = "admin";<br>
$manager_pass = "iamgod";<br>
<br>
/* Default Port */<br>
$manager_port = "5038";<br>
<br>
/* Connection timeout */<br>
$manager_connection_timeout = 30;<br>
<br>
/* Connect to the manager */<br>
$fp = fsockopen($manager_host, $manager_port, $errno, $errstr,
$manager_connection_timeout);<br>
<br>
$login = "Action: login\r\n";<br>
$login .= "Username: $manager_user\r\n";<br>
$login .= "Secret: $manager_pass\r\n";<br>
$login .= "Event: PeerStatus</i></font><font
face="Helvetica, Arial, sans-serif"><i>\r\n";<br>
$login .= "\r\n";<br>
fwrite($fp,$login);</i><br>
<br>
<br>
That's it. I'm logged in and I have been subscribed to receive
peer status changes. Where do these peer changes appear ? I really
don't get that.<br>
<br>
If I want to send an email on every peer status change... where do
I have to look for peer status changes ?<br>
<br>
<br>
<br>
Kind regards,<br>
Jonas.<br>
</font>
</body>
</html>