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 496
 	return 0;	
495 497
 }
496 498
 
499
+int select_msg_body_sdp(str* res, select_t* sel, struct sip_msg* msg)
500
+{
501
+	/* try to get the body part with application/sdp */
502
+	if ((res->s = get_body_part(msg,
503
+				TYPE_APPLICATION, SUBTYPE_SDP,
504
+				&res->len))
505
+	)
506
+		return 0;
507
+	else
508
+		return -1;
509
+}
510
+
497 511
 int select_msg_header(str* res, select_t* s, struct sip_msg* msg)
498 512
 {
499 513
 	/* 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 317
 	{ select_anyheader_params, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_any_params, CONSUME_NEXT_STR},
317 318
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("body"), select_msg_body, 0},
318 319
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("content"), select_msg_body, 0},
320
+	{ select_msg_body, SEL_PARAM_STR, STR_STATIC_INIT("sdp"), select_msg_body_sdp, 0},
319 321
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("request"), select_msg_request, 0},
320 322
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("req"), select_msg_request, 0},
321 323
 	{ select_msg_request, SEL_PARAM_STR, STR_STATIC_INIT("method"), select_msg_request_method, 0},