Subject: | Feature and bug for POE Asterisk Manager |
Date: | Wed, 11 Jul 2007 14:29:26 +0100 |
To: | bug-POE-Component-Client-Asterisk-Manager [...] rt.cpan.org |
From: | Paul Williams <info [...] it.alldaypa.com> |
Hi there,
Firstly the obvious and warranted thanks for a great POE component. Its
very handy and seems extremely stable.
I've attached a patch which addresses two problems I've encountered
while using it in production.
1) Couldn't connect to astmanproxy
2) Variables set in asterisk weren't being handled in a usable form
I addressed the problems as follows
1) astmanproxy doesn't give any input when you connect so you can't rely
on that for authentication so I added a param which allows login to be
performed on connection;
89a90,95
Show quoted text
>
> if ($heap->{params}->{Astmanproxy}) {
> # For astmanproxy? Don't wait for a
response
Show quoted text > $heap->{_connected} = 1;
> $kernel->call($_[SESSION] => login =>
splice(@_,ARG0));
Show quoted text > }
2) I set DDI's and other flags in the extension.conf and need to access
them via manager. The current version of your manager class doesn't
handle the "Variable" parameter so I wrote some code to handle it and
add it to the "Variable" input hash param.
326c333,345
< $kv->{$1} = $2;
---
Show quoted text > my $key = $1;
> my $val = $2;
>
> if ($key eq 'Variable',) {
> for ( split /\r/, $val ) {
> s,^Variable\:\s*,,;
> my @parts = split /=/;
> $kv->{$key}{$parts[0]} = $parts[1];
> #print "Variable: $parts[0] =>
$parts[1]\n";
Show quoted text > }
> } else {
> $kv->{$key} = $val;
> }
I hope this is useful for you. Thanks again for a great time saving
piece of code.
Kind regards,
-Paul Williams
Head of IT
www.alldaypa.com
89a90,95
>
> if ($heap->{params}->{Astmanproxy}) {
> # For astmanproxy? Don't wait for a response
> $heap->{_connected} = 1;
> $kernel->call($_[SESSION] => login => splice(@_,ARG0));
> }
324a331
>
326c333,345
< $kv->{$1} = $2;
---
> my $key = $1;
> my $val = $2;
>
> if ($key eq 'Variable',) {
> for ( split /\r/, $val ) {
> s,^Variable\:\s*,,;
> my @parts = split /=/;
> $kv->{$key}{$parts[0]} = $parts[1];
> #print "Variable: $parts[0] => $parts[1]\n";
> }
> } else {
> $kv->{$key} = $val;
> }