Skip Menu |

This queue is for tickets about the POE-Component-Client-Asterisk-Manager CPAN distribution.

Report information
The Basics
Id: 28103
Status: resolved
Priority: 0/
Queue: POE-Component-Client-Asterisk-Manager

People
Owner: Nobody in particular
Requestors: info [...] it.alldaypa.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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; > }
From: andrew [...] etc.gen.nz
Show quoted text
> I've attached a patch which addresses two problems I've encountered > while using it in production. > > 1) Couldn't connect to astmanproxy
Awesome, I'm about to try and do the same thing. Show quoted text
> 2) Variables set in asterisk weren't being handled in a usable form
I will probably want to do this. I've applied the patches, modified the second a little to hopefully make it a little clearer, and resaved this as unifed diffs. Hopefully this makes it easier to apply. Cheers!
From 797f878a5f27869f47ca79c0b73cb0d1ef2f4c5c Mon Sep 17 00:00:00 2001 From: Paul Williams <info@it.alldaypa.com> Date: Tue, 1 Jan 2008 21:26:15 +1300 Subject: [PATCH] Add support for connecting to astmanproxy. --- Manager.pm | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Manager.pm b/Manager.pm index 9d010e7..536e4e4 100644 --- a/Manager.pm +++ b/Manager.pm @@ -87,6 +87,12 @@ sub _start { $heap->{_logged_in} = 0; $heap->{_auth_stage} = 0; $_[KERNEL]->delay( recv_timeout => 5 ); + + if ($heap->{params}->{Astmanproxy}) { + # For astmanproxy? Don't wait for a response + $heap->{_connected} = 1; + $kernel->call($_[SESSION] => login => splice(@_,ARG0)); + } }, ConnectError => sub { my $heap = $_[HEAP]; -- 1.5.2.1
From 3cc51cd6f56de251553f787d4135efc92d49dd86 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven <andrew@etc.gen.nz> Date: Tue, 1 Jan 2008 21:27:20 +1300 Subject: [PATCH] Allow accessing the Variable parameter. Based on the patch from Paul Williams. --- Manager.pm | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Manager.pm b/Manager.pm index 536e4e4..9d93cf7 100644 --- a/Manager.pm +++ b/Manager.pm @@ -328,9 +328,22 @@ sub get_one { my $tmp = $line; $tmp =~ s/\r|\n//g; next unless($tmp); + if ($line =~ m/([\w\-]+)\s*:\s+(.*)/) { - $kv->{$1} = $2; - DEBUG && print "recv key $1: $2\n"; + my $key = $1; + my $val = $2; + DEBUG && print "recv key $key: $val\n"; + + if ($key eq 'Variable',) { + for my $v( split /\r/, $val ) { + $v =~ s/^Variable\:\s*//; + my @parts = split /=/, $v; + $kv->{$key}{$parts[0]} = $parts[1]; + DEBUG && print " recv variable: $parts[0] => $parts[1]\n"; + } + } else { + $kv->{$key} = $val; + } } else { $kv->{content} .= "$line"; } -- 1.5.2.1
Resovled by release of v0.07 Thanks! David On Tue Jan 01 03:36:07 2008, andrew@etc.gen.nz wrote: Show quoted text
> > I've attached a patch which addresses two problems I've encountered > > while using it in production. > > > > 1) Couldn't connect to astmanproxy
> > Awesome, I'm about to try and do the same thing. >
> > 2) Variables set in asterisk weren't being handled in a usable form
> > I will probably want to do this. > > I've applied the patches, modified the second a little to hopefully make > it a little clearer, and resaved this as unifed diffs. Hopefully this > makes it easier to apply. > > Cheers!