All pastes #208477 Raw Edit

Anonymous

public text v1 · immutable
#208477 ·published 2006-10-18 17:17 UTC
rendered paste body
## Request status of messages.
$pop->print("Action: command");
$pop->print("Command: sip show peers");
$pop->print("");

#drenec*CLI> sip show peers
#Name/username    Host            Dyn Nat ACL Mask             Port     Status
#yann/yann        192.168.1.135    D          255.255.255.255  7224     Unmonitored
#rodo/rodo        (Unspecified)    D          255.255.255.255  0        Unmonitored

my ($result, $start)=(0,0);

while (($line = $pop->getline) and ($line !~ /END COMMAND/o))
{
    if ($start) {
        print $line;
        $result = $result + 1 if ((split ' ',$line)[4] > 0);
    }

    $start = 1 if ($line =~ /Name/o);
}

$pop->print("Action: logoff");
$pop->print("");

print "peers.value $result\n";