Extensions enventually shown DND
Hello!
sometimes some extensions eventually go DND in FOP2. We have two states - available and dnd. But this happens without the user setting DND state neither from the phone nor from the web. Actually the phone is not dnd either. So the extension can be called happily. The astdb reflects e.g. "/fop2state/PJSIP/279 : Do not Disturb" but the phone is actually reachable. As soon as the user sets state from FOP2 or the phone the DND icon goes away in FOP2. We tried restarting fop2 but this does not help it seems to load the state from the astdb upon restart. Any idea how we can trace this down? This happens so randomly we were not able to trace this yet.
regards, Felix
sometimes some extensions eventually go DND in FOP2. We have two states - available and dnd. But this happens without the user setting DND state neither from the phone nor from the web. Actually the phone is not dnd either. So the extension can be called happily. The astdb reflects e.g. "/fop2state/PJSIP/279 : Do not Disturb" but the phone is actually reachable. As soon as the user sets state from FOP2 or the phone the DND icon goes away in FOP2. We tried restarting fop2 but this does not help it seems to load the state from the astdb upon restart. Any idea how we can trace this down? This happens so randomly we were not able to trace this yet.
regards, Felix
Comments
The fop2state ASTDB entry is only set if you set it from FOP2 using the presence box, or if you dial the freepbx feature code for DND by means of override contexts generated by the generate_override_contexts.pl script at install time.
There is no other way for those ASTDB entries from being set.
So, do you have presence dnd plugin? or queue pause from dnd plugin? or the set presence plugin? or maybe your users are just changing presence without your knowledge? Changing presence in FOP2 without a plugin installed does nothing but reflect that state in the FOP2 UI, but you will be able to receive calls normally.
You can also start FOP2 with audit logs enabled to see if anyone is changing presence from FOP2.
we are using neither of these plugins - we are synchronising the phone's DND state with FOP2's DND state (so I assume DND is processed within the phone). Therefore we adjusted the extension management scripts to generate custom events in case a user pushes the DND button:
Aastra_send_userevent_Asterisk2('FOP2ASTDB',array('Family'=>'fop2state','Key'=>'PJSIP/'.$user,'Channel'=>'PJSIP/'.$user,'Value'=>'Do not Disturb'));
(and vice-versa for disabling DND).
The other way round worked out of the box so FOP2 seems to create the needed events for our extension management daemon to set the device DND if someone selects DND in the web interface (it processes extension state and device state events and reacts on them to set the phone's DND state)
Generally this works well. And I can't see a scenario where only the state in FOP2 could change without affecting the other side. I don't think the users are doing something accidentially here as I said if they selected DND accidentially from the FOP2 web interface it should actually effect the phone too which it did not in those cases I described. Furthermore I just recently noticed that my very own extension had the same issue lastly and I usually don't even use the FOP2 web interface and am pretty sure I did not set anything in there for my phone. So I assume it is most probably an event that is being read from the asterisk manager interface and wrongly sets the FOP2 status to dnd.
regards, Felix
FOP2 does not know anything about your Aastra phones, unless it is told otherwise by custom code snippets, and if you have custom code snippets, I cannot help you much as it is not something standard.
Perhaps the AAStra php applications on the server do not always work, but I have no idea about those .php applications or how to troubleshot/debug them.
What I can tell is that the snippet you posted only sends a UserEvent, for being complete it should also add or remove the fop2presence ASTDB entry. Perhaps that is what is missing?
Do you see anything there that is *not* commented and does things with "fop2state" astdb entries?
package FOP2Callbacks;
# Example module to customize and tweak FOP2 behaviour
my %redirected;
sub flashCommand {
# This function is called when certain commands are sent from a flash client
$command = shift;
@parameters = @_;
my $return = "";
my @allreturn = ();
if($command eq "setastdb") {
# DND Integration from FOP2 to FreePBX ASTDB DND
#
# DEPRECATED! All of this can be done from the new plugin
# architecture
#
# This is for debug
#my $cont=0;
#foreach my $param (@parameters) {
# print "command $comando -- Parameter $cont = $param\n";
# $cont++;
#}
#if($parameters[1] eq "fop2state") {
# if($parameters[3] ne "") {
# $return = "Action: Command\r\n";
# $return .= "Command: database put DND ".$parameters[2]." YES\r\n";
# $return .= "\r\n";
# push @allreturn, $return;
# } else {
# $return = "Action: Command\r\n";
# $return .= "Command: database del DND ".$parameters[2]."\r\n";
# $return .= "\r\n";
# push @allreturn, $return;
# }
#}
return @allreturn;
} elsif($command eq "pickupActive") {
#my $cont=0;
#foreach my $param (@parameters) {
# print "command $comando -- Parameter $cont = $param\n";
# $cont++;
#}
#print "Setting redirected(".$parameters[1].")\n";
$redirected{$parameters[0]}=1;
return @allreturn;
} elsif($command eq "auth") {
#my $cont=0;
#foreach my $param (@parameters) {
# print "command $comando -- Parameter $cont = $param\n";
# $cont++;
#}
return @allreturn;
} elsif($command eq "customconference") {
# my $contexto = $parameters[2];
# my $mychannel = main::get_btn_config( "$contexto", $parameters[0], 'MAINCHANNEL');
# my $extension_to_dial = $parameters[1];
#
# $return = "Action: Originate\r\n";
# $return .= "Channel: Local/$extension_to_dial\@from-internal\r\n";
# $return .= "Application: ChanSpy\r\n";
# $return .= "Data: $mychannel,BEq\r\n";
# $return .= "\r\n";
# push @allreturn, $return;
# return @allreturn;
}
}
sub amiCommand {
# Received an event from Asterisk Manager Interfase
$command = shift;
if($command eq "LEAVE") {
# Used with fop2-dummy context for writing a line
# to queue_log so redirects OUT of a queue are not
# counted as abandoned calls
%event = @_;
my $return = "";
my @allreturn = ();
if( defined ( $redirected { $event{Channel} } )) {
# This abandon is in fact a call pickup or redirection
# We perform a dummy originate to log a NOTABANDON event
# in queue_log
delete $redirected { $event{Channel} };
my $tiempo = time();
$tiempo = $tiempo + 30;
my $uniid = $event{Uniqueid};
my $queue = $event{Queue};
$return = "Action: Originate\r\n";
$return .= "Channel: Local/dummy\@fop2-dummy/n\r\n";
$return .= "Application: QueueLog\r\n";
$return .= "Data: $queue,$uniid,NONE,NOTABANDON,0,0,0\r\n";
$return .= "Async: true\r\n";
$return .= "\r\n";
push @allreturn, $return;
return @allreturn;
}
} elsif($command eq "HANGUP") {
# Garbage Collect
%event = @_;
if( defined ( $redirected { $event{Channel} } )) {
# This abandon is in fact a call pickup or redirection
delete $redirected { $event{Channel} };
}
}
}
1;