Email Queue Routing

Hello,

I am trying to customize one Scrip I found (
http://requesttracker.wikia.com/wiki/EmailRouting) …

Now what I would like to do is automatically routing and creating the ticket
in the right queue by looking at a queues customField MailDomain where I
store the domain name like: @gmail.com below …

How should I debug my modifications - See Option2 - there (it is not working
yet…:wink: ?

Thanks

Domains we want to move

Option 1 - list the domains here

my %domain_map = (

@gmail.com’ => “TESTGmail”,

@free.fr’ => “TESTFree”

);

Option 2 - get all domain from queues CF

my %domain_map = ();
my $queues = new RT::Queues(RT::SystemUser);
foreach my $queue ($queues->Next) {
$domain_map { $queue->FirstCustomFieldValue(‘MailDomain’) } =
$queue->Name;
}

#Check each of our defined domains for a match
foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
# Domain matches - move to the right queue
$self->TicketObj->SetQueue($domain_map{$domainKey});
}
}

Pierre

Pierre,

Have you tried other methods? If all the email is coming into the same
Queue, why not just move them to another Queue based on the CustomFiled
Value (I’m assuming your using CommandByMail for that). I do this for
several Queues. We have a “Triage” Queue that receives the email tickets and
based on a CF value, moves the ticket to another Queue and even pre-assigns
the owner based on another CF value.

Kenn
LBNLOn Wed, Jan 19, 2011 at 6:09 AM, Pierre Buhas pierre.buhas@duolog.comwrote:

Hello,

I am trying to customize one Scrip I found (
http://requesttracker.wikia.com/wiki/EmailRouting) …

Now what I would like to do is automatically routing and creating the
ticket in the right queue by looking at a queues
customField MailDomain where I store the domain name like: @gmail.com
below …

How should I debug my modifications - See Option2 - there (it is not
working yet…:wink: ?

Thanks

#--------------------------

Domains we want to move

#--------------------------

Option 1 - list the domains here

my %domain_map = (

@gmail.com’ => “TESTGmail”,

@free.fr’ => “TESTFree”

);

Option 2 - get all domain from queues CF

my %domain_map = ();
my $queues = new RT::Queues(RT::SystemUser);
foreach my $queue ($queues->Next) {
$domain_map { $queue->FirstCustomFieldValue(‘MailDomain’) } =
$queue->Name;
}

#---------------------------------------------
#Check each of our defined domains for a match
#---------------------------------------------
foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
# Domain matches - move to the right queue
$self->TicketObj->SetQueue($domain_map{$domainKey});
}
}

Pierre

Hi Kenneth,

I suppose you are talking about a ticket CF. But in this case I presume you
need to set this CF manually when it falls into your triage queue.

Here I was thinking about a Queue CF that will be defining the email
extension (like @bestpractical.com) so that all the tickets sent by
the bestpractical guys are automatically moved from the triage queue to
their queue (bestpractical queue here with my example)… this way there is
not any manual steps for each ticket, only at the queue creation.

The thing is I am uncertain with the usage of the API I am using for the
queue CF … All I could get is the doc from perldoc and examples on the net
… Is there a way to display some debug values ?

Regards

PierreOn 19 January 2011 18:42, Kenneth Crocker kfcrocker@lbl.gov wrote:

Pierre,

Have you tried other methods? If all the email is coming into the same
Queue, why not just move them to another Queue based on the CustomFiled
Value (I’m assuming your using CommandByMail for that). I do this for
several Queues. We have a “Triage” Queue that receives the email tickets and
based on a CF value, moves the ticket to another Queue and even pre-assigns
the owner based on another CF value.

Kenn
LBNL

On Wed, Jan 19, 2011 at 6:09 AM, Pierre Buhas pierre.buhas@duolog.comwrote:

Hello,

I am trying to customize one Scrip I found (
http://requesttracker.wikia.com/wiki/EmailRouting) …

Now what I would like to do is automatically routing and creating the
ticket in the right queue by looking at a queues
customField MailDomain where I store the domain name like: @gmail.com
below …

How should I debug my modifications - See Option2 - there (it is not
working yet…:wink: ?

Thanks

#--------------------------

Domains we want to move

#--------------------------

Option 1 - list the domains here

my %domain_map = (

@gmail.com’ => “TESTGmail”,

@free.fr’ => “TESTFree”

);

Option 2 - get all domain from queues CF

my %domain_map = ();
my $queues = new RT::Queues(RT::SystemUser);
foreach my $queue ($queues->Next) {
$domain_map { $queue->FirstCustomFieldValue(‘MailDomain’) } =
$queue->Name;
}

#---------------------------------------------
#Check each of our defined domains for a match
#---------------------------------------------
foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
# Domain matches - move to the right queue
$self->TicketObj->SetQueue($domain_map{$domainKey});
}
}

Pierre

List,

Opps.On Wed, Jan 19, 2011 at 1:33 PM, Kenneth Crocker kfcrocker@lbl.gov wrote:

Pierre,

No, I was talking about a CF that is already set up with pre-defined values
“Select One”. Each/or severl values can be used to correlate to a Support
Queue.
If you are using COmmandByMail, then a user can send an email with the
Custom Field as a command and the value is set. The scrip in the Triage
Queue receives the Email, validates (ExternalAuth, whatever), The scrip is
triggered because there is a Custom Field value and that scrip re-sets the
QueueID and anything else (ie. owner) you want when the ticket is actually
committed.

Kenn
LBNL

On Wed, Jan 19, 2011 at 10:59 AM, Pierre Buhas pierre.buhas@duolog.comwrote:

Hi Kenneth,

I suppose you are talking about a ticket CF. But in this case I presume
you need to set this CF manually when it falls into your triage queue.

Here I was thinking about a Queue CF that will be defining the email
extension (like @bestpractical.com) so that all the tickets sent by
the bestpractical guys are automatically moved from the triage queue to
their queue (bestpractical queue here with my example)… this way there is
not any manual steps for each ticket, only at the queue creation.

The thing is I am uncertain with the usage of the API I am using for the
queue CF … All I could get is the doc from perldoc and examples on the net
… Is there a way to display some debug values ?

Regards

Pierre

On 19 January 2011 18:42, Kenneth Crocker kfcrocker@lbl.gov wrote:

Pierre,

Have you tried other methods? If all the email is coming into the same
Queue, why not just move them to another Queue based on the CustomFiled
Value (I’m assuming your using CommandByMail for that). I do this for
several Queues. We have a “Triage” Queue that receives the email tickets and
based on a CF value, moves the ticket to another Queue and even pre-assigns
the owner based on another CF value.

Kenn
LBNL

On Wed, Jan 19, 2011 at 6:09 AM, Pierre Buhas pierre.buhas@duolog.comwrote:

Hello,

I am trying to customize one Scrip I found (
http://requesttracker.wikia.com/wiki/EmailRouting) …

Now what I would like to do is automatically routing and creating the
ticket in the right queue by looking at a queues
customField MailDomain where I store the domain name like: @gmail.com
below …

How should I debug my modifications - See Option2 - there (it is not
working yet…:wink: ?

Thanks

#--------------------------

Domains we want to move

#--------------------------

Option 1 - list the domains here

my %domain_map = (

@gmail.com’ => “TESTGmail”,

@free.fr’ => “TESTFree”

);

Option 2 - get all domain from queues CF

my %domain_map = ();
my $queues = new RT::Queues(RT::SystemUser);
foreach my $queue ($queues->Next) {
$domain_map { $queue->FirstCustomFieldValue(‘MailDomain’) } =
$queue->Name;
}

#---------------------------------------------
#Check each of our defined domains for a match
#---------------------------------------------
foreach my $domainKey (keys %domain_map ){
if($self->TicketObj->RequestorAddresses =~ /^.*?${domainKey}/) {
# Domain matches - move to the right queue
$self->TicketObj->SetQueue($domain_map{$domainKey});
}
}

Pierre

my %domain_map = ();
my $queues = new RT::Queues(RT::SystemUser);
foreach my $queue ($queues->Next) {
$domain_map { $queue->FirstCustomFieldValue(‘MailDomain’) } = $queue->Name;
}

That really wants to be a while ( my $queue = $queues->Next ) {

The new is really old-style but should be fine

-kevin

This is my loop on the queues which is not working…

my $queues = new RT::Queues(RT::SystemUser);
foreach my $queue ($queues->Next) {

there must be some mistake above. Is the creation of my variable $queues
correct ?

I also tried the following:

my $queues = new RT::Queues(RT::SystemUser);
while ( my $queue = $queues->Next ) {

but it did not work better. So that’s why I suspect this is the way I get
the list of queues which is not the way it should be…

Any idea ?

Thanks

Pierre BUHAS
+353 1 217 8422

Duolog TechnologiesOn 19 January 2011 21:43, Kevin Falcone falcone@bestpractical.com wrote:

On Wed, Jan 19, 2011 at 02:09:38PM +0000, Pierre Buhas wrote:

my %domain_map = ();
my $queues = new RT::Queues(RT::SystemUser);
foreach my $queue ($queues->Next) {
$domain_map { $queue->FirstCustomFieldValue(‘MailDomain’) } =
$queue->Name;
}

That really wants to be a while ( my $queue = $queues->Next ) {

The new is really old-style but should be fine

-kevin

Pierre:

my $queues = new RT::Queues(RT::SystemUser);
is fine but you need to limit
Just add
$queues->UnLimit;

my $queues = new RT::Queues(RT::SystemUser);
$queues->UnLimit;
foreach my $queue ($queues->Next) {

}

By the way , a comment on your next bit, I am just curious why you build a hash , then you go through it looking for a match??
Why don’t you do
foreach my $queue ($queues->Next) {
my $blah = $queue->FirstCustomFieldValue(‘MailDomain’) ;
If ($self->TicketObj->RequestorAddresses =~ /^.*?${$blah}/) {
$self->TicketObj->SetQueue($queue->id);
return;
}
}

RoyFrom: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Pierre Buhas
Sent: 20 January 2011 09:14
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Email Queue Routing

This is my loop on the queues which is not working…

my $queues = new RT::Queues(RT::SystemUser);
foreach my $queue ($queues->Next) {

there must be some mistake above. Is the creation of my variable $queues correct ?

I also tried the following:

my $queues = new RT::Queues(RT::SystemUser);
while ( my $queue = $queues->Next ) {

but it did not work better. So that’s why I suspect this is the way I get the list of queues which is not the way it should be…

Any idea ?

Thanks

Pierre BUHAS
+353 1 217 8422

Duolog Technologies