Merge "[Feature][T106]version update to T106-V2.01.01.02P56U09.AP.17.11_CAP.17.11"
diff --git a/ap/project/zx297520v3/prj_vehicle_dc_ref/fs/normal/rootfs/bin/zte_volte_main b/ap/project/zx297520v3/prj_vehicle_dc_ref/fs/normal/rootfs/bin/zte_volte_main
index d7a06fd..140cfd8 100644
--- a/ap/project/zx297520v3/prj_vehicle_dc_ref/fs/normal/rootfs/bin/zte_volte_main
+++ b/ap/project/zx297520v3/prj_vehicle_dc_ref/fs/normal/rootfs/bin/zte_volte_main
Binary files differ
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/mtk_ril_unsol_commands.h b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/mtk_ril_unsol_commands.h
index 5c4f022..48c7c83 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/mtk_ril_unsol_commands.h
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/mtk_ril_unsol_commands.h
@@ -51,4 +51,7 @@
 {RIL_UNSOL_SIP_CALL_PROGRESS_INDICATOR, responseStrings, WAKE_PARTIAL},
 {RIL_UNSOL_CALL_INFO_INDICATION, responseStrings, WAKE_PARTIAL},
 {RIL_UNSOL_SIM_STATUS_COMMAND, responseSimStatus, WAKE_PARTIAL},
+#ifdef MOBILETEK_TARGET_PLATFORM_T106 
+{RIL_UNSOL_AUDIO_DEV_SAMPLERATE, responseInts, WAKE_PARTIAL},
+#endif
 
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
index 0899cbf..90d3409 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
@@ -211,14 +211,14 @@
     #define closeRequest           snprintf(tempPrintBuf, PRINTBUF_SIZE, "%s)", printBuf); \
                                    snprintf(printBuf, PRINTBUF_SIZE, "%s", tempPrintBuf)
     #define printRequest(token, req) if(enable_syslog) {         \
-        RLOGD("[%x]> %s %s", token, requestToString(req), printBuf);} else {\
+        RLOGI("[%x]> %s %s", token, requestToString(req), printBuf);} else {\
         printf("[%x]> %s %s\n", token, requestToString(req), printBuf);}
 
     #define startResponse           sprintf(printBuf, "%s {", printBuf)
     #define closeResponse           snprintf(tempPrintBuf, PRINTBUF_SIZE, "%s}", printBuf); \
                                     snprintf(printBuf, PRINTBUF_SIZE, "%s", tempPrintBuf)
     #define printResponse            if(enable_syslog) { \
-                                    RLOGD("%s", printBuf); } else { \
+                                    RLOGI("%s", printBuf); } else { \
                                     printf("%s\n", printBuf);}
 
     #define clearPrintBuf           printBuf[0] = 0
@@ -2931,71 +2931,71 @@
         startResponse;
 
 #ifdef TELEMATIC_5G_SUPPORT
-        appendPrintBuf("%s[GW_SS.signalStrength=%d,GW_SS.bitErrorRate=%d,GW_SS.timingAdvance=%d,\
-                CDMA_SS.dbm=%d,CDMA_SS.ecio=%d,\
-                EVDO_SS.dbm=%d,EVDO_SS.ecio=%d,EVDO_SS.signalNoiseRatio=%d,\
-                LTE_SS.signalStrength=%d,LTE_SS.rsrp=%d,LTE_SS.rsrq=%d,LTE_SS.rssnr=%d,LTE_SS.cqi=%d,LTE_SS.timingAdvance=%d,\
-                TDSCDMA_SS.signalStrength=%d,TDSCDMA_SS.bitErrorRate=%d,TDSCDMA_SS.rscp=%d,\
-                WCDMA_SS.signalStrength=%d,WCDMA_SS.bitErrorRate=%d,WCDMA_SS.rscp=%d,WCDMA_SS.ecno=%d,\
-                NR_SignalStrength.ssRsrp=%d,NR_SignalStrength.ssRsrq=%d,NR_SignalStrength.ssSinr=%d,\
-                NR_SignalStrength.csiRsrp=%d,NR_SignalStrength.csiRsrq=%d,NR_SignalStrength.csiSinr=%d]",
+        appendPrintBuf("%s[GW.rssi=%d,GW.bER=%d,GW.tA=%d,"
+                "W.rssi=%d,W.bER=%d,W.rscp=%d,W.ecno=%d,"                
+                "LTE.rssi=%d,LTE.rsrp=%d,LTE.rsrq=%d,LTE.rssnr=%d,LTE.cqi=%d,LTE.tA=%d,"                
+                "NR.ssRsrp=%d,NR.ssRsrq=%d,NR.ssSinr=%d,"
+                "NR.csiRsrp=%d,NR.csiRsrq=%d,NR.csiSinr=%d,"
+                "CD.dbm=%d,CD.ecio=%d,"
+                "EV.dbm=%d,EV.ecio=%d,EV.SNR=%d,"
+                "TD.rssi=%d,TD.bER=%d,TD.rscp=%d]",                
                 printBuf,
                 p_cur->GW_SignalStrength.signalStrength,
                 p_cur->GW_SignalStrength.bitErrorRate,
                 p_cur->GW_SignalStrength.timingAdvance,
-                p_cur->CDMA_SignalStrength.dbm,
-                p_cur->CDMA_SignalStrength.ecio,
-                p_cur->EVDO_SignalStrength.dbm,
-                p_cur->EVDO_SignalStrength.ecio,
-                p_cur->EVDO_SignalStrength.signalNoiseRatio,
+                p_cur->WCDMA_SignalStrength.signalStrength,
+                p_cur->WCDMA_SignalStrength.bitErrorRate,
+                p_cur->WCDMA_SignalStrength.rscp,
+                p_cur->WCDMA_SignalStrength.ecno,               
                 p_cur->LTE_SignalStrength.signalStrength,
                 p_cur->LTE_SignalStrength.rsrp,
                 p_cur->LTE_SignalStrength.rsrq,
                 p_cur->LTE_SignalStrength.rssnr,
                 p_cur->LTE_SignalStrength.cqi,
-                p_cur->LTE_SignalStrength.timingAdvance,
-                p_cur->TD_SCDMA_SignalStrength.signalStrength,
-                p_cur->TD_SCDMA_SignalStrength.bitErrorRate,
-                p_cur->TD_SCDMA_SignalStrength.rscp,
-                p_cur->WCDMA_SignalStrength.signalStrength,
-                p_cur->WCDMA_SignalStrength.bitErrorRate,
-                p_cur->WCDMA_SignalStrength.rscp,
-                p_cur->WCDMA_SignalStrength.ecno,
+                p_cur->LTE_SignalStrength.timingAdvance,             
                 p_cur->NR_SignalStrength.ssRsrp,
                 p_cur->NR_SignalStrength.ssRsrq,
                 p_cur->NR_SignalStrength.ssSinr,
                 p_cur->NR_SignalStrength.csiRsrp,
                 p_cur->NR_SignalStrength.csiRsrq,
-                p_cur->NR_SignalStrength.csiSinr);
-#else
-        appendPrintBuf("%s[GW_SS.signalStrength=%d,GW_SS.bitErrorRate=%d,GW_SS.timingAdvance=%d,\
-                CDMA_SS.dbm=%d,CDMA_SS.ecio=%d,\
-                EVDO_SS.dbm=%d,EVDO_SS.ecio=%d,EVDO_SS.signalNoiseRatio=%d,\
-                LTE_SS.signalStrength=%d,LTE_SS.rsrp=%d,LTE_SS.rsrq=%d,LTE_SS.rssnr=%d,LTE_SS.cqi=%d,LTE_SS.timingAdvance=%d,\
-                TDSCDMA_SS.signalStrength=%d,TDSCDMA_SS.bitErrorRate=%d,TDSCDMA_SS.rscp=%d,\
-                WCDMA_SS.signalStrength=%d,WCDMA_SS.bitErrorRate=%d,WCDMA_SS.rscp=%d,WCDMA_SS.ecno=%d]",
-                printBuf,
-                p_cur->GW_SignalStrength.signalStrength,
-                p_cur->GW_SignalStrength.bitErrorRate,
-                p_cur->GW_SignalStrength.timingAdvance,
+                p_cur->NR_SignalStrength.csiSinr,
                 p_cur->CDMA_SignalStrength.dbm,
                 p_cur->CDMA_SignalStrength.ecio,
                 p_cur->EVDO_SignalStrength.dbm,
                 p_cur->EVDO_SignalStrength.ecio,
                 p_cur->EVDO_SignalStrength.signalNoiseRatio,
+                p_cur->TD_SCDMA_SignalStrength.signalStrength,
+                p_cur->TD_SCDMA_SignalStrength.bitErrorRate,
+                p_cur->TD_SCDMA_SignalStrength.rscp);
+#else
+       appendPrintBuf("%s[GW.rssi=%d,GW.bER=%d,GW.tA=%d,"
+                "W.rssi=%d,W.bER=%d,W.rscp=%d,W.ecno=%d,"                
+                "LTE.rssi=%d,LTE.rsrp=%d,LTE.rsrq=%d,LTE.rssnr=%d,LTE.cqi=%d,LTE.tA=%d,"                
+                "CD.dbm=%d,CD.ecio=%d,"
+                "EV.dbm=%d,EV.ecio=%d,EV.SNR=%d,"
+                "TD.rssi=%d,TD.bER=%d,TD.rscp=%d]",              
+                printBuf,
+                p_cur->GW_SignalStrength.signalStrength,
+                p_cur->GW_SignalStrength.bitErrorRate,
+                p_cur->GW_SignalStrength.timingAdvance,
+                p_cur->WCDMA_SignalStrength.signalStrength,
+                p_cur->WCDMA_SignalStrength.bitErrorRate,
+                p_cur->WCDMA_SignalStrength.rscp,
+                p_cur->WCDMA_SignalStrength.ecno,               
                 p_cur->LTE_SignalStrength.signalStrength,
                 p_cur->LTE_SignalStrength.rsrp,
                 p_cur->LTE_SignalStrength.rsrq,
                 p_cur->LTE_SignalStrength.rssnr,
                 p_cur->LTE_SignalStrength.cqi,
-                p_cur->LTE_SignalStrength.timingAdvance,
+                p_cur->LTE_SignalStrength.timingAdvance,                          
+                p_cur->CDMA_SignalStrength.dbm,
+                p_cur->CDMA_SignalStrength.ecio,
+                p_cur->EVDO_SignalStrength.dbm,
+                p_cur->EVDO_SignalStrength.ecio,
+                p_cur->EVDO_SignalStrength.signalNoiseRatio,
                 p_cur->TD_SCDMA_SignalStrength.signalStrength,
                 p_cur->TD_SCDMA_SignalStrength.bitErrorRate,
-                p_cur->TD_SCDMA_SignalStrength.rscp,
-                p_cur->WCDMA_SignalStrength.signalStrength,
-                p_cur->WCDMA_SignalStrength.bitErrorRate,
-                p_cur->WCDMA_SignalStrength.rscp,
-                p_cur->WCDMA_SignalStrength.ecno);
+                p_cur->TD_SCDMA_SignalStrength.rscp);
 #endif
         closeResponse;
 
@@ -4463,7 +4463,7 @@
         if (e != RIL_E_SUCCESS) {
             appendPrintBuf("%s fails by %s", printBuf, failCauseToString(e));
         }
-
+#if 0
         if ((pRI->token & RIL_TOKEN_MARK) == RIL_TOKEN_MARK) {
             printf("%s\n", printBuf ? printBuf : "unkonwn");
         } else if (((pRI->pCI->requestNumber == RIL_REQUEST_DEVICE_IDENTITY)
@@ -4479,7 +4479,7 @@
             }
         }
 
-#if 0
+
         if (fd < 0) {
             RLOGD ("RIL onRequestComplete: Command channel closed");
         }
@@ -4996,6 +4996,13 @@
         handleRingbackTone(data, datalen, soc_id);
         break;
     }
+#ifdef MOBILETEK_TARGET_PLATFORM_T106 
+    case RIL_UNSOL_AUDIO_DEV_SAMPLERATE:
+    {
+        handleAudioDevSampleRate(data, datalen, soc_id);
+        break;
+    }
+#endif
     default:
         break;
     }
@@ -5611,6 +5618,9 @@
         case LYNQ_REQUEST_GET_SMSDATABASE_STATE: return "LYNQ_REQUEST_GET_SMSDATABASE_STATE";
         case RIL_REQUEST_GET_MSISDN: return "GET MSISDN";
         case RIL_REQUEST_RESET_SIMCARD: return "RESET SIMCARD";
+#ifdef MOBILETEK_TARGET_PLATFORM_T106 
+        case RIL_UNSOL_AUDIO_DEV_SAMPLERATE: return "UNSOL_AUDIO_DEV_SAMPLERATE";
+#endif
         /*warren add for t800 ril service 2022/1/22 end*/
         default: return "<unknown request>";
     }
@@ -5816,7 +5826,7 @@
     if(utils::is_suppport_dsss()) {
         int id = Phone_utils::get_enable_sim_for_dsss();
         init(id);
-    }	
+    }    
 }
 
 
@@ -5930,6 +5940,9 @@
         case RIL_UNSOL_ON_USSI: return 1;
         case RIL_UNSOL_ECC_NUM: return 1;
         case RIL_UNSOL_SIP_CALL_PROGRESS_INDICATOR: return 1;
+#ifdef MOBILETEK_TARGET_PLATFORM_T106 
+        case RIL_UNSOL_AUDIO_DEV_SAMPLERATE: return 1;
+#endif
         default: return 0;
     }
 }
@@ -6177,7 +6190,7 @@
         RLOGE("setnonblocking Failed");
         exit(1);
     }
-	
+    
     /* create epoll fd,add socket to epoll */
     ep_fd = epoll_create(LYNQ_SOCKET_ENVNT_FD_MAX);
     //int len = sizeof(struct sockaddr_in);
@@ -6219,7 +6232,7 @@
                 while(recvfrom(server_socket_fd, buffer, LYNQ_SOCKET_BUFFER,0,(struct sockaddr*)&lynqClient_addr, &client_addr_length) != -1)//add while by hq for bug 760 2023/02/09
                 {
                     client_tmp = (lynq_client_t*)buffer;
-                    RLOGD("[LYNQ socketId] utoken=%d,request=%d,len=%d,param=%s",client_tmp->uToken,client_tmp->request,client_tmp->paramLen,client_tmp->param);
+                    RLOGI("[LYNQ socketId] utoken=%d,request=%d,len=%d,param=%s",client_tmp->uToken,client_tmp->request,client_tmp->paramLen,client_tmp->param);
                     //char test[36] = {};
                     //sprintf(test,"test okay len = %d",client_tmp->paramLen);
                     //sendto(server_socket_fd,test,strlen(test),0,(struct sockaddr*)&client_addr,client_addr_length);
@@ -6235,11 +6248,10 @@
                             continue;
                         }
                     }
-                    printf("argc =%d\n",argc);
                     argc = argc+1;
                     for(int t = 0;t<argc;t++)
                     {
-                        RLOGD("warren test argv[%d]=%s\n",t,argv[t]);
+                        RLOGI("warren test argv[%d]=%s\n",t,argv[t]);
                     }
                     COMMAND *command = find_command(argv[0]);
                     if(!command)
@@ -6336,17 +6348,15 @@
 }
 int LYNQ_RIL_respSocket(Parcel &p,RIL_Token t)
 {
-    RLOGD("LYNQ_RIL_respSocket send start");
     ssize_t sent = 0;
     RequestInfo *pRI = (RequestInfo *)t;
+    RLOGI("LYNQ_RIL_respSocket token [%x] event %d app_token %d",pRI->token,pRI->lynqEvent,pRI->uToken);
     if(pRI->lynqEvent!=2)
     {
-        RLOGD("this is internal event!!!");
         return -1;
     }
     int dataSize = p.dataSize();
-    const uint8_t* data = p.data();
-    RLOGD("lynqSocketSend RESPONSE!!!! ");
+    const uint8_t* data = p.data();  
     sent = sendto(server_socket_fd, data, dataSize, 0, (struct sockaddr *)&pRI->uClient_addr, sizeof(pRI->uClient_addr));
     if( sent < 0 )
     {
@@ -6358,20 +6368,14 @@
 }
 int LYNQ_RIL_respSocket_sp(Parcel &p,RequestInfo *pRI)
 {
-    RLOGD("LYNQ_RIL_respSocket send start");
-    int ret =0;
-    bool sendResult =false;
-    ssize_t sent = 0;
-    uint8_t dataLength[4];
-    int verify = 0x55aa;
+    ssize_t sent = 0;   
+    RLOGI("LYNQ_RIL_respSocket token [%x] event %d app_token %d",pRI->token,pRI->lynqEvent,pRI->uToken);    
     int dataSize = p.dataSize();
     const uint8_t* data = p.data();
     if(pRI->lynqEvent!=2)
     {
-        RLOGD("this is internal event!!!");
         return -1;
     }
-    RLOGD("lynqSocketSend RESPONSE!!!! ");
 
     sent = sendto(server_socket_fd, data, dataSize, 0, (struct sockaddr *)&pRI->uClient_addr, sizeof(pRI->uClient_addr));
     if( sent < 0 )
@@ -6421,6 +6425,7 @@
 
 int LYNQ_RIL_urcBroadcast(Parcel &p, int urc_id)
 {
+    printResponse;
     RLOGD("LYNQ_RIL_urcBroadcast send start");
     int ret =0;   
     ssize_t sent = 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..1bfd08e 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
@@ -39,6 +39,10 @@
 static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;

 

 static LYNQ_Audio_Mode s_current_audio_mode=AUDIO_MODE_CODEC;

+#ifdef MOBILETEK_TARGET_PLATFORM_T106 

+#define INVALIDE_SAMPLE_RATE (-1)

+static int s_current_sample_rate=INVALIDE_SAMPLE_RATE;

+#endif

 

 int lock_rtp_audio_mtx()

 {

@@ -50,6 +54,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 +125,129 @@
         return -1;

     }

 

+    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);

+    return rsp_code; 

+}

+#ifdef MOBILETEK_TARGET_PLATFORM_T106 

+void handleAudioDevSampleRate(const void* data, int datalen, RIL_SOCKET_ID soc_id) {

+    if (data == NULL || datalen < sizeof(int)*2) {

+      if (data == NULL) {

+        RLOGE("handleAudioDevSampleRate invalid response: NULL");

+      } else {

+        RLOGE("handleAudioDevSampleRate: invalid response length %d expecting len: %d",

+             datalen, sizeof(int)*2);

+      }

+      return ;

+    }    

+

+    int dev_open = ((int *)data)[0];

+    int sample_rate=0;

+    if(dev_open)

+    {

+        sample_rate= ((int *) data)[1];

+        set_voice_sample_rate(sample_rate,soc_id);

+    }

+    

+    RLOGD("handleAudioDevSampleRate, dev_open: %d, sample_rate: %d",dev_open, sample_rate);

+}

+

+

+int exe_set_voice_only_sample_rate(LYNQ_Audio_Mode audio_mode, int sample_rate)

+{

+    char cmd[256];

+   

+    RLOGD("%s %d %d",__FUNCTION__,audio_mode,sample_rate);

+    if(audio_mode==AUDIO_MODE_RTP)

+    {  

+        system("killall lynq_vb_demo");

+           sprintf(cmd, "echo voice_buffer_rtp_test_start %d | lynq_vb_demo &>/dev/null &", sample_rate);

+        system(cmd);

+    }

+    else if(audio_mode==AUDIO_MODE_FILE)

+    {           

+        system("killall lynq_vb_demo");

+        sprintf(cmd, "echo voice_buffer_test_start %d | lynq_vb_demo &>/dev/null &", sample_rate);

+        system(cmd);

+    }

+    else if(audio_mode==AUDIO_MODE_LOOP_BACK)

+    {  

+        system("killall lynq_vb_demo");

+        sprintf(cmd, "echo voice_buffer_loop_test_start %d | lynq_vb_demo &>/dev/null &", sample_rate);

+        system(cmd);

+    }

+    return RESULT_OK;    

+}

+

+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;

+}

+

+int set_voice_sample_rate(int sample_rate,RIL_SOCKET_ID socket_id)

+{    

     int s = lock_rtp_audio_mtx();

-    if(s != 0) {
+    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 old_sample_rate;

+    old_sample_rate=s_current_sample_rate;

+    s_current_sample_rate= sample_rate; 

 

     int rsp_code=0;

     if((get_call_status() == CALL_ON) && getSpeechStatus() == NORMAL_SPEECH_ON)        

-    {	

-        if(s_current_audio_mode!=old_audio_mode)

+    {    

+        if(s_current_sample_rate!=old_sample_rate)

         {

-#ifdef MOBILETEK_TARGET_PLATFORM_T106 

-            if(is_any_call_active(socket_id))

+            LYNQ_Audio_Mode cur_mode;

+            if(is_use_voice_buffer(&cur_mode)==false)

             {

-                rsp_code=5;

-                goto set_audio_mode_error;

+                goto set_sample_rate_end;

             }

-#endif

-            RLOGD("%s, change mode in real time",__FUNCTION__);

-            if(exe_set_voice_audio_mode(s_current_audio_mode))

+

+            if(is_exit_call_in_callist_and_all_call_not_active((int) socket_id))

             {

-                rsp_code=4;

-                goto set_audio_mode_error;

+                RLOGE("%s in real time before active from %d to %d",__FUNCTION__,old_sample_rate,s_current_sample_rate);

+                if(exe_set_voice_audio_mode(cur_mode))

+                {

+                    rsp_code=5;

+                }

             }

-        }        

-    }    

+            else

+            {

+                RLOGE("%s in real time after active from %d to %d",__FUNCTION__,old_sample_rate,s_current_sample_rate);

+                if(exe_set_voice_only_sample_rate(cur_mode,s_current_sample_rate))

+                {

+                    rsp_code=4;

+                }

+            }

+        }         

+    }     

+

+set_sample_rate_end:

+

+    if(rsp_code!=0)

+    {

+        s_current_sample_rate=old_sample_rate;          

+    }

+          

     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);

-    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;     

+    RLOGE("%s %d ret is %d",__FUNCTION__,sample_rate,rsp_code);

+    return rsp_code;    

 }

+#endif

 

 #if 0

 int set_remote_rtp_ip(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)

@@ -552,31 +675,11 @@
 #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)

 {

 #ifdef MOBILETEK_TARGET_PLATFORM_T106 

-    int ret;

-

-    

     char* cmd1="AT+VOICE_PROCESS=0";

     char* cmd2="AT+VOICE_BUFFER=1,1";

     char* cmd3="AT+VOICE_BUFFER=0,1";

@@ -589,32 +692,42 @@
     RLOGD("%s %d",__FUNCTION__,audio_mode);

     if(audio_mode==AUDIO_MODE_RTP)

     {  

-	    system("killall lynq_vb_demo");

-   	    argv[1] = cmd2;

+        system("killall lynq_vb_demo");

+        argv[1] = cmd2;

         lynqSendAt(2,argv,1012);           

-

-        sprintf(cmd, "echo voice_buffer_rtp_test_start %d | lynq_vb_demo &>/dev/null &", 16000);

+        if(s_current_sample_rate==INVALIDE_SAMPLE_RATE)

+        {

+            s_current_sample_rate=16000;

+        }

+        sprintf(cmd, "echo voice_buffer_rtp_test_start %d | lynq_vb_demo &>/dev/null &", s_current_sample_rate);

         system(cmd);

         

     }

     else if(audio_mode==AUDIO_MODE_FILE)

-    {    	   

+    {           

         system("killall lynq_vb_demo");

         argv[1] = cmd2;

-        lynqSendAt(2,argv,1012);        

-        sprintf(cmd, "echo voice_buffer_test_start %d | lynq_vb_demo &>/dev/null &", 16000);

+        lynqSendAt(2,argv,1012);   

+        if(s_current_sample_rate==INVALIDE_SAMPLE_RATE)

+        {

+            s_current_sample_rate=16000;

+        }

+        sprintf(cmd, "echo voice_buffer_test_start %d | lynq_vb_demo &>/dev/null &", s_current_sample_rate);

         system(cmd);

     }

     else if(audio_mode==AUDIO_MODE_LOOP_BACK)

     {  

-	    system("killall lynq_vb_demo");

+        system("killall lynq_vb_demo");

         argv[1] = cmd1;

         lynqSendAt(2,argv,1011);

         argv[1] = cmd2;

         lynqSendAt(2,argv,1012);      

-        sprintf(cmd, "echo voice_buffer_loop_test_start %d | lynq_vb_demo &>/dev/null &", 16000);

+        if(s_current_sample_rate==INVALIDE_SAMPLE_RATE)

+        {

+            s_current_sample_rate=16000;

+        }

+        sprintf(cmd, "echo voice_buffer_loop_test_start %d | lynq_vb_demo &>/dev/null &", s_current_sample_rate);

         system(cmd);

-

     }

     else // audio_mode==AUDIO_MODE_ALL_CLOSE /AUDIO_MODE_INIT/AUDIO_MODE_CODEC

     {   

@@ -622,7 +735,8 @@
         argv[1] = cmd3;

         lynqSendAt(2,argv,1013);

         argv[1] = cmd4;

-        lynqSendAt(2,argv,1014);       

+        lynqSendAt(2,argv,1014);  

+        s_current_sample_rate=INVALIDE_SAMPLE_RATE;

     }

     RLOGD("%s %d suc",__FUNCTION__,audio_mode);

 #endif

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..fbb79e1 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,12 @@
 }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 set_voice_sample_rate(int sample_rate,RIL_SOCKET_ID socket_id);

+void handleAudioDevSampleRate(const void* data, int datalen, RIL_SOCKET_ID soc_id);

+int is_use_voice_buffer(LYNQ_Audio_Mode* cur_mode);

 

+#endif

 

 int lock_rtp_audio_mtx();

 int unlock_rtp_audio_mtx();

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/mtk_ril_ivt.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/mtk_ril_ivt.h
index dad33d5..24708a9 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/mtk_ril_ivt.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/mtk_ril_ivt.h
@@ -354,6 +354,22 @@
 //only for libvendor-ril
 #define RIL_UNSOL_LOCAL_UPDATE_PDN_INFO_CHANGED (RIL_UNSOL_VENDOR_IVT_BASE + 22)
 
+//LYNQ_ZXW_BUG423_CR_20240520CBA2FB95_Q.HUANG_20241209_START
+#define RIL_UNSOL_VENDOR_LYNQ_BASE 9800
+
+/**
+ * RIL_UNSOL_AUDIO_DEV_SAMPLERATE
+ * same to RIL_UNSOL_AUDIODEV_SAMPLERATE
+ *
+ * Indicates that audio device sample rate.
+ *
+ * "data" is an int *
+ * ((int *)data)[0]  is current audio device state. 0 for close ,1 for  open.
+ * ((int *)data)[1] is sample rate.value is 8000 0r 16000.
+ */
+#define RIL_UNSOL_AUDIO_DEV_SAMPLERATE (RIL_UNSOL_VENDOR_LYNQ_BASE + 0)
+//LYNQ_ZXW_BUG423_CR_20240520CBA2FB95_Q.HUANG_20241209_END
+
 /// @}
 
 /// M
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/mtk_ril_ivt.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/mtk_ril_ivt.h
index dad33d5..24708a9 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/mtk_ril_ivt.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/mtk_ril_ivt.h
@@ -354,6 +354,22 @@
 //only for libvendor-ril
 #define RIL_UNSOL_LOCAL_UPDATE_PDN_INFO_CHANGED (RIL_UNSOL_VENDOR_IVT_BASE + 22)
 
+//LYNQ_ZXW_BUG423_CR_20240520CBA2FB95_Q.HUANG_20241209_START
+#define RIL_UNSOL_VENDOR_LYNQ_BASE 9800
+
+/**
+ * RIL_UNSOL_AUDIO_DEV_SAMPLERATE
+ * same to RIL_UNSOL_AUDIODEV_SAMPLERATE
+ *
+ * Indicates that audio device sample rate.
+ *
+ * "data" is an int *
+ * ((int *)data)[0]  is current audio device state. 0 for close ,1 for  open.
+ * ((int *)data)[1] is sample rate.value is 8000 0r 16000.
+ */
+#define RIL_UNSOL_AUDIO_DEV_SAMPLERATE (RIL_UNSOL_VENDOR_LYNQ_BASE + 0)
+//LYNQ_ZXW_BUG423_CR_20240520CBA2FB95_Q.HUANG_20241209_END
+
 /// @}
 
 /// M
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c
index e05893b..d7aa113 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_cc.c
@@ -926,7 +926,7 @@
 	if(m == 0 || m == 1) {

 		result[0] = m;

 		result[1] = k;

-		RIL_onUnsolicitedResponse(RIL_UNSOL_AUDIODEV_SAMPLERATE, (char *) result, sizeof(result));

+		RIL_onUnsolicitedResponse(RIL_UNSOL_AUDIO_DEV_SAMPLERATE, (char *) result, sizeof(result));//LYNQ_ZXW_BUG423_CR_20240520CBA2FB95_Q.HUANG_20241209_CHANGE RIL_UNSOL_AUDIODEV_SAMPLERATE to RIL_UNSOL_AUDIO_DEV_SAMPLERATE

 	}

 	else if (m == 2) { /*֪ͨ¿ªÊ¼²¥·Å±¾µØÕñÁåÒô*/

 		cc_voice_play_ring_back();