Skip to Content

Auto accept / auto answer functionality is quite useful in highly load contact center.

When I’ve been reading a book “Maximizing Your SAP CRM Interaction Center” (ISBN 978-1-59229-197-7) by John Burton I met one interesting sentence there. I will quote it (page 56):

In addition, the system can be configured to either automatically accept the incoming telephone call, or to prompt the agent with blinking accept and reject buttons, allowing the agent to choose whether to accept the call or to send the caller back to the queue.

But I have never met such configuration in the system (started from 7.0 system). In most cases we can configure auto accept function from CMS side.

On SCN we can find some references about this:

Auto Accept a CTI call on WebIC

Automatically Accept Incoming Contact

Auto-answer call SAP CRM and Genesys (G+)

For example, if you use SAP Contact Center solution (former known as SAP BCM) you can start CDT with additional parameter autoanswer. E.g. using http://12.34.56.789:1011/cdt?arg=autoanswer=3 will automatically answer (automatically accept) the call after 3 seconds of ringing.

This approach didn’t fully cover our recent requirements. It can not handle different situations and set different auto-accept timeouts based on some additional data. For instance, based on the channel (phone, email, chat or action) or based on the business data available in SAP CRM.

My solution is based on the following logic: catch the contact starting event (e.g. when Accept button starts to blink), wait for some seconds and then click the Accept button automatically.

After some research I found interesting stuff we can use to facilitate the requirement. It looks quite similar to the way you’re subscribing and handling IC Events or ABAP events in SAP CRM system. But using javascript.

There is a ICClientEventManager class available to register some javascript function as a callback function for an appropriate event. When the event is raised your registered handler (e.g. callback function) will be called.

So we need a BSP component to create a view with some js-code. I created a component ZIC_MISC in BSP_WD_CMPWB transaction with default MainWindow and create a view ZAutoAcceptView assigned to MainWindow.

Then in view’s htm page I used the following code:


<%@page language="abap"%>
<%@extension name="chtmlb" prefix="chtmlb"%>
<%@extension name="thtmlb" prefix="thtmlb" %>
<%@include file="../ic_base/ICDomainRelaxing.htm" %>
<script type="text/Javascript">
  var z_AcceptTime_Phone  = <%= zcl_autoccept_helper=>get_accepttime( 'phone'  ) %>;
  var z_AcceptTime_Mail   = <%= zcl_autoccept_helper=>get_accepttime( 'mail'   ) %>;
  var z_AcceptTime_Chat   = <%= zcl_autoccept_helper=>get_accepttime( 'chat'   ) %>;
  var z_AcceptTime_Action = <%= zcl_autoccept_helper=>get_accepttime( 'action' ) %>;
  var Zaccept_button_id = prefix + "Accept";
  $(window).load( function() {
    if(jQuery.isFunction(window.ZsubscribeSAM))
      ZsubscribeSAM( );
  });
  function ZsubscribeSAM( )
  {
      var callback;
      var eventManager = ICClientEventManager.getInstance( );
      callback = ZprocessMCMEvents;
      eventManager.subscribe( 'com.sap.ic.mcm.events', callback, 99 );
   }
   /* ZHandle SAM MCM Message */
  function ZprocessMCMEvents( message )
  {
    var eventName = mcmGetMessageProperty( message, "event_name" );
    if( eventName == mcmEventContactStarted )
    {
      var autoAcceptTime;
      switch ( wsb_currMedia ) {
        case wsb_cPhone:
          autoAcceptTime = z_AcceptTime_Phone;
          break;
        case wsb_cMail:
          autoAcceptTime = z_AcceptTime_Mail;
          break;
        case wsb_cChat:
          autoAcceptTime = z_AcceptTime_Chat;
          break;
        case wsb_cAction:
          autoAcceptTime = z_AcceptTime_Action;
          break;
        default:
          autoAcceptTime = 0;
      }
      if (autoAcceptTime)
      {
        var timeoutid = setTimeout( ZautoAccept, autoAcceptTime );
      }
    }
  }
  /* Actual AutoAccept */
  function ZautoAccept( )
  {
    var ZacceptButton =  document.getElementById( Zaccept_button_id );
    if( wsb_bCurrAccReq && ZacceptButton )
    {
      ZacceptButton.click( );
    }
  }
</script>

Some explanation:

  1. First of all I get some values for different timeout periods based on different channels (media) from helper z-class zcl_autoccept_helper. Here you can put any logic you want. I used it based on business role, channel and some additional info.
  2. On load of the page I check the existing of my ZATsubscribeSAM function (quite “over protected”, but anyway) and call it.
  3. In it I get mentioned event manager instance. And subscribe ZprocessMCMEvents as a callback function for ‘com.sap.ic.mcm.events’ with the lowest priority possible (I dont’ want to disturb any standard handlers).
  4. In the callback function (which is called on any of events from the ‘com.sap.ic.mcm.events’ “class”) I check the event name. And if it’s ‘ContactStarted’ I decide which timeout to use to start the timer choosing based on current channel.
  5. The timer will call ZautoAccept function after defined period of time.
  6. ZautoAccept in turn gets the element of Accept button, checks if there is still an incoming request (IC agent was as fast as our timer; wsb_bCurrAccReq indicates this) and click the Accept button.

Now I’ll quickly describe how to integrate this view in IC WebUI.

I didn’t use customer javascript files because they’re loaded too early and the code above won’t work in them.

So I decided to integrate my view into IC context area. That’s why I created the described component. And registered it as a layout component under IMG -> CRM -> UI Framework -> Technical Role Definition -> Define Layout Components with id ZAUTOACCEPT.

Additionally I added this new layout component to the context area profile of the appropriate business role in which I wanted auto accept functionality.

IMG -> Interaction Center WebClient (btw handy transaction code is CRM_IC_IMG) -> Basic Functions -> Define Context Area Profile

Here I chose my profile and add ZAUTOACCEPT layout component to it as the usage of extra area # 1 (USAGEEXTRA01).

/wp-content/uploads/2014/07/settings_504302.png

The last step is to configure this area as “visible” (despite there is any visible elements in it). For my role configuration key I created configuration of ICCMP_HEADER/HeaderViewSet and brought USAGEEXTRA01 to “visible” state.

Configuration.png

That’s all. Start IC WebUI and enjoy auto accept functionality!

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Igor Spector

    Hello Andrey,

    Thank you for your very interesting solution.

    I have a little question.

    Method zcl_autoccept_helper=>get_accepttime how can receive data?

    Can you provide some example code for this method?

    Thank you and kind regards.

    Igor

    (0) 
    1. Andrei Vishnevsky Post author

      Hello Igor,

      It can be achieved in different ways.

      It can be simple a constant from case-statement.

      CASE iv_channel.

      WHEN ‘phone’.

           rv_value = ‘2000’.

      WHEN ‘mail’.

           rv_value = ‘3000’.

      …..

      ENDCASE.

      Or it might be retrieved from z-customizing table using channel as an input parameter. Returning value rv_value is a string.

      (0) 

Leave a Reply