I have put together a method to reboot my SIP phones. I can use an array to feed the foreach and it works fine. Now I need to take a step or two further. I want to use the result of a query in the array. The next step would be to instead of having all the extensions in the array , to be able to select extensions from a form. But for now getting the initial array is what I am needing help with.
//*****This doesn't work *******
//$phones = "SELECT extension FROM `extensions`IN(".implode(',',$array).")";
//******This works********
$phones = array(201,202,204);
foreach ($phones as $phone)
{
$out = shell_exec("asterisk -rx 'sip notify CQ_Phone-Reboot $phone'");
echo str_replace("\n", "<br/>", $out);
}
Thanks