Buggy code:
if ( formattedRemoteId == null ) { VoiceXMLRESTProxy . log . severe ( String . format ( "RemoveId<seq2seq4repair_space>address<seq2seq4repair_space>is<seq2seq4repair_space>invalid:<seq2seq4repair_space>%s.<seq2seq4repair_space>Ignoring..<seq2seq4repair_space>" , remoteID ) ) ; return Response . ok ( ) . build ( ) ; } String internalSessionKey = ( ( ( ( AdapterAgent . ADAPTER_TYPE_CALL ) + "|" ) + localID ) + "|" ) + formattedRemoteId ; Session session = Session . getSessionByInternalKey ( internalSessionKey ) ; String url = "" ; DDRRecord ddrRecord = null ; if ( ( session != null ) && ( direction . equalsIgnoreCase ( "outbound" ) ) ) { try { url = Dialog . getDialogURL ( session . getStartUrl ( ) , session . getAccountId ( ) , session ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; VoiceXMLRESTProxy . dialogLog . log ( WARNING , config , String . format ( "Dialog<seq2seq4repair_space>url<seq2seq4repair_space>encoding<seq2seq4repair_space>failed.<seq2seq4repair_space>Error:<seq2seq4repair_space>%s<seq2seq4repair_space>" , e . toString ( ) ) , session ) ; } ddrRecord = session . getDDRRecord ( ) ; } else if ( direction . equals ( "inbound" ) ) { if ( session != null ) { session . drop ( ) ; } session = Session . getSessionByInternalKey ( config . getAdapterType ( ) , config . getMyAddress ( ) , formattedRemoteId ) ; if ( session != null ) { String responseMessage = VoiceXMLRESTProxy . checkIfCallAlreadyInSession ( formattedRemoteId , config , session ) ; if ( responseMessage == null ) { session . drop ( ) ; } } session = Session . createSession ( config , formattedRemoteId ) ; session . setAccountId ( config . getOwner ( ) ) ; session . setRemoteAddress ( externalRemoteID ) ; session . storeSession ( ) ; url = config . getURLForInboundScenario ( session ) ; try { <START_BUG> ddrRecord = DDRUtils . createDDRRecordOnIncomingCommunication ( config , config . getOwner ( ) , config . getMyAddress ( ) , url , session ) ; <END_BUG> } catch ( Exception e ) { e . printStackTrace ( ) ; } Broadsoft bs = new Broadsoft ( config ) ; bs . startSubscription ( ) ; } Question question = null ; if ( session != null ) { session . setStartUrl ( url ) ; session . setDirection ( direction ) ; session . setRemoteAddress ( externalRemoteID ) ; session . setType ( ADAPTER_TYPE_CALL ) ; session . addExtras ( ADAPTER_PROVIDER_KEY , BROADSOFT . toString ( ) ) ; session . setAdapterID ( config . getConfigId ( ) ) ; session . storeSession ( ) ; session . setDdrRecordId ( ( ddrRecord != null ? ddrRecord . getId ( ) : null ) ) ; session . storeSession ( ) ; question = session . getQuestion ( ) ; if ( question == null ) { question = Question . fromURL ( url , externalRemoteID , config . getMyAddress ( ) , session . getDdrRecordId ( ) , session , extraParams ) ; } if ( ! ( ServerUtils . isValidBearerToken ( session , config , VoiceXMLRESTProxy . dialogLog ) ) ) { TTSInfo ttsInfo = ServerUtils . getTTSInfoFromSession ( question , session ) ; ttsInfo . setProvider ( VOICE_RSS ) ; String insufficientCreditMessage = ServerUtils . getInsufficientMessage ( ttsInfo . getLanguage ( ) ) ; String ttsurl = ServerUtils . getTTSURL ( ttsInfo , insufficientCreditMessage , session ) ; return Response . ok ( renderExitQuestion ( Arrays . asList ( ttsurl ) , session . getKey ( ) ) ) . build ( ) ; } } else { VoiceXMLRESTProxy . log . severe ( String . format ( "Session<seq2seq4repair_space>not<seq2seq4repair_space>found<seq2seq4repair_space>for<seq2seq4repair_space>internalKey:<seq2seq4repair_space>%s" , internalSessionKey ) ) ; return null ; } if ( question == null ) { question = Question . getError ( config . getPreferred_language ( ) ) ; } session . setQuestion ( question ) ; session . storeSession ( ) ; VoiceXMLRESTProxy . log . info ( ( "Current<seq2seq4repair_space>session<seq2seq4repair_space>info:<seq2seq4repair_space>" + ( ServerUtils . serializeWithoutException ( session ) ) ) ) ; if ( ( session . getQuestion ( ) ) != null ) { if ( ( ( config . getAccountType ( ) ) != null ) && ( config . getAccountType ( ) . equals ( TRIAL ) ) ) { session . addExtras ( VoiceXMLRESTProxy . PLAY_TRIAL_AUDIO_KEY , "true" ) ; } return handleQuestion ( question , config , externalRemoteID , session ) ; } else { return Response . ok ( ) . build ( ) ; } } @ Path ( "answer" ) @ GET @ Produces ( "application//voicexml+xml" ) public Response answer ( @ QueryParam ( "questionId" ) String question_id , @ QueryParam ( "answerId" ) String answer_id , @ QueryParam ( "answerInput" ) String answer_input , @ QueryParam ( "sessionKey" ) String sessionKey , @ QueryParam ( "callStatus" ) String callStatus , @ Context UriInfo ui ) { } @ Path ( "preconnect" ) @ GET @ Produces ( "application//voicexml" ) public Response preconnect ( @ QueryParam ( "remoteID" ) String remoteID , @ QueryParam ( "localID" ) String localID , @ QueryParam ( "redirectID" ) String redirectID , @ Context UriInfo ui ) { } @ Path ( "connected" ) @ GET @ Produces ( "application//voicexml" ) public Response connected ( @ QueryParam ( "remoteID" ) String remoteID , @ QueryParam ( "localID" ) String localID , @ QueryParam ( "redirectID" ) String redirectID , @ Context UriInfo ui ) { } @ Path ( "timeout" ) @ GET @ Produces ( "application//voicexml+xml" ) public Response timeout ( @ QueryParam ( "questionId" ) String question_id , @ QueryParam ( "sessionKey" ) String sessionKey ) throws Exception { } @ Path ( "exception" ) @ GET @ Produces ( "application//voicexml+xml" ) public Response exception ( @ QueryParam ( "questionId" ) String question_id , @ QueryParam ( "sessionKey" ) String sessionKey ) { } public Response hangup ( Session session ) throws Exception { } public Response answered ( String direction , String remoteID , String localID , String sessionKey ) { } @ Path ( "cc" ) @ POST public Response receiveCCMessage ( String xml ) { } @ GET @ Path ( "tts//{textForSpeech}"

Fix:
ddrRecord = DDRUtils . createDDRRecordOnIncomingCommunication ( config , config . getOwner ( ) , formattedRemoteId , url , session ) ;