Browse code

rtpmanage: enable hadling of PRACK requests

- they can have SDP
- use more compact bitwise match for method types

Daniel-Constantin Mierla authored on 04/05/2020 18:05:26
Showing 1 changed files
... ...
@@ -3634,11 +3634,11 @@ rtpengine_manage(struct sip_msg *msg, const char *flags)
3634 3634
 
3635 3635
 	method = get_cseq(msg)->method_id;
3636 3636
 
3637
-	if (!(method==METHOD_INVITE || method==METHOD_ACK || method==METHOD_CANCEL
3638
-			|| method==METHOD_BYE || method==METHOD_UPDATE))
3637
+	if (!(method & (METHOD_INVITE|METHOD_ACK|METHOD_CANCEL|METHOD_BYE
3638
+					|METHOD_UPDATE|METHOD_PRACK)))
3639 3639
 		return -1;
3640 3640
 
3641
-	if (method==METHOD_CANCEL || method==METHOD_BYE)
3641
+	if (method & (METHOD_CANCEL|METHOD_BYE))
3642 3642
 		return rtpengine_delete(msg, flags);
3643 3643
 
3644 3644
 	if (msg->msg_flags & FL_SDP_BODY)
... ...
@@ -3647,7 +3647,7 @@ rtpengine_manage(struct sip_msg *msg, const char *flags)
3647 3647
 		nosdp = parse_sdp(msg);
3648 3648
 
3649 3649
 	if (msg->first_line.type == SIP_REQUEST) {
3650
-		if(method==METHOD_ACK && nosdp==0)
3650
+		if((method & (METHOD_ACK|METHOD_PRACK)) && nosdp==0)
3651 3651
 			return rtpengine_offer_answer(msg, flags, OP_ANSWER, 0);
3652 3652
 		if(method==METHOD_UPDATE && nosdp==0)
3653 3653
 			return rtpengine_offer_answer(msg, flags, OP_OFFER, 0);
... ...
@@ -3715,7 +3715,8 @@ rtpengine_answer1_f(struct sip_msg *msg, char *str1, char *str2)
3715 3715
 {
3716 3716
 
3717 3717
 	if (msg->first_line.type == SIP_REQUEST)
3718
-		if (msg->first_line.u.request.method_value != METHOD_ACK)
3718
+		if (!(msg->first_line.u.request.method_value
3719
+					& (METHOD_ACK | METHOD_PRACK)))
3719 3720
 			return -1;
3720 3721
 
3721 3722
 	return rtpengine_rtpp_set_wrap_fparam(msg, rtpengine_answer_wrap, str1, 2, OP_ANSWER);