POE-Component-Telephony-CTPort
view release on metacpan or search on metacpan
This will module will probably not work on win32. (windows)
RECEIVING EVENTS
Your session will receive an event 'ct_input' ARG0 will be a parsed
version of ARG1. ARG1 is the raw text from the server.
Heres a dump of ARG0, a response from a off_hook event:
{
'src' => '3',
'rly' => 'ctanswer',
'args' => [
'OK'
],
'dst' => '3',
'argc' => '1'
}
This is ARG1 from the above dump.
rly=ctanswer src=3 dst=3 arg1=OK argc=1
You need to check the first arg of args to see if it is an event like
the one listed below.
dtmf
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, *, #
hangup
loopdrop
ring
pickup
timer
cid
flash
toneend
SENDING EVENTS
connect
Connects to the ctserver and port specified in the spawn constructor.
You can also pass a hash ref of hostname and port(1-4) to override.
disconnect
Disconnects from the ctserver.
Note: Disconnecting doesn't stop a currently running record, play, ect.
off_hook
Takes port off hook, like picking up the phone.
on_hook
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.
Any digits pressed while playing will be added to the digit buffer.
It accepts a space seperated list of files: $kernel->post(ctport => play
=> "1 2 3");
or an array of files: $kernel->post(ctport => play => ['hello',
'world']);
Filename extensions:
* The default is .au, can be redefined by posting/calling the
default_ext event with the file extension as the first parameter.
For example: $kernel->post(ctport => default_ext => '.wav');
* You can override the default by providing the extension:
$kernel->post(ctport => play => "hello.wav");
Searches for file in:
* The paths defined by set_path event or as an option to the spawn
constructor: { path => '/var/audio/files/' }
* The current directory
* The "prompts" sub dir (relative to the current directory)
* full path supplied by caller
* /var/ctserver/UsMEng
You can play multiple files
$kernel->post(ctport => play => "Hello World"); (assumes you have
Hello.au and World.au files available) (depending on what the default
extension is set to)
You can "speak" a limited vocabulary: $kernel->post(ctport => play => "1
2 3");
See the /var/ctserver/UsMEng directory for the list of included files
that defines the vocabulary.
record => $file_name => $seconds => $digits
Records $file_name for $seconds seconds or until any of the digits in
$digits are pressed. The path of $file_name is considered absolute if
there is a leading /, otherwise it is relative to the current directory.
record_stop
Stops recording on the current port.
( run in 0.602 second using v1.01-cache-2.11-cpan-6aa56a78535 )