diff --git a/scripts/perl/FreeSWITCH/Client.pm b/scripts/perl/FreeSWITCH/Client.pm index 9e97218580..01748a8180 100644 --- a/scripts/perl/FreeSWITCH/Client.pm +++ b/scripts/perl/FreeSWITCH/Client.pm @@ -143,7 +143,13 @@ sub sendmsg($$$) { } $self->output("\n"); - return $self->readhash($to); + for(;;) { + $e = $self->readhash(undef); + last if $e->{socketerror} or $e->{'content-type'} eq 'command/reply'; + push @{$self->{events}}, $e; + } + + return $e; } sub command($$) {