Browse code

@msg.body.sdp select call is introduced, that returns the sdp part of the message body.

Miklos Tirpak authored on 22/05/2008 16:15:07
Showing 2 changed files
... ...
@@ -57,6 +57,8 @@
57 57
 #include "parser/parse_expires.h"
58 58
 #include "parser/parse_refer_to.h"
59 59
 #include "parser/parse_rpid.h"
60
+#include "parser/parse_content.h"
61
+#include "parser/parse_body.h"
60 62
 #include "dset.h"
61 63
 #include "sr_module.h"
62 64
 
... ...
@@ -494,6 +496,18 @@ int select_msg_body(str* res, select_t* s, struct sip_msg* msg)
494 494
 	return 0;	
495 495
 }
496 496
 
497
+int select_msg_body_sdp(str* res, select_t* sel, struct sip_msg* msg)
498
+{
499
+	/* try to get the body part with application/sdp */
500
+	if ((res->s = get_body_part(msg,
501
+				TYPE_APPLICATION, SUBTYPE_SDP,
502
+				&res->len))
503
+	)
504
+		return 0;
505
+	else
506
+		return -1;
507
+}
508
+
497 509
 int select_msg_header(str* res, select_t* s, struct sip_msg* msg)
498 510
 {
499 511
 	/* get all headers */
... ...
@@ -129,6 +129,7 @@ SELECT_F(select_msg_len)
129 129
 SELECT_F(select_msg_id)
130 130
 SELECT_F(select_msg_id_hex)
131 131
 SELECT_F(select_msg_body)
132
+SELECT_F(select_msg_body_sdp)
132 133
 SELECT_F(select_msg_header)
133 134
 SELECT_F(select_anyheader)
134 135
 SELECT_F(select_anyheader_params)
... ...
@@ -316,6 +317,7 @@ static select_row_t select_core[] = {
316 316
 	{ select_anyheader_params, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_any_params, CONSUME_NEXT_STR},
317 317
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("body"), select_msg_body, 0},
318 318
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("content"), select_msg_body, 0},
319
+	{ select_msg_body, SEL_PARAM_STR, STR_STATIC_INIT("sdp"), select_msg_body_sdp, 0},
319 320
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("request"), select_msg_request, 0},
320 321
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("req"), select_msg_request, 0},
321 322
 	{ select_msg_request, SEL_PARAM_STR, STR_STATIC_INIT("method"), select_msg_request_method, 0},