[Feature][ZXW-262][ecall] support ecall

       Affected branch: unknown
       Affected module: unknown
       Is it affected on both ZXIC and MTK: ZXIC
       Self-test: Yes
       Doc Update: No

Change-Id: Id67c9a7a24cd6e363efbef877e8dee97b5a98b34
diff --git a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/at_nvrw_0x00001000.bin b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/at_nvrw_0x00001000.bin
index 9187a44..670b0a7 100755
--- a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/at_nvrw_0x00001000.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/at_nvrw_0x00001000.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/psPriData_nvrw_0x00002000.bin b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/psPriData_nvrw_0x00002000.bin
index a7e322c..955c024 100755
--- a/allbins/zx297520v3/prj_vehicle/nv_dc_ref/psPriData_nvrw_0x00002000.bin
+++ b/allbins/zx297520v3/prj_vehicle/nv_dc_ref/psPriData_nvrw_0x00002000.bin
Binary files differ
diff --git a/ap/lib/libps/220A1_vehicle_dc/ps/nas.a b/ap/lib/libps/220A1_vehicle_dc/ps/nas.a
index 8a046c2..3ce3827 100755
--- a/ap/lib/libps/220A1_vehicle_dc/ps/nas.a
+++ b/ap/lib/libps/220A1_vehicle_dc/ps/nas.a
Binary files differ
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 5d1ea71..32edd33 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
@@ -599,6 +599,7 @@
     }
     case RIL_UNSOL_ECALL_SENDING_MSD: // = 2,
     {
+        stop_ecall_timer(sT5, sT5_sig_value); //add by hq at 20240410 for match zxic
         start_ecll_timer(sT7,sT7_sig_value, T7_TIMEOUT);
         act_fecall_socid = soc_id;
         act_feCall_Id = p_cur->call_id;
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 db37353..65b69e4 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
@@ -7685,6 +7685,7 @@
 #endif
 
     free(eCallReqMsg.address);
+    free(eCallReqMsg.msd_data); //add by hq at 20240411 to prevent memory leak
 
 #ifdef MEMSET_FREED
     memset(&eCallReqMsg, 0, sizeof(eCallReqMsg));
@@ -7744,6 +7745,8 @@
     memset(eCallSetMsd.msd_data, 0, eCallSetMsd.length);
 #endif
 
+    free(eCallSetMsd.msd_data);//add by hq at 20240411 to prevent memory leak
+
 #ifdef MEMSET_FREED
     memset(&eCallSetMsd, 0, sizeof(eCallSetMsd));
 #endif
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/zxic_ril_ivt.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/zxic_ril_ivt.h
index 3b750a3..79bae1e 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/zxic_ril_ivt.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/include/telephony/zxic_ril_ivt.h
@@ -245,6 +245,11 @@
     char* msd_data;
 }RIL_ECallDialInfo;
 
+typedef struct{
+    int arg_num; //ȡֵ0 Çå³ýtestnum, 1 ½«testnumÉèÖÃΪ¡°¡±, 2 ½«testnumÉèÖÃΪaddress
+    int type;    //0 set testnum  1 set uri
+    char* address;
+}RIL_ECallNumSet;
 typedef enum{    
     RIL_UNSOL_ECALL_EVENT_CONNECTING = 0, //¿ªÊ¼²¦´òecallµç»°
     RIL_UNSOL_ECALL_EVENT_ALERTING = 1, //ºô³ö³É¹¦£¬¶Ô·½½øÈëÕñÁå½×¶Î
@@ -263,6 +268,7 @@
     RIL_UNSOL_ECALL_EVENT_END_T2_TIMER = 14, //T2 timer³¬Ê±£¬Õý³£¹Ò¶Ï
     RIL_UNSOL_ECALL_EVENT_PSAP_SYN_LOCK = 15,
     RIL_UNSOL_ECALL_EVENT_ECALLONLY_DEREGISTRATION = 16, //T10³¬Ê±È¥×¢²á
+    RIL_UNSOL_ECALL_EVENT_PSAP_CALLBACK_START = 17, //MT ºô½ÐµÄµÚ1´ÎMSD¸üÐÂ
 	RIL_UNSOL_ECALL_EVENT_MAX = 0xffff
 }RIL_ECallIndication;
 
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/libril/ril.cpp b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/libril/ril.cpp
index a4f1772..a28d0bd 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/libril/ril.cpp
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/libril/ril.cpp
@@ -4512,6 +4512,7 @@
 	char *smsData[2] = {"","11000D91684157913646F80008000E0064006400640064006400640064"};//86 14 75 19 63 64 8F//684157913646F8
 	char *mccmnc = NULL;
 	char *phonenum = NULL;
+	RIL_ECallNumSet ecallNumSet;
 	RIL_ECallMsdData ecallMsdData;
 	RIL_ECallDialInfo ecallReq;	
 	int ecall_type;
@@ -4960,10 +4961,17 @@
 			}			
             break;
 		case SET_TEST_NUM:
-            if(3 == number) {
-				phonenum = args[1];
-				issueLocalRequest(RIL_REQUEST_ZXIC_ECALL_SET_TEST_NUM, phonenum, strlen(phonenum), socket_id);
-			}
+             if((3 == number) || (4 == number) || (5 == number)) {
+				RLOGI("Debug port: SET_TEST_NUM");
+	            ecallNumSet.arg_num = atoi(args[1]);
+				if(1 == ecallNumSet.arg_num){
+					ecallNumSet.type = atoi(args[2]);
+				} else if (2 == ecallNumSet.arg_num) {
+					ecallNumSet.type = atoi(args[2]);
+					ecallNumSet.address = args[3];
+				}     							
+	    		issueLocalRequest(RIL_REQUEST_ZXIC_ECALL_SET_TEST_NUM, &ecallNumSet, sizeof(ecallNumSet), socket_id); 			
+    		}
 			else {
 				RLOGI("number(%d) error.",number);
 			}	
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/reference-ril.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/reference-ril.c
index af83267..f9a0f6c 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/reference-ril.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/reference-ril.c
@@ -586,6 +586,39 @@
 	pinfo->type = RRR_DATATYPE_STRUCT;

 }

 

+static void ril_ref_fillin_data_testnum(RilRefReqInfo *pinfo, void *data, size_t datalen)

+{

+	RIL_ECallNumSet *s_ecallNumSet = NULL;

+	RIL_ECallNumSet *d_ecallNumSet = NULL;

+	int slen;

+

+	if (NULL != data) {

+		s_ecallNumSet = (RIL_ECallNumSet *)data;

+		d_ecallNumSet = malloc(sizeof(RIL_ECallNumSet));

+		if (NULL == d_ecallNumSet) {

+			assert(0);

+			return;

+		}

+		memcpy(d_ecallNumSet, s_ecallNumSet, sizeof(RIL_ECallNumSet));

+

+		if ((2 == s_ecallNumSet->arg_num) && (NULL != s_ecallNumSet->address)) {

+			slen = strlen(s_ecallNumSet->address) + 1;

+			d_ecallNumSet->address = (char *)malloc(slen);

+			memset(d_ecallNumSet->address, 0, slen);

+			memcpy(d_ecallNumSet->address, s_ecallNumSet->address, slen - 1);

+		}		

+			

+		pinfo->data = (void *)d_ecallNumSet;

+		pinfo->datalen = datalen;

+

+		pinfo->type = RRR_DATATYPE_TESTNUM;

+	} else {

+		pinfo->type = RRR_DATATYPE_NULL;

+		pinfo->datalen = 0;

+	}

+}

+

+

 static void ril_ref_fillin_data_msd(RilRefReqInfo *pinfo, void *data, size_t datalen)

 {

 	RIL_ECallMsdData *s_ecallMsdData = NULL;

@@ -765,6 +798,8 @@
 			stype = SERVICE_TYPE_SIM;

 		} else if ((RIL_REQUEST_ZXIC_ECALL_SET_IVS <= request) && (RIL_REQUEST_ZXIC_ECALL_SET_CONFIG >= request)) {

 			stype = SERVICE_TYPE_CC;

+		} else if ((RIL_REQUEST_ECALL_SET_IVS <= request) && (RIL_REQUEST_ECALL_SET_REGISTRATION_STATE >= request)) {

+			stype = SERVICE_TYPE_CC;

 		}

 	}

 

@@ -862,6 +897,23 @@
 	free(data);

 }

 

+static void ril_ref_free_data_testnum(void *data)

+{

+	RIL_ECallNumSet *ecalltestnum = NULL;	

+

+	if(NULL == data) {

+		return;

+	}

+	ecalltestnum = (RIL_ECallNumSet *)data;

+	

+	if (NULL != ecalltestnum->address) {

+		free(ecalltestnum->address);

+	}	

+

+	free(data);

+}

+

+

 static void ril_ref_free_data_msd(void *data)

 {

 	RIL_ECallMsdData *ecallMsdData = NULL;

@@ -931,6 +983,9 @@
 		case RRR_DATATYPE_SMSWRITE:

 			ril_ref_free_data_smswrite(pinfo->data);

 			break;

+		case RRR_DATATYPE_TESTNUM:

+			ril_ref_free_data_testnum(pinfo->data);

+			break; 

 		case RRR_DATATYPE_MSDDATA:

 			ril_ref_free_data_msd(pinfo->data);

 			break;

@@ -1111,9 +1166,7 @@
 		datalen=strlen(data);

     //rita modify(add) for bug id 165/27 2023/9/12 end

 	case RIL_REQUEST_OEM_HOOK_RAW:

-	case RIL_REQUEST_ECALL_SET_TEST_NUM:

 	case RIL_REQUEST_ECALL_SET_RECONF_NUM:	

-	case RIL_REQUEST_ZXIC_ECALL_SET_TEST_NUM:

 	case RIL_REQUEST_ZXIC_ECALL_SET_RECONF_NUM:	

 		node = ril_ref_req_packet(request, t);

 		if (NULL == node) {

@@ -1195,6 +1248,15 @@
 		ril_ref_fillin_data_smswrite((RilRefReqInfo *)node->rrr_info, data, datalen);

 		ril_ref_enqueue(node);

 		break;

+	case RIL_REQUEST_ECALL_SET_TEST_NUM:	

+	case RIL_REQUEST_ZXIC_ECALL_SET_TEST_NUM:

+		node = ril_ref_req_packet(request, t);

+		if (NULL == node) {

+			goto error;

+		}

+		ril_ref_fillin_data_testnum((RilRefReqInfo *)node->rrr_info, data, datalen);

+		ril_ref_enqueue(node);

+		break;

 	case RIL_REQUEST_ECALL_SET_MSD:	

 	case RIL_REQUEST_ZXIC_ECALL_SET_MSD:

 		node = ril_ref_req_packet(request, t);

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 5249bcf..83dd3ed 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
@@ -1066,23 +1066,57 @@
 

 void requestSetTestnum(void *data, size_t datalen __unused, RIL_Token t)

 {

-	char* pnumber;

-	int ret;

-	char *cmd;	

+	RIL_ECallNumSet* pECallNumSet = NULL;	   

+	char *cmd, *pnumber;

+

 	ATResponse *p_response = NULL;

+	int ret;

 	

-	pnumber = (char *)data;	

-		

-	if((NULL == pnumber) || (strlen(pnumber) > ECALL_PHONENUM_MAX)) {

-		RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

-		return;

-	}	

-	RLOGI("requestSetTestnum=%s", pnumber);

-	if (asprintf(&cmd, "AT+ZECALLNUM=1,0,%s", pnumber) < 0) {

+	if (NULL == data) {

 		RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

 		return;

 	}

 

+	pECallNumSet = (RIL_ECallNumSet*)data;

+

+	RLOGI("pECallNumSet->arg_num=%d", pECallNumSet->arg_num);

+	if (0 == pECallNumSet->arg_num) { //清除testnum

+		if (asprintf(&cmd, "AT+ZECALLNUM=0") < 0) {

+			RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

+			return;

+		}

+	} else if (1 == pECallNumSet->arg_num) {

+		if (0 == pECallNumSet->type) { //将testnum设置为“”

+			if (asprintf(&cmd, "AT+ZECALLNUM=0,0") < 0) {

+				RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

+				return;

+			}

+		} else if (1 == pECallNumSet->type) { //将uri设置为“”

+			//do nothing

+			RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);

+			return;

+		}

+	} else if (2 == pECallNumSet->arg_num) {

+		pnumber = (char *)pECallNumSet->address;		

+		if((NULL == pnumber) || (strlen(pnumber) > ECALL_PHONENUM_MAX)) {

+			RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

+			return;

+		}	

+		

+		RLOGI("requestSetTestnum=%s", pnumber);

+		if (0 == pECallNumSet->type) { //将testnum设置为pnumber

+			if (asprintf(&cmd, "AT+ZECALLNUM=1,0,%s", pnumber) < 0) {

+				RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);

+				return;

+			}

+		} else if (1 == pECallNumSet->type) { //将uri设置为pnumber

+			//do nothing

+			RIL_onRequestComplete(t, RIL_E_SUCCESS, NULL, 0);

+			return;

+		}

+				

+	}	

+

 	ret = at_send_command(cmd, &p_response);

 

 	free(cmd);

@@ -1603,10 +1637,67 @@
 	at_response_free(p_response);

 }

 

+/*add by hq at 2024/04/07 for ecall begin*/

+int convert_ecall_ind_to_mtk_ind(RIL_ECallIndication zxic_ind)	

+{

+	switch(zxic_ind) {

+	

+		case RIL_UNSOL_ECALL_EVENT_CONNECTING: // eCall start a request to connect to PSAP

+			return 9; //dialing

+	

+		case RIL_UNSOL_ECALL_EVENT_ALERTING:

+			return 10;//alerting

+			

+		case RIL_UNSOL_ECALL_EVENT_CONNECTED:

+		   return RIL_UNSOL_ECALL_ACTIVE;

+		   

+		case RIL_UNSOL_ECALL_EVENT_END_ABNORMAL:

+   		   return RIL_UNSOL_ECALL_ABNORMAL_HANGUP;

+		   

+		case RIL_UNSOL_ECALL_EVENT_END_FROM_PASP:

+		   return RIL_UNSOL_ECALL_DISCONNECTED;

+		   

+		case RIL_UNSOL_ECALL_EVENT_END_FROM_USER:

+		   return RIL_UNSOL_ECALL_DISCONNECTED;

+		   

+		case RIL_UNSOL_ECALL_EVENT_PSAP_HANGUP_CALL:

+   		   return RIL_UNSOL_ECALL_DISCONNECTED;	

+		   

+		case RIL_UNSOL_ECALL_EVENT_MSD_START_SENDING:

+		   return RIL_UNSOL_ECALL_SENDING_MSD;

+		   

+		case RIL_UNSOL_ECALL_EVENT_ALACK_CLEARDOWN_RECEIVED:

+		   return RIL_UNSOL_ECALL_ALACK_CLEARDOWN_RECEIVED;

+

+		case RIL_UNSOL_ECALL_EVENT_ALACK_POSITIVE_RECEIVED:

+		   return RIL_UNSOL_ECALL_ALACK_POSITIVE_RECEIVED;					

+		   

+		case RIL_ECALL_STATE_MSD_LLACK:

+		   return RIL_UNSOL_ECALL_LLACK_RECEIVED;

+		   

+		case RIL_UNSOL_ECALL_EVENT_MSDUPDATE_PSAP_REQURE:

+			return RIL_UNSOL_ECALL_SENDING_START;

+			

+		case RIL_UNSOL_ECALL_EVENT_ECALLONLY_DEREGISTRATION:

+			return RIL_UNSOL_ECALL_ONLY_DEREGISTRATION;

+

+		case RIL_UNSOL_ECALL_EVENT_PSAP_CALLBACK_START:

+			return RIL_UNSOL_ECALL_PSAP_CALLBACK_START;

+			

+		default:	

+			return RIL_UNSOL_ECALL_UNSPECIFIED;	

+	}

+}

+/*add by hq at 2024/04/07 for ecall end*/

+

 void handle_ecallstate(const char *s, const char *smsPdu)

 {

 	char *line = s;

-	RIL_EcallUnsolIndications ecall_state_indicate = {0};

+	/*modify by hq at 2024/04/07 for ecall begin*/

+	/*  RIL_EcallUnsolIndications ecall_state_indicate = {0};*/

+	RIL_Ecall_Unsol_Indications ecall_state_indicate = {0};

+	/*modify by hq at 2024/04/07 for ecall end*/

+	

 	int err;	

 	unsigned int id;

 	unsigned int idr;

@@ -1660,57 +1751,57 @@
 			//do nothing			

 			return;

 		case RIL_ECALL_STATE_CONNECTING: // eCall start a request to connect to PSAP

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_CONNECTING;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_CONNECTING);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_ALERTING:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_ALERTING;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ALERTING);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_INCOMING: //ÔÝδʹÓÃ

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_INCOMING;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_INCOMING);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_CALL_CONNECTED:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_CONNECTED;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_CONNECTED);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_CALL_END_ABNORMAL:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_END_ABNORMAL;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_ABNORMAL);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_CALL_END_FROM_PSAP:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_END_FROM_PASP;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_FROM_PASP);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_END_FROM_USER:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_END_FROM_USER;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_FROM_USER);/*modify by hq at 2024/04/07 for ecall*/

 			break;			

 		case RIL_ECALL_STATE_PSAP_HUNGUP_CALL:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_PSAP_HANGUP_CALL;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_PSAP_HANGUP_CALL);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_REDIAL_END:			

 		case RIL_ECALL_STATE_DROP_AND_REDIAL_FAILED:			

 			//do nothing

 			return;

 		case RIL_ECALL_STATE_MSD_START_SENDING:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_MSD_START_SENDING;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_MSD_START_SENDING);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_SEND_SUCCESS:

 			if(1 == clear_down){

-				ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_ALACK_CLEARDOWN_RECEIVED;

+				ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ALACK_CLEARDOWN_RECEIVED);/*modify by hq at 2024/04/07 for ecall*/

 			} else if (0 == clear_down) {

-				ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_ALACK_POSITIVE_RECEIVED;

+				ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ALACK_POSITIVE_RECEIVED);/*modify by hq at 2024/04/07 for ecall*/

 			} else {

 				return;

 			}

 			

 			break;

 		case RIL_ECALL_STATE_SEND_FAILURE:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_MSD_SEND_FAILURE;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_MSD_SEND_FAILURE);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_CALL_END_T2_TIMER:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_END_T2_TIMER;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_END_T2_TIMER);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_MSD_LLACK:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_LLACK_RECEIVED;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_LLACK_RECEIVED);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_IVS_PSAP_SYN_LOCK:

-			ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_PSAP_SYN_LOCK;

+			ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_PSAP_SYN_LOCK);/*modify by hq at 2024/04/07 for ecall*/

 			break;

 		case RIL_ECALL_STATE_UNKNOWN:

 		default:	

@@ -1718,7 +1809,7 @@
 	}

 	

 	s_ecallMsdData.call_id = id;

-	RIL_onUnsolicitedResponse(RIL_UNSOL_ZXIC_ECALL_INDICATIONS, &ecall_state_indicate, sizeof(ecall_state_indicate));

+	RIL_onUnsolicitedResponse(RIL_UNSOL_ECALL_INDICATIONS /*RIL_UNSOL_ZXIC_ECALL_INDICATIONS*/, &ecall_state_indicate, sizeof(ecall_state_indicate));

 	

 	return;

 }

@@ -1726,11 +1817,16 @@
 void handle_cecnstate(const char *s, const char *smsPdu)

 {

 	char *line = s;

-	RIL_EcallUnsolIndications ecall_state_indicate = {0};

+	/*modify by hq at 2024/04/07 for ecall begin*/

+	/*  RIL_EcallUnsolIndications ecall_state_indicate = {0};*/

+	RIL_Ecall_Unsol_Indications ecall_state_indicate = {0};

+	/*modify by hq at 2024/04/07 for ecall end*/

+

 	int err;	

 	unsigned int data_type;	

+    int first_msd_req = -1;

 	

-	/*+CECN:?<data_type>*/

+	/*+CECN:?<data_type>[,<MTFirstMsdReq]*/

 	err = at_tok_start(&line);

 	if (err < 0) {

 		assert(0);

@@ -1741,26 +1837,40 @@
 		assert(0);

 	}	

 

-	if (1 == data_type) {

-		ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_MSDUPDATE_PSAP_REQURE;

+	if (at_tok_hasmore(&line)) {

+		/*<MTFirstMsdReq>*/

+		err = at_tok_nextint(&line, &first_msd_req);

+		if (err < 0) {

+			assert(0);

+		}		   

+	}

+

+	if(1 == first_msd_req){

+		ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_PSAP_CALLBACK_START);/*modify by hq at 2024/04/07 for ecall*/

+	} 

+	else if (1 == data_type) {

+		ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_MSDUPDATE_PSAP_REQURE);/*modify by hq at 2024/04/07 for ecall*/

 	}

 	

 	ecall_state_indicate.call_id = s_ecallMsdData.call_id;

 	

 	RLOGD("handle_cecnstate call_id=%d, data_type=%d!\n", ecall_state_indicate.call_id, data_type);

 

-	RIL_onUnsolicitedResponse(RIL_UNSOL_ZXIC_ECALL_INDICATIONS, &ecall_state_indicate, sizeof(ecall_state_indicate));

+	RIL_onUnsolicitedResponse(RIL_UNSOL_ECALL_INDICATIONS /*RIL_UNSOL_ZXIC_ECALL_INDICATIONS*/, &ecall_state_indicate, sizeof(ecall_state_indicate));/*modify by hq at 2024/04/07 for ecall*/

 	return;

 }

 

 void handle_t10dereg(const char *s, const char *smsPdu)

 {

-	RIL_EcallUnsolIndications ecall_state_indicate = {0};

+	/*modify by hq at 2024/04/07 for ecall begin*/

+	/*  RIL_EcallUnsolIndications ecall_state_indicate = {0};*/

+	RIL_Ecall_Unsol_Indications ecall_state_indicate = {0};

+	/*modify by hq at 2024/04/07 for ecall end*/

 	ecall_state_indicate.call_id = s_ecallMsdData.call_id;

-	ecall_state_indicate.ind = RIL_UNSOL_ECALL_EVENT_ECALLONLY_DEREGISTRATION;

+	ecall_state_indicate.ind = convert_ecall_ind_to_mtk_ind(RIL_UNSOL_ECALL_EVENT_ECALLONLY_DEREGISTRATION);/*modify by hq at 2024/04/07 for ecall*/

 	RLOGD("handle_t10dereg !\n");

 

-	RIL_onUnsolicitedResponse(RIL_UNSOL_ZXIC_ECALL_INDICATIONS, &ecall_state_indicate, sizeof(ecall_state_indicate));

+	RIL_onUnsolicitedResponse(RIL_UNSOL_ECALL_INDICATIONS /*RIL_UNSOL_ZXIC_ECALL_INDICATIONS*/, &ecall_state_indicate, sizeof(ecall_state_indicate));/*modify by hq at 2024/04/07 for ecall*/

 	return;

 }

 

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
index 1229548..edeb717 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_ref.h
@@ -59,6 +59,7 @@
 	RRR_DATATYPE_SIMIO,

 	RRR_DATATYPE_SMSWRITE,

 	RRR_DATATYPE_STRUCT,

+	RRR_DATATYPE_TESTNUM,

 	RRR_DATATYPE_MSDDATA,

 	RRR_DATATYPE_ECALLDIAL,

 	RRR_DATATYPE_ECALLCONFIG,

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/zxic_ril_ivt.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/zxic_ril_ivt.h
index 102fd6b..44c358a 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/zxic_ril_ivt.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/zxic_ril_ivt.h
@@ -245,6 +245,12 @@
     char* msd_data;
 }RIL_ECallDialInfo;
 
+typedef struct{
+    int arg_num; //ȡֵ0 Çå³ýtestnum, 1 ½«testnumÉèÖÃΪ¡°¡±, 2 ½«testnumÉèÖÃΪaddress
+    int type;    //0 set testnum  1 set uri
+    char* address;
+}RIL_ECallNumSet;
+
 typedef enum{    
     RIL_UNSOL_ECALL_EVENT_CONNECTING = 0, //¿ªÊ¼²¦´òecallµç»°
     RIL_UNSOL_ECALL_EVENT_ALERTING = 1, //ºô³ö³É¹¦£¬¶Ô·½½øÈëÕñÁå½×¶Î
@@ -263,6 +269,7 @@
     RIL_UNSOL_ECALL_EVENT_END_T2_TIMER = 14, //T2 timer³¬Ê±£¬Õý³£¹Ò¶Ï
     RIL_UNSOL_ECALL_EVENT_PSAP_SYN_LOCK = 15,
     RIL_UNSOL_ECALL_EVENT_ECALLONLY_DEREGISTRATION = 16, //T10³¬Ê±È¥×¢²á
+    RIL_UNSOL_ECALL_EVENT_PSAP_CALLBACK_START = 17, //MT ºô½ÐµÄµÚ1´ÎMSD¸üÐÂ
 	RIL_UNSOL_ECALL_EVENT_MAX = 0xffff
 }RIL_ECallIndication;