Queue logged in hints for Queue Agents

  1. 10 years ago

    Hi Nicolas,
    for some customers I have setup BLF keys on the phones for my Queue Agents to dial an extension which toggles login/logout to/from a Queue.
    In the Agent login routine I also set the status for a custom hint (INUSE, NOT_INUSE), so that an Agent could see on the BLF key on the phone, if he's logged into the Queue or not.

    exten => _qm-queue1-XXX,hint,Custom:qm-queue1-${EXTEN:-3}

    Is there a way in FOP2 to adapt this behavior and turn the custom hint on and off, when an Agent is logged in/off through the FOP2 webinterface?

  2. admin

    18 Jul 2014 Administrator

    Using the plugin interface you could intercept queue add/remove events and do things with it. In your case, you should Originate a call to a custom dialplan that will set the hint. Look in FOP 2.27 for the sample plugin.

    The event itself looks like this:

    127.0.0.1            <- Event: QueueMemberAdded
    127.0.0.1            <- Privilege: agent,all
    127.0.0.1            <- Queue: 100
    127.0.0.1            <- Location: SIP/1109
    127.0.0.1            <- MemberName: John Doe
    127.0.0.1            <- StateInterface: 
    127.0.0.1            <- Membership: dynamic
    127.0.0.1            <- Penalty: 30
    127.0.0.1            <- CallsTaken: 0
    127.0.0.1            <- LastCall: 0
    127.0.0.1            <- Status: 1
    127.0.0.1            <- Paused: 0

    In order to catch add events you will need to have this in the plugin .pl file:

    $AMI_Event_Handler{'yourcustomplugin'}{'QUEUEMEMBERADDED'} = sub {
        my $event = shift;
        my @allreturn;
    
        my $location = ${$event}{'Location'};
        my $return  = "Action: Originate\r\n";
        $return .= "Channel: Local/$location\@custom-context-to-set-hint\r\n";
        $return .= "Application: Noop\r\n";
        $return .= "\r\n";
        push @allreturn, $return;
       
        return @allreturn;
    }

    And then have a custom-context-to-set-hint in your dialplan to set your hints.

    You will have to adapt the above to suit your exact requirements.

  3. Hi Nicolas,

    I got something working already. But how can I use 2 different handlers for login and logout in one plugin?
    With 2 different it works for me.

  4. admin

    19 Jul 2014 Administrator

    I think the logout event is QUEUEMEMBERREMOVED. You can repeat the block for that event to have both login and logoff covered.

  5. mkeuter could you share what you have?

    I am interested in this to be used with FreePBX generated hints for the *45<ext>*<queue> toggle. Will confuse my users if we don't have the light change when they change queue state from FOP2.

    Thanks
    Joe

  6. Well after finding that I could launch fop2_server in debug mode, I was able to watch some commands and look over existing plugins to come up with this... I could not get it to upload through web interface though so I just placed it in plugins folder.

    This works with FreePBX generated hints for Ext/Queue toggle keys. (*45<exten>*<queue>). I make no guarantees outside of my setup :geek: I will share for others through, maybe can use as is, modify for your setup or use it for inspiration to take over the world.

    All of these I placed a folder called queuehintfpbx inside of /var/www/html/fop2/admin/plugins then in the FOP2 Manager went to Plugins and enabled it. Not sure if necessary, but seemed so, I reloaded FOP2 service.

    queuehintfpbx.pl

    # file: queuehintfpbx.pl
    # For Queue Add
    $AMI_Event_Handler{'queuehintfpbx'}{'QUEUEMEMBERADDED'} = sub {
        my $event = shift;
        my @allreturn = ();
    	my $return = '';
    
        my $exten = ${$event}{'Location'};
    	my $queue = ${$event}{'Queue'};
    	$exten =~ s/[^0-9]//g;
    	
        $return  = "Action: Command\r\n";
    	$return .= "Command: devstate change Custom:QUEUE$exten*$queue INUSE\r\n";
        $return .= "\r\n";
        push @allreturn, $return;
       
        return @allreturn;
    };
    
    #For Queue Remove
    $AMI_Event_Handler{'queuehintfpbx'}{'QUEUEMEMBERREMOVED'} = sub {
        my $event = shift;
        my @allreturn = ();
    	my $return = '';
    
        my $exten = ${$event}{'Location'};
    	my $queue = ${$event}{'Queue'};
    	$exten =~ s/[^0-9]//g;
    	
        $return  = "Action: Command\r\n";
    	$return .= "Command: devstate change Custom:QUEUE$exten*$queue NOT_INUSE\r\n";
        $return .= "\r\n";
        push @allreturn, $return;
       
        return @allreturn;
    };

    queuehintfpbx.js

    plugins['queuehintfpbx'] = (function() {
        return { 
            loadLang: function(values) {
            },
            setLang: function() {
            },
            init: function() {
            }
        }
    }());

    plugin.xml

    <plugin>
        <rawname>queuehintfpbx</rawname>
        <name>Queue Hint Update Integration</name>
        <version>0.9.8</version>
        <description>Queue Add/Remove Hint Updates for Queues</description>
    	<description-es_ES></description-es_ES>
        <engine>freepbx</engine>
        <changelog>
            *0.9.8*   Initial Release
        </changelog>
    </plugin>

    I have an empty queuehintfpbx.css file and an empty lang folder.

  7. 9 years ago
    Deleted 9 years ago by mkeuter

or Sign Up to reply!