Ver código fonte

Z991239-5559 #comment 优化音频故障情况下提示功能

80274480 1 ano atrás
pai
commit
e439ebd9da

+ 44 - 20
Module/mod_sipphone/mod_sipphone.cpp

@@ -267,6 +267,7 @@ CSIPEntity::CSIPEntity() : m_pCurrentSession(NULL), m_state(INIT),m_iPickupPhone
 	memset(m_localip, 0, RVC_MAX_IP_LEN);
 	m_bFirstLaunched = false;
 	m_pEndpoint = NULL;
+	m_bMessageBox = false;
 }
 
 
@@ -886,7 +887,7 @@ ErrorCodeEnum CSIPEntity::__OnStart(ErrorCodeEnum preOperationError)
 		//有配置为空的,进关门页
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("audio config is invalid.");
 		SetSoundCardSysVar(SOUNDCARD_CONFIG_EMPTY);
-		GetFunction()->SetSysVar("AuthErrMsg", "音频配置值有为空,请使用硬件配置修改");
+		GetFunction()->SetSysVar("AuthErrMsg", "音频配置缺失,请使用硬件配置修改");
 		return Error_Param;
 	}
 	
@@ -1446,6 +1447,12 @@ ErrorCodeEnum CSIPEntity::SetSoundCardSysVar(const CSimpleStringA& newVal)
 	return spFunction->SetSysVar(SYSVAR_SOUNDCARDSTATE, newVal.GetData());
 }
 
+
+void CSIPEntity::SetMessageBoxFlag(bool bFlag)
+{
+	m_bMessageBox = bFlag;
+}
+
 ErrorCodeEnum CSIPEntity::GetLocalIP()
 {
 #ifdef RVC_OS_WIN
@@ -1614,6 +1621,7 @@ ErrorCodeEnum CSIPEntity::SetHandfreeOutVolume(int iVolume)
 		SaveAudioRunConfig(m_kept_volume_out[DEV_HANDFREE], m_kept_volume_out[DEV_PICKUP], m_kept_volume_in[DEV_HANDFREE], m_kept_volume_in[DEV_PICKUP]);
 	}
 	else{
+		SaveAudioRunConfig(m_kept_volume_out[DEV_HANDFREE], m_kept_volume_out[DEV_PICKUP], m_kept_volume_in[DEV_HANDFREE], m_kept_volume_in[DEV_PICKUP]);
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("HANDFREE out volume keeper create failed!");
 	}
 #else
@@ -1641,11 +1649,9 @@ ErrorCodeEnum CSIPEntity::SetPickupOutVolume(int iVolume)
 			m_kept_volume_out[DEV_PICKUP] = iVolume;
 			SaveAudioRunConfig(m_kept_volume_out[DEV_HANDFREE], m_kept_volume_out[DEV_PICKUP], m_kept_volume_in[DEV_HANDFREE], m_kept_volume_in[DEV_PICKUP]);
 		}
-		else{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("PAD type, ignore pickupout volume adj");
-		}
 	}
 	else{
+		SaveAudioRunConfig(m_kept_volume_out[DEV_HANDFREE], m_kept_volume_out[DEV_PICKUP], m_kept_volume_in[DEV_HANDFREE], m_kept_volume_in[DEV_PICKUP]);
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("PICKUP out volume keeper create failed!");
 	}
 #else
@@ -1674,8 +1680,8 @@ ErrorCodeEnum CSIPEntity::SetHandfreeInVolume(int iVolume)
 	if (m_pKeeperIn[DEV_HANDFREE]) {
 		volume_keeper_change(m_pKeeperIn[DEV_HANDFREE], iVolume);
 		m_kept_volume_in[DEV_HANDFREE] = iVolume;
-		SaveAudioRunConfig(m_kept_volume_out[DEV_HANDFREE], m_kept_volume_out[DEV_PICKUP], m_kept_volume_in[DEV_HANDFREE], m_kept_volume_in[DEV_PICKUP]);
 	}
+	SaveAudioRunConfig(m_kept_volume_out[DEV_HANDFREE], m_kept_volume_out[DEV_PICKUP], m_kept_volume_in[DEV_HANDFREE], m_kept_volume_in[DEV_PICKUP]);
 #else
 	if (m_pAudioMgr) {
 		m_pAudioMgr->audio_set_device_volume(iVolume, conf.audio_handfree_in_dev, true);
@@ -1699,8 +1705,8 @@ ErrorCodeEnum CSIPEntity::SetPickupInVolume(int iVolume)
 	if (m_pKeeperIn[DEV_PICKUP]) {
 		volume_keeper_change(m_pKeeperIn[DEV_PICKUP], iVolume);
 		m_kept_volume_in[DEV_PICKUP] = iVolume;
-		SaveAudioRunConfig(m_kept_volume_out[DEV_HANDFREE], m_kept_volume_out[DEV_PICKUP], m_kept_volume_in[DEV_HANDFREE], m_kept_volume_in[DEV_PICKUP]);
 	}
+	SaveAudioRunConfig(m_kept_volume_out[DEV_HANDFREE], m_kept_volume_out[DEV_PICKUP], m_kept_volume_in[DEV_HANDFREE], m_kept_volume_in[DEV_PICKUP]);
 #else
 	if (m_pAudioMgr) {
 		if (eStand2sType == m_eDeviceType || eStand1SPlusType == m_eDeviceType) {
@@ -1886,19 +1892,27 @@ static int __change_dev(void *arg)
 
 void CSIPEntity::SwitchHandFree()
 {
+	LOG_FUNCTION();
+
 	int rc = 0;
-	
 	CSmartPointer<IEntityFunction> Func = GetFunction();
 	CSimpleStringA strValue("");
 	Func->GetSysVar(SYSVAR_SOUNDCARDSTATE, strValue);
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Sound Card State is %s.", strValue.GetData());
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_bMessageBox %s.", m_bMessageBox ? "true" : "false");
 	if ('B' == strValue[0] || 'H' == strValue[0]) {
-		UIMessageBox evt;
-		evt.uboxtype = 1;
-		evt.strtitle = CSimpleStringA2W("");
-		evt.strmessage = CSimpleStringA2W("免提声卡故障,请使用话筒办理业务");
-		SpSendBroadcast(GetFunction(), SP_MSG_OF(UIMessageBox), SP_MSG_SIG_OF(UIMessageBox), evt);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast SwitchHandFree UIMessageBox.");
+		if (m_bMessageBox) {
+			UIMessageBox evt;
+			evt.uboxtype = 1;
+			evt.strtitle = CSimpleStringA2W("");
+			evt.strmessage = CSimpleStringA2W("免提设备故障,请使用话筒办理业务");
+			SpSendBroadcast(GetFunction(), SP_MSG_OF(UIMessageBox), SP_MSG_SIG_OF(UIMessageBox), evt);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast SwitchHandFree UIMessageBox.");
+			m_bMessageBox = false;
+		}
+		else {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("MessageBox has post, ignore it.");
+		}
 		return;
 	}
 
@@ -1914,19 +1928,28 @@ void CSIPEntity::SwitchHandFree()
 
 void CSIPEntity::SwitchPickup()
 {
-	int rc = 0;
+	LOG_FUNCTION();
 	
+	int rc = 0;
 	CSmartPointer<IEntityFunction> Func = GetFunction();
 	CSimpleStringA strValue("");
 	Func->GetSysVar(SYSVAR_SOUNDCARDSTATE, strValue);
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Sound Card State is %s.", strValue.GetData());
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_bMessageBox %s.", m_bMessageBox ? "true" : "false");
 	if ('B' == strValue[0] || 'P' == strValue[0]) {
-		UIMessageBox evt;
-		evt.uboxtype = 1;
-		evt.strtitle = CSimpleStringA2W("");
-		evt.strmessage = CSimpleStringA2W("话筒声卡故障,请使用免提办理业务");
-		SpSendBroadcast(GetFunction(), SP_MSG_OF(UIMessageBox), SP_MSG_SIG_OF(UIMessageBox), evt);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast SwitchPickup UIMessageBox.");
+		if (m_bMessageBox) {
+			UIMessageBox evt;
+			evt.uboxtype = 1;
+			evt.strtitle = CSimpleStringA2W("");
+			evt.strmessage = CSimpleStringA2W("话筒设备故障,请使用免提办理业务");
+			SpSendBroadcast(GetFunction(), SP_MSG_OF(UIMessageBox), SP_MSG_SIG_OF(UIMessageBox), evt);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast SwitchPickup UIMessageBox.");
+			m_bMessageBox = false;
+		}
+		else {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("MessageBox has post, ignore it.");
+		}
+
 		return;
 	}
 
@@ -2356,6 +2379,7 @@ void CSIPPhoneSession::Handle_MakeCall( SpReqAnsContext<PhoneService_MakeCall_Re
 			else if('P' == strValue[0]) {
 				m_pEntity->m_iPickupPhoneState = ePickupMicrophoneState_Off;
 			}
+			m_pEntity->SetMessageBoxFlag(true);
 		}
 
 		m_pEntity->m_pEndpoint = endpoint_create(m_pEntity, &m_pEntity->conf,m_pEntity->m_iPickupPhoneState);

+ 2 - 0
Module/mod_sipphone/mod_sipphone.h

@@ -322,6 +322,7 @@ public:
 	void SetState(int state);
 	ErrorCodeEnum RealSelfCheck();
 	CSimpleStringA MakeUri(const char *terminal_id);
+	void SetMessageBoxFlag(bool bFlag);
 
 private:
 	ErrorCodeEnum LoadConfig(endpoint_conf_t *conf);
@@ -396,6 +397,7 @@ private:
 	HealthManagerService_ClientBase* m_pHMClient;
 	bool m_bConnectedAssist;
 	bool m_bFirstLaunched;
+	bool m_bMessageBox;
 };