2
0
Эх сурвалжийг харах

Pase_to hacked to accept pingtel tag param

Bogdan-Andrei Iancu 23 жил өмнө
parent
commit
adf24a1d49

+ 1 - 0
Makefile.defs

@@ -89,6 +89,7 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
 	 -DWAIT -DNEW_HNAME \
 	 -DWAIT -DNEW_HNAME \
 	 -DUSE_IPV6 \
 	 -DUSE_IPV6 \
 	 -DVERY_NOISY_REPLIES\
 	 -DVERY_NOISY_REPLIES\
+	 -DPINGTEL_TAG_HACK\
 	 #-DSILENT_FR \
 	 #-DSILENT_FR \
 	 #-DNO_DEBUG \
 	 #-DNO_DEBUG \
 	 #-DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=0 \
 	 #-DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=0 \

+ 28 - 0
parser/parse_to.c

@@ -206,6 +206,21 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
 				{
 				{
 					case PARA_VALUE_QUOTED:
 					case PARA_VALUE_QUOTED:
 						break;
 						break;
+#ifdef PINGTEL_TAG_HACK
+					case TAG3:
+						param->type = TAG_PARAM;
+						param->name.len = 3;
+					case S_EQUAL:
+					case S_PARA_VALUE:
+						if (param->type==TAG_PARAM)
+							param->value.s = tmp-1;
+						else {
+							LOG( L_ERR , "ERROR: parse_to_param : unexpected "
+								"char [%c] in status %d: <<%.*s>> .\n",
+								*tmp,status, tmp-buffer, buffer);
+							goto error;
+						}
+#endif
 					case PARA_VALUE_TOKEN:
 					case PARA_VALUE_TOKEN:
 						param->value.len=tmp-param->value.s-1;
 						param->value.len=tmp-param->value.s-1;
 						add_param(param,to_b);
 						add_param(param,to_b);
@@ -397,6 +412,18 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
 
 
 
 
 endofheader:
 endofheader:
+#ifdef PINGTEL_TAG_HACK
+	if (param->type==TAG_PARAM ) {
+		if (saved_status==S_EQUAL||saved_status==S_PARA_VALUE) {
+			saved_status = E_PARA_VALUE;
+			param->value.s=(char*)param->value.len=0;
+			add_param(param, to_b);
+		} else {
+			DBG("HELLO\n");
+			goto error;
+		}
+	}
+#endif
 	*returned_status=saved_status;
 	*returned_status=saved_status;
 	return tmp;
 	return tmp;
 
 
@@ -665,6 +692,7 @@ endofheader:
 					"end of header in state %d\n", status);
 					"end of header in state %d\n", status);
 			goto error;
 			goto error;
 	}
 	}
+	DBG("TO_PARSE done: char = [%c]\n",*tmp);
 	return tmp;
 	return tmp;
 
 
 error:
 error:

+ 4 - 4
test/message.sip

@@ -1,11 +1,11 @@
-MESSSAGE sip:cucu@sms.iptel.org SIP/2.0
+MESSAGE sip:[email protected] SIP/2.0
 Via: SIP/2.0/UDP 195.37.78.169:11457
 Via: SIP/2.0/UDP 195.37.78.169:11457
 From: "bogdan" <sip:[email protected]>;tag=0e99b1e7-ff50-4875-94ef-4ca5c27e2705
 From: "bogdan" <sip:[email protected]>;tag=0e99b1e7-ff50-4875-94ef-4ca5c27e2705
-To: <sip:[email protected]>..Call-ID: [email protected]
+To: sip:[email protected];tag=
+Call-ID: [email protected]
 CSeq: 7 MESSAGE
 CSeq: 7 MESSAGE
 Contact: <sip:195.37.78.169:11457>
 Contact: <sip:195.37.78.169:11457>
 User-Agent: Windows RTC/1.0
 User-Agent: Windows RTC/1.0
-Content-Type: text/plain; charset=UTF-8;msgr=WAAtAE0ATQBTAC0ASQBNAC0ARgBvAHIAbQBhAHQAOgAgAEYATgA9AE0AUwAlADIAMABTAGgAZQBsAGwAJQAyADAARABsAGcAOwAgAEUARgA9ADsAIABDAE8APQAwADsAIABDAFMAPQAwADsAIABQAEYAPQAwAA0ACgANAAoA
+Content-Type: text/plain
 Content-Length: 4
 Content-Length: 4
-dfss
 
 

+ 5 - 0
test/th-uri.cfg

@@ -100,6 +100,11 @@ route{
 	};
 	};
 */
 */
 
 
+	if (method=="MESSAGE")
+	{
+		sl_send_reply("200","OK");
+		break;
+	};
 	pike_check_req();
 	pike_check_req();
 	forward(uri:host,uri:port);
 	forward(uri:host,uri:port);
 	#t_relay();
 	#t_relay();