Extensions enventually shown DND

  1. 8 years ago

    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

  2. admin

    11 Nov 2016 Administrator

    FOP2 presence is standalone based on ASTDB, it is not directly related to phone dnd, or to feature codes dnd (unless you have a plugin that performs that relation).

    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.

  3. Hello!

    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

  4. admin

    14 Nov 2016 Administrator

    FOP2 Presence box does nothing to Asterisk unless there is a plugin or some code in FOP2Callbacks.pm file. Even with plugins, the only thing it does is probably set an extra ASTDB entry like "DND/xxxx" or perhaps set a Device State, but that code lives on the FOP2Callback.pm file (that in recent versions does not intercept presence changes as that is handled now via plugins).

    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?

  5. I am sorry, I actually missed that we OF COURSE use the Presence Box DND Integration plugin in Fop2 I just did not remember that this had to be done. That one we have installed and it actually sets "DND" in FreePBX and is correctly reflected in the FreePBX admin web site. I assume this one is responsible too for the devicestate events, which are caught by our Aastra daemon and handle the mentioned custom events I generate from the aastra scripts. This is the only customization I made. I generate the events as shown above to toggle FOP2 state - which works. But as I said I cannot reproduce the problem manually. If I push the button on the phone the fop2 web setting changes and vice versa. I can observe the corresponding events in ami. So there must be some code segment that is somehow trigged which changes the FOP2 presense box state without doing the rest. The only thing I can find afterwards is the mentioned astdb entry "/fop2state/PJSIP/279 : Do not Disturb" iirc the extension is not shown DND in the FreePBX web either.

  6. admin

    15 Nov 2016 Administrator

    Do you have a file /usr/local/fop2/FOP2Callback.pm ?

    Do you see anything there that is *not* commented and does things with "fop2state" astdb entries?

  7. It looks like following. Should be completely stock we did not touch it in any way.

    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;

  8. admin

    16 Nov 2016 Administrator

    yep. nothing to see there.

or Sign Up to reply!