Browse code

core: make method conditions work on reply routes

- reported by Alex Hermann, closes FS#164

Daniel-Constantin Mierla authored on 06/10/2011 15:47:38
Showing 1 changed files
... ...
@@ -1868,8 +1868,19 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
1868 1868
 	}
1869 1869
 	switch(e->l_type){
1870 1870
 	case METHOD_O:
1871
-		ret=comp_str(e->op, &msg->first_line.u.request.method,
1871
+		if(msg->first_line.type==SIP_REQUEST)
1872
+		{
1873
+			ret=comp_str(e->op, &msg->first_line.u.request.method,
1872 1874
 			 			e->r_type, &e->r, msg, h);
1875
+		} else {
1876
+			if(parse_headers(msg, HDR_CSEQ_F, 0)!=0 || msg->cseq==NULL)
1877
+			{
1878
+				LM_ERR("cannot parse cseq header\n");
1879
+				goto error;
1880
+			}
1881
+			ret=comp_str(e->op, &get_cseq(msg)->method,
1882
+						e->r_type, &e->r, msg, h);
1883
+		}
1873 1884
 		break;
1874 1885
 	case URI_O:
1875 1886
 		if(msg->new_uri.s) {