Receiving audio during a call through GSM modem

Hello All,

I establish a call, when i receive from an external application at+vrx (this command means that the external application is ready to receive samples that correspond to the audio i receive during the call) i switch to data mode by fcm service and i start to send what i receive in MyLowLevelIrqHandler_Rec (see the code below), each call of MyLowLevelIrqHandler_Rec i send to the external application 320 byte of pStreamBuffer (buffer of received audio samples), i don’t know if this is the way to do so or not, suddenly the application switch to at mode and what the external application has received is very noisy.

static bool MyLowLevelIrqHandler_Rec ( adl_irqID_e Source, adl_irqNotificationLevel_e Notification_Level, adl_irqEventData_t * Data )
{
adl_portSendPriorityDataExt ( pStreamBuffer, 320, port_Rec );

return TRUE;
}

/**MyHighLevelIrqHandler_Rec/

static bool MyHighLevelIrqHandler_Rec ( adl_irqID_e Source, adl_irqNotificationLevel_e Notification_Level, adl_irqEventData_t * Data )
{
return FALSE;
}

/******at+vrx/

void app_VRX_CmdHandler( adl_atCmdPreParser_t * paras )
{

adl_trcPrint(1, "Type=%d NbPara=%d", paras->Type, paras->NbPara);
switch(paras->Type)
{
case ADL_CMD_TYPE_TEST:
	break;
case ADL_CMD_TYPE_READ:
//	read the state from the firmware
	break;
case ADL_CMD_TYPE_PARA:
	if(paras->NbPara > 0)
		TRACE (( 1, ADL_GET_PARAM ( paras, 0 ) ));
	break;
}
port_Rec = paras ->Port;
TRACE (( 1, "Port Recording %d ",port_Rec ));

adl_atSendResponsePort(ADL_AT_RSP, port_Rec, "\r\nCONNECT\r\n");

adl_fcmSwitchV24State(V24handle, ADL_FCM_V24_STATE_DATA);// V24handle is already subscribed

	MyLowLevelIrqHandle_Rec  = adl_irqSubscribe ( MyLowLevelIrqHandler_Rec,  ADL_IRQ_NOTIFY_LOW_LEVEL,  ADL_IRQ_PRIORITY_LOW_LEVEL, ADL_IRQ_OPTION_AUTO_READ );
	MyHighLevelIrqHandle_Rec  = adl_irqSubscribe ( MyHighLevelIrqHandler_Rec,  ADL_IRQ_NOTIFY_HIGH_LEVEL,  ADL_IRQ_PRIORITY_HIGH_LEVEL, ADL_IRQ_OPTION_AUTO_READ );

        TRACE (( 1, " MyLowLevelIrqHandle_Rec: %d  MyHighLevelIrqHandler_Rec: %d ", MyLowLevelIrqHandle_Rec,MyHighLevelIrqHandler_Rec));

						   
	handle_Rec = adl_audioSubscribe ( ADL_AUDIO_VOICE_CALL_RX,MyAudioEventHandler_Rec, ADL_AUDIO_RESOURCE_OPTION_ALLOW_PREEMPTION );
	TRACE (( 1, " and handle_Rec Subscribing: %d ",handle_Rec ));

         Ret = adl_audioGetOption ( handle_Rec,ADL_AUDIO_PCM_8K_16B_MONO_BUFFER_SIZE, &nStreamBufferSize ) ;
	if(Ret  < 0 )
	TRACE (( 1, "ADL cannot get this Option %d",Ret ));
	
	pStreamBuffer = adl_memGet( nStreamBufferSize );


	Ret_Rec = adl_audioStreamListen( handle_Rec, ADL_AUDIO_PCM_MONO_8K_16B,  MyLowLevelIrqHandle_Rec, MyHighLevelIrqHandle_Rec, pStreamBuffer);

	TRACE (( 1, "Ret_Rec listening: %d ",Ret_Rec ));

return;
}

Do you know there is other way to do so ?