Module: kamailio
Branch: master
Commit: b9d20066af146d5db93b3a4ff08e9a71e11d8576
URL:
https://github.com/kamailio/kamailio/commit/b9d20066af146d5db93b3a4ff08e9a7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-06-21T09:17:10+02:00
sdpops: exported some of the config functions to kemi
---
Modified: modules/sdpops/sdpops_data.c
Modified: modules/sdpops/sdpops_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b9d20066af146d5db93b3a4ff08e9a7…
Patch:
https://github.com/kamailio/kamailio/commit/b9d20066af146d5db93b3a4ff08e9a7…
---
diff --git a/modules/sdpops/sdpops_data.c b/modules/sdpops/sdpops_data.c
index 040cfb1..6b176bf 100644
--- a/modules/sdpops/sdpops_data.c
+++ b/modules/sdpops/sdpops_data.c
@@ -195,11 +195,11 @@ int sdpops_sdp_get_ids_by_name(sdp_info_t *sdp, str *cname, str
*cids, int n)
*/
int sdpops_build_ids_list(sdp_info_t *sdp, str *names, str *ids)
{
-#define SDPOPS_MAX_LIST_SIZE 64
+#define SDPOPS_MAX_LIST_SIZE 128
static char _local_idslist[SDPOPS_MAX_LIST_SIZE];
str tmp;
str codec;
-#define SDPOPS_CIDS_SIZE 8
+#define SDPOPS_CIDS_SIZE 16
str cids[SDPOPS_CIDS_SIZE];
char *p;
int i;
diff --git a/modules/sdpops/sdpops_mod.c b/modules/sdpops/sdpops_mod.c
index 6b800cd..80fb17a 100644
--- a/modules/sdpops/sdpops_mod.c
+++ b/modules/sdpops/sdpops_mod.c
@@ -34,6 +34,7 @@
#include "../../trim.h"
#include "../../data_lump.h"
#include "../../ut.h"
+#include "../../kemi.h"
#include "../../parser/parse_content.h"
#include "api.h"
@@ -621,7 +622,7 @@ int sdp_keep_codecs_by_id(sip_msg_t* msg, str* codecs, str *media)
LM_DBG("stream %d of %d - payloads [%.*s]\n",
sdp_stream_num, sdp_session_num,
sdp_stream->payloads.len, sdp_stream->payloads.s);
- if((media==NULL)
+ if((media==NULL) || (media->len==0)
|| (media->len==sdp_stream->media.len
&& strncasecmp(sdp_stream->media.s, media->s,
media->len)==0))
@@ -1798,3 +1799,45 @@ static int pv_parse_sdp_name(pv_spec_p sp, str *in)
LM_ERR("unknown PV sdp name %.*s\n", in->len, in->s);
return -1;
}
+
+/**
+ *
+ */
+static sr_kemi_t sr_kemi_sdpops_exports[] = {
+ { str_init("sdpops"), str_init("remove_codecs_by_name"),
+ SR_KEMIP_INT, sdp_remove_codecs_by_name,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("sdpops"), str_init("remove_codecs_by_id"),
+ SR_KEMIP_INT, sdp_remove_codecs_by_id,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("sdpops"), str_init("keep_codecs_by_name"),
+ SR_KEMIP_INT, sdp_keep_codecs_by_name,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("sdpops"), str_init("keep_codecs_by_id"),
+ SR_KEMIP_INT, sdp_keep_codecs_by_id,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+ { str_init("sdpops"), str_init("remove_media"),
+ SR_KEMIP_INT, sdp_remove_media,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
+
+ { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
+};
+
+/**
+ *
+ */
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
+{
+ sr_kemi_modules_add(sr_kemi_sdpops_exports);
+ return 0;
+}