$vars['__EXTENSION'] = $extension; if ($argc == 4) { $vars['NAME_RECORDING'] = $argv[3]; } # Connect to the AGI $asm = new AGI_AsteriskManager(); $asm->connect(); # Get language $language = Aastra_get_language(); # Notify each phone for ($i = 0; $i < sizeof($notify); $i++) { $vars['__REALCALLERIDNUM'] = $notify[$i]; $state = $asm->ExtensionState($notify[$i], 'default'); if ($state['Status'] != 0) { $vars['NOTIFY_VM'] = 'true'; } while (list($key, $val) = each($vars)) { $vars_arr[] = "{$key}={$val}"; } if (Aastra_compare_version_Asterisk('1.6')) { $vars = implode(',', $vars_arr); } else { $vars = implode('|', $vars_arr); } $res = $asm->Originate2('Local/' . $notify[$i] . '@presence-notify', 9999, 'default', 1, null, null, null, sprintf(Aastra_get_label('%s is back <%s>', $language), $extension, $extension), $vars); flush(); sleep(30); // give them a break inbetween calls, so they don't get flood of them all at once ;) } # Disconnect properly $asm->disconnect();