POE-Component-Telephony-CTPort
view release on metacpan or search on metacpan
# "ctplaytoneasync"
# SUMMARY: plays a tone asyncronously [non-blocking]
# ARGS: arg1=<tone type>
# RETURN ARGS: arg1=[OK|ERROR]
=pod
=head2 play_tone => $type
Plays a tone. $type can be busy, dialx, dial, or ringback.
A warning is produced if you supply an invalid tone.
=cut
sub play_tone {
my ($kernel, $heap, $type) = @_[KERNEL, HEAP, ARG0];
$type = lc($type);
my $found = 0;
foreach my $t (qw(busy dialx dial ringback)) {
$found = 1 if ($type eq $t);
}
unless ($found) {
warn "play_tone: ctserver does not support tone $type";
return;
}
$kernel->yield(put => sprintf('cmd=ctplaytoneasync src=%d dst=%d arg1=%s argc=1',
$heap->{handle},$heap->{d_handle},$type));
}
Puts the port on hook, like hanging up the phone.
wait_for_ring
Blocks until port detects a ring, then returns. The caller ID (if
present) will be returned.
wait_for_dial_tone
Blocks until dial tone detected on port, then returns.
play_tone => $type
Plays a tone. $type can be busy, dialx, dial, or ringback. A warning is
produced if you supply an invalid tone.
stop_tone
Stops a playing tone
play_stop
Stops current playback.
play => $file _or_ play => \@files _or_ play => [ $file1, $file2, $file3 ]
Plays audio files, playing stops immediately if a DTMF key is pressed.
( run in 0.513 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )