Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

FOP2 Community Forum

  1. Home
  2. Plugins
  3. Queue logged in hints for Queue Agents

Queue logged in hints for Queue Agents

Scheduled Pinned Locked Moved Plugins
7 Posts 3 Posters 479 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    M
    mkeuter
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • N
      N
      nicolas
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • M
        M
        mkeuter
        wrote on last edited by
        #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.

        1 Reply Last reply
        0
        • N
          N
          nicolas
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • J
            J
            joe1981alAPR
            wrote on last edited by
            #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

            1 Reply Last reply
            0
            • J
              J
              joe1981alAPR
              wrote on last edited by
              #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.

              1 Reply Last reply
              0
              • M
                M
                mkeuter
                wrote on last edited by
                #7

                Hi,

                the QUEUEMEMBERADDED and QUEUEMEMBERREMOVED events work fine for me like described above, but when I try to catch the QUEUEMEMBERPAUSED event, it does nothing.

                1 Reply Last reply
                0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                Powered by NodeBB Contributors
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups