Author Topic: OutboundSevice.getChain alwais returns null  (Read 1819 times)

Offline pavelpg

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
OutboundSevice.getChain alwais returns null
« on: August 27, 2015, 04:14:15 PM »
There is an example in documentation for OutboundService:
public void SimpleOutboundExample implements PlaceListener, CampaignListener {
    OutboundService outboundService ;
    public void SimplePreviewExample(Place samplePlace)
    {
        outboundService = samplePlace.getOutboundService();
        //register to listen for place events, including PlaceEventOutboundChain
        samplePlace.addPlaceListener(this);
        //register your campaign listener
        outboundService.addListener(this) ;
    }
    //method to implement for CampaignListener
    public void handleCampaignEvent(CampaignEvent event)
    {
        // Testing whether it is an event dealing with a new campaign
        if(event.getEventType()==CampaignEvent.Type.CAMPAIGN_ADDED)
        {
            //The agent takes part in a new outbound campaign
            //...
        }
    }
    //PlaceListener methods...
    public void handlePlaceEvent(PlaceEvent event)
    {
        if(event instanceof PlaceEventOutboundChainInfo)
        {
            PlaceEventOutboundChainInfo eventInfo = (PlaceEventOutboundChainInfo) event ;
            System.out.println("Outbound chain event, reason "+
            eventInfo.getReason().toString());
        }
    }
    public void handleInteractionEvent(InteractionEvent event)
    {
        if(event.getStatus() == Interaction.Status.NEW)
        {
            Interaction ixn = event.getInteraction();
            OutboundChain ixnChain = outboundService.getChain(ixn);
            OutboundRecord recordToProcess = ixnChain.getActiveRecord();
            //...
        }
    }
}


But when I run my application I face two strange things:
1. Interaction Event Handler does not recieve  NEW event, it recieves only RINGING, TALK and IDLE events
2. outbondService.getChain(event.getInteraction()) alwais returns NULL.

I only can obtain record using deprecated way (I don't know how to get Chain using deprecated way):
InteractionVoiceOutbound ivo = (InteractionVoiceOutbound)event.getInteraction();
if(ivo.getActiveRecord() != null){
   outboundRecord = ivo.getActiveRecord();
   setEnabledWidgets(false);
}


I want to obtain Chain and Record using recomended way.