ASNMTAP
view release on metacpan or search on metacpan
lib/ASNMTAP/Asnmtap/Plugins/Modem.pod view on Meta::CPAN
=item $answer
the latesd $answer (OK, RING, NO CARRIER, ERROR, NO DIALTONE, BUSY or undef) status from Device::Modem
OK : Command executed without errors
RING : Detected phone ring
NO CARRIER : Link not established or disconnected
ERROR : Invalid command or command line too long
NO DIALTONE: No dial tone, dialing not possible or wrong mode
BUSY : Remote terminal busy
returns the exact modem answer in the C<$answer> scalar. C<$answer> typically can contain strings like C<CONNECT 19200> or C<NO CARRIER>, C<BUSY>, ... all standard modem answers to a dial command.
=over 4
=item SKIP HANGUP
in a custom function you can set $$answer to 'SKIP HANGUP' for skipping the function $modem->hangup() on exit, needed for some PABX.
sub actionOnModemResponse {
my ($asnmtapInherited, $parms, $modem, $ok, $answer, $not_connected_guess, $arguments) = @_;
my $debug = $asnmtapInherited->getOptionsValue ('debug');
print 'ASNMTAP::Asnmtap::Plugins::Modem::get_modem_request::actionOnModemResponse: ', $asnmtapInherited->programDescription (), "\n" if ( $debug );
unless ( $$ok ) {
my $ATDT = 'ATDT'. $$parms{phonenumber};
my $busy = ( $$answer eq $ATDT ? 1 : ( $$answer =~ /^$ATDT\s*(?:BUSY)?\s*$/ ? 2 : 0 ) );
if ( $busy ) {
$$answer = 'SKIP HANGUP' if ( $busy == 2 );
print "OK: BUSY\n" if ($debug);
$$ok = 1;
} else {
print "NOK: BUSY\n" if ($debug);
$$not_connected_guess++;
$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, alert => "Cannot dial [". $$parms{phonenumber} ."], answer: BUSY" }, $TYPE{APPEND} );
}
}
return ( ( $$ok and ! $$not_connected_guess ) ? $ERRORS{OK} : $ERRORS{UNKNOWN} );
( run in 0.472 second using v1.01-cache-2.11-cpan-87723dcf8b7 )