perl-skinny: Add call test
- more verbose when incomplete message - guess hostname - do a basic call to Voicemail: + Newcall softkey, wait 5 + Voicemail button, wait 20 + EndCall softkey
This commit is contained in:
parent
63f3948d83
commit
c216c722af
|
@ -49,7 +49,9 @@ sub send {
|
|||
$parsed_count++;
|
||||
}
|
||||
if($parsed_count != scalar(keys %{$self->{'data'}})) {
|
||||
printf "Incomplete message: %d out of %d\n", $parsed_count, scalar(keys %{$self->{'data'}});
|
||||
printf "Incomplete message (type=%s (%X)) %d out of %d\n", Net::Skinny::Protocol::skinny_message_type2str($self->{'type'}), $self->{'type'},
|
||||
$parsed_count, scalar(keys %{$self->{'data'}});
|
||||
print Dumper(@$struct);
|
||||
return;
|
||||
}
|
||||
$self->{'socket'}->send_data($self->{'type'}, $raw);
|
||||
|
|
|
@ -11,12 +11,13 @@ BEGIN {
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Sys::Hostname;
|
||||
use Net::Skinny;
|
||||
use Net::Skinny::Protocol qw/:all/;
|
||||
use Net::Skinny::Message;
|
||||
|
||||
#Config
|
||||
my $skinny_server = '127.0.0.1';
|
||||
my $skinny_server = hostname;
|
||||
my $device_name = "SEP001120AABBCC";
|
||||
my $device_ip = 10+256*(11+256*(12+256*13)); # 10.11.12.13
|
||||
#======
|
||||
|
@ -70,6 +71,7 @@ $socket->receive_message(); # SoftKeyTemplateRes
|
|||
|
||||
$socket->send_message(SOFT_KEY_SET_REQ_MESSAGE);
|
||||
$socket->receive_message(); # SoftKeySetRes
|
||||
$socket->receive_message(); # SelectSoftKeys
|
||||
|
||||
$socket->send_message(
|
||||
LINE_STAT_REQ_MESSAGE,
|
||||
|
@ -82,8 +84,68 @@ $socket->send_message(
|
|||
count => 2
|
||||
);
|
||||
|
||||
while(1) {
|
||||
$socket->sleep(20);
|
||||
for(my $i = 0; $i < 1; $i++) {
|
||||
$socket->sleep(5);
|
||||
$socket->send_message(KEEP_ALIVE_MESSAGE);
|
||||
$socket->receive_message(); # keepaliveack
|
||||
}
|
||||
$socket->sleep(5);
|
||||
|
||||
#NewCall
|
||||
$socket->send_message(
|
||||
SOFT_KEY_EVENT_MESSAGE,
|
||||
event => 2, #NewCall
|
||||
line_instance => 2,
|
||||
call_id => 0
|
||||
);
|
||||
$socket->receive_message(); # SetRinger
|
||||
$socket->receive_message(); # SetSpeakerMode
|
||||
$socket->receive_message(); # SetLamp
|
||||
$socket->receive_message(); # SelectSoftKeys
|
||||
$socket->receive_message(); # DisplayPromptStatus
|
||||
$socket->receive_message(); # ActivateCallPlane
|
||||
$socket->receive_message(); # StartTone
|
||||
|
||||
$socket->sleep(5);
|
||||
|
||||
#VoiceMail
|
||||
$socket->send_message(
|
||||
STIMULUS_MESSAGE,
|
||||
instance_type => 0xf, #VoiceMail
|
||||
instance => 0,
|
||||
);
|
||||
$socket->receive_message(); #
|
||||
$socket->receive_message(); #
|
||||
$socket->receive_message(); #
|
||||
$socket->receive_message(); #
|
||||
$socket->receive_message(); #
|
||||
$socket->receive_message(); #
|
||||
$socket->receive_message(); #
|
||||
$socket->receive_message(); #
|
||||
$socket->receive_message(); #
|
||||
$socket->receive_message(); #
|
||||
|
||||
#
|
||||
$socket->send_message(
|
||||
OPEN_RECEIVE_CHANNEL_ACK_MESSAGE,
|
||||
status => 1,
|
||||
ip => $device_ip,
|
||||
port => 12,
|
||||
pass_thru_party_id => 0,
|
||||
);
|
||||
$socket->receive_message(); # StartMediaTransmission
|
||||
|
||||
$socket->sleep(20);
|
||||
|
||||
#EndCall
|
||||
$socket->send_message(
|
||||
SOFT_KEY_EVENT_MESSAGE,
|
||||
event => 0x09, #NewCall
|
||||
line_instance => 1,
|
||||
call_id => 0
|
||||
);
|
||||
|
||||
while(1) {
|
||||
$socket->receive_message();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue