ソースを参照

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

Miklos Tirpak 17 年 前
コミット
6f2858cbd3
2 ファイル変更16 行追加0 行削除
  1. 14 0
      select_core.c
  2. 2 0
      select_core.h

+ 14 - 0
select_core.c

@@ -57,6 +57,8 @@
 #include "parser/parse_expires.h"
 #include "parser/parse_refer_to.h"
 #include "parser/parse_rpid.h"
+#include "parser/parse_content.h"
+#include "parser/parse_body.h"
 #include "dset.h"
 #include "sr_module.h"
 
@@ -494,6 +496,18 @@ int select_msg_body(str* res, select_t* s, struct sip_msg* msg)
 	return 0;	
 }
 
+int select_msg_body_sdp(str* res, select_t* sel, struct sip_msg* msg)
+{
+	/* try to get the body part with application/sdp */
+	if ((res->s = get_body_part(msg,
+				TYPE_APPLICATION, SUBTYPE_SDP,
+				&res->len))
+	)
+		return 0;
+	else
+		return -1;
+}
+
 int select_msg_header(str* res, select_t* s, struct sip_msg* msg)
 {
 	/* get all headers */

+ 2 - 0
select_core.h

@@ -129,6 +129,7 @@ SELECT_F(select_msg_len)
 SELECT_F(select_msg_id)
 SELECT_F(select_msg_id_hex)
 SELECT_F(select_msg_body)
+SELECT_F(select_msg_body_sdp)
 SELECT_F(select_msg_header)
 SELECT_F(select_anyheader)
 SELECT_F(select_anyheader_params)
@@ -316,6 +317,7 @@ static select_row_t select_core[] = {
 	{ select_anyheader_params, SEL_PARAM_STR, STR_STATIC_INIT("params"), select_any_params, CONSUME_NEXT_STR},
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("body"), select_msg_body, 0},
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("content"), select_msg_body, 0},
+	{ select_msg_body, SEL_PARAM_STR, STR_STATIC_INIT("sdp"), select_msg_body_sdp, 0},
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("request"), select_msg_request, 0},
 	{ select_msg, SEL_PARAM_STR, STR_STATIC_INIT("req"), select_msg_request, 0},
 	{ select_msg_request, SEL_PARAM_STR, STR_STATIC_INIT("method"), select_msg_request_method, 0},