projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c3b8e95
)
protocol fixes, #20836
author
Mark Wells
<mark@freeside.biz>
Mon, 25 Feb 2013 04:42:03 +0000
(20:42 -0800)
committer
Mark Wells
<mark@freeside.biz>
Mon, 25 Feb 2013 04:42:03 +0000
(20:42 -0800)
FS/FS/part_export/huawei_hlr.pm
patch
|
blob
|
history
diff --git
a/FS/FS/part_export/huawei_hlr.pm
b/FS/FS/part_export/huawei_hlr.pm
index
fb3b679
..
5a6a983
100644
(file)
--- a/
FS/FS/part_export/huawei_hlr.pm
+++ b/
FS/FS/part_export/huawei_hlr.pm
@@
-18,6
+18,7
@@
tie my %options, 'Tie::IxHash',
'pwd' => { label=>'Operator password' },
'tplid' => { label=>'Template number' },
'hlrsn' => { label=>'HLR serial number' },
'pwd' => { label=>'Operator password' },
'tplid' => { label=>'Template number' },
'hlrsn' => { label=>'HLR serial number' },
+ 'timeout' => { label=>'Timeout (seconds)', default => 120 },
'debug' => { label=>'Enable debugging', type=>'checkbox' },
;
'debug' => { label=>'Enable debugging', type=>'checkbox' },
;
@@
-36,13
+37,13
@@
sub _export_insert {
my( $self, $svc_phone ) = (shift, shift);
# svc_phone::check should ensure phonenum and sim_imsi are numeric
my @command = (
my( $self, $svc_phone ) = (shift, shift);
# svc_phone::check should ensure phonenum and sim_imsi are numeric
my @command = (
- 'ADD TPLSUB',
IMSI => '"'.$svc_phone->sim_imsi.'"',
ISDN => '"'.$svc_phone->phonenum.'"',
TPLID => $self->option('tplid'),
);
unshift @command, 'HLRSN', $self->option('hlrsn')
if $self->option('hlrsn');
IMSI => '"'.$svc_phone->sim_imsi.'"',
ISDN => '"'.$svc_phone->phonenum.'"',
TPLID => $self->option('tplid'),
);
unshift @command, 'HLRSN', $self->option('hlrsn')
if $self->option('hlrsn');
+ unshift @command, 'ADD TPLSUB';
my $err_or_queue = $self->queue_command($svc_phone->svcnum, @command);
ref($err_or_queue) ? '' : $err_or_queue;
}
my $err_or_queue = $self->queue_command($svc_phone->svcnum, @command);
ref($err_or_queue) ? '' : $err_or_queue;
}
@@
-107,7
+108,7
@@
sub _export_delete {
my( $self, $svc_phone ) = (shift, shift);
my @command = (
'RMV SUB',
my( $self, $svc_phone ) = (shift, shift);
my @command = (
'RMV SUB',
- IMSI => '"'.$svc_phone->sim_imsi.'"',
+
#
IMSI => '"'.$svc_phone->sim_imsi.'"',
ISDN => '"'.$svc_phone->phonenum.'"',
);
my $err_or_queue = $self->queue_command($svc_phone->svcnum, @command);
ISDN => '"'.$svc_phone->phonenum.'"',
);
my $err_or_queue = $self->queue_command($svc_phone->svcnum, @command);
@@
-179,15
+180,16
@@
sub command {
$string .= shift(@param) . '=' . shift(@param);
$string .= ',' if @param;
}
$string .= shift(@param) . '=' . shift(@param);
$string .= ',' if @param;
}
- $string .= "\n";
+ $string .= "\n
;
";
my @result;
eval { # timeout
local $SIG{ALRM} = sub { die "timeout\n" };
my @result;
eval { # timeout
local $SIG{ALRM} = sub { die "timeout\n" };
- alarm ($self->option('timeout') ||
3
0);
+ alarm ($self->option('timeout') ||
12
0);
warn "Sending to server:\n$string\n\n" if $DEBUG;
$socket->print($string);
warn "Received:\n";
my $line;
warn "Sending to server:\n$string\n\n" if $DEBUG;
$socket->print($string);
warn "Received:\n";
my $line;
+ local $/ = "\r\n";
do {
$line = $socket->getline();
warn $line if $DEBUG;
do {
$line = $socket->getline();
warn $line if $DEBUG;
@@
-203,11
+205,10
@@
sub command {
return { error => $@ };
} else {
#+++ HLR9820 <date> <time>\n
return { error => $@ };
} else {
#+++ HLR9820 <date> <time>\n
- # skip empty lines
my $header = shift(@result);
my $header = shift(@result);
- return { error => 'malformed response: '.$header }
-
unless $header =~ /^\+\+\+/
;
- $return{header} = $
header
;
+ $header =~ /(\+\+\+.*)/
+
or return { error => 'malformed response: '.$header }
;
+ $return{header} = $
1
;
#SMU #<serial number>\n
$return{smu} = shift(@result);
#%%<command string>%%\n
#SMU #<serial number>\n
$return{smu} = shift(@result);
#%%<command string>%%\n