@msg.body.sdp select call is introduced, that returns the sdp part
authorMiklos Tirpak <miklos@iptel.org>
Thu, 22 May 2008 16:15:07 +0000 (16:15 +0000)
committerMiklos Tirpak <miklos@iptel.org>
Thu, 22 May 2008 16:15:07 +0000 (16:15 +0000)
of the message body.

select_core.c
select_core.h

index 731c87c..7774f7f 100644 (file)
@@ -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 */
index d1365ed..05d3028 100644 (file)
@@ -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},