[Bugfix][T106][task-view-424] zxic do not support rtp in ecall, so need
change to codec mode for ecall
Only Configure: No
Affected branch: unknown
Affected module: ecall
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: yes
Doc Update: no
Change-Id: Icbd5dd76587b308c003fad78167b0d6c6fbe203a
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/cc.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/cc.cpp
index 46ee24a..5048473 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/cc.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/cc.cpp
@@ -122,6 +122,8 @@
#define DTMF_MAX_VOLUME (36)
#define DTMF_MIN_VOLUME (0)
+void speechonff_operation();
+
int get_call_status(void)
{
return inCallstatus;
@@ -1390,6 +1392,16 @@
{
if (autoAnswerMode) {
RLOGD("Auto Answer MT Call!");
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ LYNQ_Audio_Mode cur_voice_audio_mode;
+ lock_rtp_audio_mtx();
+ if(is_use_voice_buffer(&cur_voice_audio_mode) && speechStatus == SPEECH_OFF )
+ {
+ exe_set_voice_audio_mode(cur_voice_audio_mode);
+ speechonff_operation();
+ }
+ unlock_rtp_audio_mtx();
+#endif
android::requestAnswer(soc_id);
}
return;
@@ -1534,29 +1546,35 @@
}
#endif
+void speechonff_operation()
+{
+ //RLOGD("DemoAPP Call shell command (pactl set-card-profile 0 phonecall)");
+ //system("pactl set-card-profile 0 phonecall");
+ //RLOGD("DemoAPP Call shell command end");
+// set_codec(LYNQ_CALL, CODEC_OPEN); //hqing add for Geely demand on 11/07/2022, init cs call, open codec
+ if (get_audio_path() == 0) {
+ mixer_set(1);
+ speechStatus = NORMAL_SPEECH_ON;
+ } else {
+ bt_mixer_set(1);
+ speechStatus = BT_SPEECH_ON;
+ }
+ inCallstatus = CALL_ON;
+ RLOGD("[speech]: set on");
+ sendCallMsg(true); //for Power Manager test
+}
+
+
//void callStateChange(void)
void speechonoff(int callnum)
{
static int callIndex = 0;
RLOGD("callnum = %d, Call State Change then judge speech on/off!", callnum);
callIndex = callnum;
- lock_rtp_audio_mtx();
+ lock_rtp_audio_mtx();
if( callIndex > 0 && speechStatus == SPEECH_OFF) { //speech on
- //RLOGD("DemoAPP Call shell command (pactl set-card-profile 0 phonecall)");
- //system("pactl set-card-profile 0 phonecall");
- //RLOGD("DemoAPP Call shell command end");
-// set_codec(LYNQ_CALL, CODEC_OPEN); //hqing add for Geely demand on 11/07/2022, init cs call, open codec
- if (get_audio_path() == 0) {
- mixer_set(1);
- speechStatus = NORMAL_SPEECH_ON;
- } else {
- bt_mixer_set(1);
- speechStatus = BT_SPEECH_ON;
- }
- inCallstatus = CALL_ON;
+ speechonff_operation();
unlock_rtp_audio_mtx();
- RLOGD("[speech]: set on");
- sendCallMsg(true); //for Power Manager test
} else if (callIndex == 0
&& (speechStatus == NORMAL_SPEECH_ON
|| speechStatus == BT_SPEECH_ON)) { //speech off
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.cpp
index 0da1560..8c63aa2 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.cpp
@@ -232,7 +232,7 @@
}
#ifdef MOBILETEK_TARGET_PLATFORM_T106
-int is_any_call_active(int slot)
+int is_exit_call_in_callist_and_all_call_not_active(int slot)
{
int num;
@@ -246,11 +246,12 @@
{
if(call_state[slot][i]==RIL_CALL_ACTIVE)
{
- return true;
+ return false;
}
}
- return false;
+ return num>0;
}
+
#endif
void update_call_state(void *response, size_t responselen, int slot) {
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.h
index 504d05a..7156f05 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.h
@@ -255,7 +255,7 @@
#endif /*ECALL_SUPPORT*/
#ifdef MOBILETEK_TARGET_PLATFORM_T106
-int is_any_call_active(int slot);
+int is_exit_call_in_callist_and_all_call_not_active(int slot);
#endif
namespace android {
void initRequestInfo(RequestInfo *pRI, int request, int mode, RIL_SOCKET_ID soc_id);
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp
index 218c670..c728665 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ecall/eCall.cpp
@@ -57,6 +57,7 @@
#include "./gost/sslp/ecall/EcallUtils.h"
#include "network.h"
#include "lynq_interface.h"
+#include "call_rtp.h"
#undef LOG_TAG
#define LOG_TAG "DEMO_ECALL"
@@ -518,6 +519,7 @@
return;
}
RequestInfo* pRI = creatRILInfoAndInit(RIL_REQUEST_ECALL_FAST_MAKE_ECALL, UDP, socket_id);
+ pRI->lynqEvent=1;
char** argv = new char*[fast_argv.size()];
for(int i=0; i < fast_argv.size(); i++) {
argv[i] = new char[fast_argv[i].size() +1];
@@ -540,7 +542,7 @@
RLOGE("handleEcallIndication invalid response: NULL");
} else {
RLOGE("handleEcallIndication: invalid response length %d expecting len: %d",
- sizeof(RIL_Ecall_Unsol_Indications), data);
+ datalen,sizeof(RIL_Ecall_Unsol_Indications));
}
return ;
}
@@ -603,7 +605,7 @@
stop_ecall_timer(sT6,sT6_sig_value);
stop_ecall_timer(sT7,sT7_sig_value);
stop_ecall_timer(sRedialTimer, redial_sig_value);
-
+
redial_tag = REDIAL_SUCCESS;
resetEcallIVSandAudio(RSPD, RIL_SOCKET_ID(fast_ecall_socket_id));
saveEcallRecord(p_cur->ind);
@@ -614,7 +616,7 @@
}
case RIL_UNSOL_ECALL_ALACK_CLEARDOWN_RECEIVED: // = 5,
{
- fast_argc = 0;
+ fast_argc = 0;
fast_argv.clear();
stop_ecall_timer(sT2,sT2_sig_value);
stop_ecall_timer(sT5,sT5_sig_value);
@@ -766,11 +768,12 @@
}
case RIL_UNSOL_ECALL_PSAP_CALLBACK_START: // 40
{
+ set_voice_audio_mode_to_value(AUDIO_MODE_CODEC,soc_id);
// Similar to receive 11 + 1
redial_tag = REDIAL_SUCCESS;
stop_ecall_timer(sAutoAnsTimer, autoAns_sig_value);
- stop_ecall_timer(sAutoAnsTimer_ims, autoAns_sig_value_ims);
+ stop_ecall_timer(sAutoAnsTimer_ims, autoAns_sig_value_ims);
autoAnswerEcall(false);
fast_argc = 0;
@@ -1144,6 +1147,11 @@
// setEcallAudioPathOn(true);
act_fecall_socid = -1;
act_feCall_Id = -1;
+
+ if(pRI->lynqEvent==2)
+ {
+ set_voice_audio_mode_to_value(AUDIO_MODE_CODEC,socket_id);
+ }
pRI->pCI->dispatchFunction(p, pRI);
return 0;
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/rtp/call_rtp.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/rtp/call_rtp.cpp
index dd4604e..6a8aeeb 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/rtp/call_rtp.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/rtp/call_rtp.cpp
@@ -50,6 +50,53 @@
return pthread_mutex_unlock(&mtx);
}
+int set_voice_audio_mode_to_value(int setValue,RIL_SOCKET_ID socket_id)
+{
+ int s = lock_rtp_audio_mtx();
+ if(s != 0) {
+ RLOGE("%s lock_rtp_audio_mtx fail",__FUNCTION__);
+ }
+
+ LYNQ_Audio_Mode old_audio_mode;
+ old_audio_mode=s_current_audio_mode;
+ s_current_audio_mode=(LYNQ_Audio_Mode) setValue;
+
+ int rsp_code=0;
+ if((get_call_status() == CALL_ON) && getSpeechStatus() == NORMAL_SPEECH_ON)
+ {
+ if(s_current_audio_mode!=old_audio_mode)
+ {
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ if(is_exit_call_in_callist_and_all_call_not_active((int) socket_id)==false)
+ {
+ rsp_code=5;
+ goto set_audio_mode_end;
+ }
+#endif
+ RLOGE("%s, change mode in real time from %d to %d",__FUNCTION__,old_audio_mode,s_current_audio_mode);
+ if(exe_set_voice_audio_mode(s_current_audio_mode))
+ {
+ rsp_code=4;
+ }
+ }
+ }
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+set_audio_mode_end:
+#endif
+
+ if(rsp_code!=0)
+ {
+ s_current_audio_mode=old_audio_mode;
+ }
+
+ s = unlock_rtp_audio_mtx();
+ if(s != 0) {
+ RLOGE("%s, unlock_rtp_audio_mtx fail",__FUNCTION__);
+ }
+ RLOGE("set_voice_audio_mode %d ret is %d",setValue,rsp_code);
+ return rsp_code;
+}
int set_voice_audio_mode(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
{
@@ -74,57 +121,24 @@
return -1;
}
- int s = lock_rtp_audio_mtx();
- if(s != 0) {
- RLOGE("%s lock_rtp_audio_mtx fail",__FUNCTION__);
- }
-
- LYNQ_Audio_Mode old_audio_mode;
- old_audio_mode=s_current_audio_mode;
- s_current_audio_mode=(LYNQ_Audio_Mode) setValue;
-
- int rsp_code=0;
- if((get_call_status() == CALL_ON) && getSpeechStatus() == NORMAL_SPEECH_ON)
- {
- if(s_current_audio_mode!=old_audio_mode)
- {
-#ifdef MOBILETEK_TARGET_PLATFORM_T106
- if(is_any_call_active(socket_id))
- {
- rsp_code=5;
- goto set_audio_mode_error;
- }
-#endif
- RLOGD("%s, change mode in real time",__FUNCTION__);
- if(exe_set_voice_audio_mode(s_current_audio_mode))
- {
- rsp_code=4;
- goto set_audio_mode_error;
- }
- }
- }
- s = unlock_rtp_audio_mtx();
- if(s != 0) {
- RLOGE("%s, unlock_rtp_audio_mtx fail",__FUNCTION__);
- }
-
- android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_SET_VOICE_AUDIO_MODE,0,0);
+ int rsp_code=set_voice_audio_mode_to_value(setValue,socket_id);
+
+ android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_SET_VOICE_AUDIO_MODE,0,rsp_code);
android::LYNQ_RIL_respSocket(p,(void *)pRI);
free(pRI);
- RLOGD("%s %d finish",__FUNCTION__,setValue);
- return RESULT_OK;
-set_audio_mode_error:
- s_current_audio_mode=old_audio_mode;
- s = unlock_rtp_audio_mtx();
- if(s != 0) {
- RLOGE("%s, unlock_rtp_audio_mtx fail",__FUNCTION__);
- }
-
- android::lynqAssemblyParcelheader(p,socket_id,pRI->uToken,LYNQ_REQUEST_SET_VOICE_AUDIO_MODE,0,rsp_code);
- android::LYNQ_RIL_respSocket(p,(void *)pRI);
- free(pRI);
- return RESULT_ERROR;
+ return rsp_code;
}
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int is_use_voice_buffer(LYNQ_Audio_Mode* cur_mode)
+{
+ (*cur_mode)=exe_get_voice_audio_mode();
+ if((*cur_mode)==AUDIO_MODE_RTP || (*cur_mode) == AUDIO_MODE_FILE || (*cur_mode) == AUDIO_MODE_LOOP_BACK)
+ {
+ return true;
+ }
+ return false;
+}
+#endif
#if 0
int set_remote_rtp_ip(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
@@ -552,24 +566,7 @@
#endif
/*set*/
-#if 0
-void confirm_vb_buffer_open()
-{
- usleep(100*1000);// wait 100ms
- int ret = system("pgrep lynq_vb_demo");
- if(ret!=0)
- {
- char* cmd3="AT+VOICE_BUFFER=0,1";
- char* cmd4="AT+VOICE_PROCESS=1";
- char* argv[2]={0};
- RLOGE("can't find lynq_vb_demo ret is %d",ret);
- argv[1] = cmd3;
- lynqSendAt(2,argv,1013);
- argv[1] = cmd4;
- lynqSendAt(2,argv,1014);
- }
-}
-#endif
+
int exe_set_voice_audio_mode(const LYNQ_Audio_Mode audio_mode)
{
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/rtp/call_rtp.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/rtp/call_rtp.h
index 784c765..03cc9f1 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/rtp/call_rtp.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/rtp/call_rtp.h
@@ -14,7 +14,7 @@
int get_rtp_port(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
int get_rtp_param(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
int get_call_rtp_ssrc(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI);
-
+int set_voice_audio_mode_to_value(int set_value,RIL_SOCKET_ID socket_id);
typedef enum{
AUDIO_MODE_CODEC = 0, /* Codec */
@@ -28,7 +28,10 @@
}LYNQ_Audio_Mode;
int exe_set_voice_audio_mode(const LYNQ_Audio_Mode audio_mode);
LYNQ_Audio_Mode exe_get_voice_audio_mode();
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int is_use_voice_buffer(LYNQ_Audio_Mode* cur_mode);
+#endif
int lock_rtp_audio_mtx();
int unlock_rtp_audio_mtx();