RestComm / Restcomm-Connect

The Open Source Cloud Communications Platform
http://www.restcomm.com/
GNU Affero General Public License v3.0
244 stars 215 forks source link

Creation and update of CDR records is scattered at VoiceInterpreter and Call actors, create a dedicated actor for that #750

Open gvagenas opened 8 years ago

gvagenas commented 8 years ago

Currently the creation and update of a CDR for a incoming or outgoing call is scattered at VoiceInterprter and/or Call actors. A dedicated actor should create and update CDRs for calls so we can control what states we change. For example a no-answer call should move FSM to completed but the CDR should be no-answer.

VoiceInterpreter and Call actors should use this new actor like:

cdrFactory.tell(callSid, state);
gvagenas commented 8 years ago

related to #794

gvagenas commented 8 years ago

MonitoringService can be this actor. Monitoring service receives updates from Call actors for every state change. The only thing that is left to check is if the MonitoringService will have all the details needed for the creation and update of the CDRs

silazare commented 8 years ago

For particular scenario with conference call we have CDR being updated by Call.java, because both parties make outgoing calls to conference number separately. Problematic pattern for the scenario is the following - when call after conversation part goes from In Progress to In Progress state we have an issue, as final call state goes to Leaving, and it doesnt perform CDR invoke :

private void onLeave(Leave message, ActorRef self, ActorRef sender) throws Exception {
    if (is(inProgress)) {
        fsm.transition(message, leaving);
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("Received Leave for Call: "+self.path()+", but state is :"+fsm.state().toString());
        }
    }
}

In case call goes from In Progress to Updating Media Session state - all is ok, and final call state is Stopping which means that call is completed and recordsDao.updateCallDetailRecord is invoked.

As a solution we could invoke CDR when call state is goes to leaving. Attached detailed state transitions for example scenario. State_transition_conference.xlsx