Browse code

Pase_to hacked to accept pingtel tag param

Bogdan-Andrei Iancu authored on 10/06/2002 13:25:31
Showing 4 changed files
... ...
@@ -89,6 +89,7 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
89 89
 	 -DWAIT -DNEW_HNAME \
90 90
 	 -DUSE_IPV6 \
91 91
 	 -DVERY_NOISY_REPLIES\
92
+	 -DPINGTEL_TAG_HACK\
92 93
 	 #-DSILENT_FR \
93 94
 	 #-DNO_DEBUG \
94 95
 	 #-DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=0 \
... ...
@@ -206,6 +206,21 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
206 206
 				{
207 207
 					case PARA_VALUE_QUOTED:
208 208
 						break;
209
+#ifdef PINGTEL_TAG_HACK
210
+					case TAG3:
211
+						param->type = TAG_PARAM;
212
+						param->name.len = 3;
213
+					case S_EQUAL:
214
+					case S_PARA_VALUE:
215
+						if (param->type==TAG_PARAM)
216
+							param->value.s = tmp-1;
217
+						else {
218
+							LOG( L_ERR , "ERROR: parse_to_param : unexpected "
219
+								"char [%c] in status %d: <<%.*s>> .\n",
220
+								*tmp,status, tmp-buffer, buffer);
221
+							goto error;
222
+						}
223
+#endif
209 224
 					case PARA_VALUE_TOKEN:
210 225
 						param->value.len=tmp-param->value.s-1;
211 226
 						add_param(param,to_b);
... ...
@@ -397,6 +412,18 @@ char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
397 397
 
398 398
 
399 399
 endofheader:
400
+#ifdef PINGTEL_TAG_HACK
401
+	if (param->type==TAG_PARAM ) {
402
+		if (saved_status==S_EQUAL||saved_status==S_PARA_VALUE) {
403
+			saved_status = E_PARA_VALUE;
404
+			param->value.s=(char*)param->value.len=0;
405
+			add_param(param, to_b);
406
+		} else {
407
+			DBG("HELLO\n");
408
+			goto error;
409
+		}
410
+	}
411
+#endif
400 412
 	*returned_status=saved_status;
401 413
 	return tmp;
402 414
 
... ...
@@ -665,6 +692,7 @@ endofheader:
665 665
 					"end of header in state %d\n", status);
666 666
 			goto error;
667 667
 	}
668
+	DBG("TO_PARSE done: char = [%c]\n",*tmp);
668 669
 	return tmp;
669 670
 
670 671
 error:
... ...
@@ -1,11 +1,11 @@
1
-MESSSAGE sip:cucu@sms.iptel.org SIP/2.0
1
+MESSAGE sip:cucu@iptel.org SIP/2.0
2 2
 Via: SIP/2.0/UDP 195.37.78.169:11457
3 3
 From: "bogdan" <sip:bogdan@iptel.org>;tag=0e99b1e7-ff50-4875-94ef-4ca5c27e2705
4
-To: <sip:cucu@sms.iptel.org>..Call-ID: 02b1191c-447e-4bd0-b771-c039fc0d9d84@195.37.78.169
4
+To: sip:cucu@sms.iptel.org;tag=
5
+Call-ID: 02b1191c-447e-4bd0-b771-c039fc0d9d84@195.37.78.169
5 6
 CSeq: 7 MESSAGE
6 7
 Contact: <sip:195.37.78.169:11457>
7 8
 User-Agent: Windows RTC/1.0
8
-Content-Type: text/plain; charset=UTF-8;msgr=WAAtAE0ATQBTAC0ASQBNAC0ARgBvAHIAbQBhAHQAOgAgAEYATgA9AE0AUwAlADIAMABTAGgAZQBsAGwAJQAyADAARABsAGcAOwAgAEUARgA9ADsAIABDAE8APQAwADsAIABDAFMAPQAwADsAIABQAEYAPQAwAA0ACgANAAoA
9
+Content-Type: text/plain
9 10
 Content-Length: 4
10
-dfss
11 11
 
... ...
@@ -100,6 +100,11 @@ route{
100 100
 	};
101 101
 */
102 102
 
103
+	if (method=="MESSAGE")
104
+	{
105
+		sl_send_reply("200","OK");
106
+		break;
107
+	};
103 108
 	pike_check_req();
104 109
 	forward(uri:host,uri:port);
105 110
 	#t_relay();