瀏覽代碼

core: make method conditions work on reply routes

- reported by Alex Hermann, closes FS#164
Daniel-Constantin Mierla 14 年之前
父節點
當前提交
65bac992f7
共有 1 個文件被更改,包括 12 次插入1 次删除
  1. 12 1
      route.c

+ 12 - 1
route.c

@@ -1868,8 +1868,19 @@ inline static int eval_elem(struct run_act_ctx* h, struct expr* e,
 	}
 	switch(e->l_type){
 	case METHOD_O:
-		ret=comp_str(e->op, &msg->first_line.u.request.method,
+		if(msg->first_line.type==SIP_REQUEST)
+		{
+			ret=comp_str(e->op, &msg->first_line.u.request.method,
 			 			e->r_type, &e->r, msg, h);
+		} else {
+			if(parse_headers(msg, HDR_CSEQ_F, 0)!=0 || msg->cseq==NULL)
+			{
+				LM_ERR("cannot parse cseq header\n");
+				goto error;
+			}
+			ret=comp_str(e->op, &get_cseq(msg)->method,
+						e->r_type, &e->r, msg, h);
+		}
 		break;
 	case URI_O:
 		if(msg->new_uri.s) {