Browse Source

modules/app_lua, modules/sdpops: Fixed a couple of small issues with sdpops in app_lua

pd 14 years ago
parent
commit
bedf2c7566
3 changed files with 20 additions and 2 deletions
  1. 18 0
      modules/app_lua/app_lua_exp.c
  2. 1 1
      modules/sdpops/api.h
  3. 1 1
      modules/sdpops/sdpops_mod.c

+ 18 - 0
modules/app_lua/app_lua_exp.c

@@ -1305,6 +1305,24 @@ static int lua_sr_sdpops_with_media(lua_State *L)
 
 	env_L = sr_lua_env_get();
 
+	if(!(_sr_lua_exp_reg_mods&SR_LUA_EXP_MOD_SDPOPS))
+	{
+		LM_WARN("weird: sdpops function executed but module not registered\n");
+		return app_lua_return_error(L);
+	}
+
+	if(env_L->msg==NULL)
+	{
+		LM_WARN("invalid parameters from Lua env\n");
+		return app_lua_return_error(L);
+	}
+
+	if(lua_gettop(L)!=1)
+	{
+		LM_ERR("incorrect number of arguments\n");
+		return app_lua_return_error(L);
+	}
+
 	media.s = (char*)lua_tostring(L, -1);
 	media.len = strlen(media.s);
 

+ 1 - 1
modules/sdpops/api.h

@@ -15,7 +15,7 @@ int bind_sdpops(struct sdpops_binds*);
 inline static int sdpops_load_api(sdpops_api_t *sob)
 {
 	bind_sdpops_f bind_sdpops_exports;
-	if (!(bind_sdpops_exports = (bind_sdpops_f)find_export("bind_sdpops", 0, 0)))
+	if (!(bind_sdpops_exports = (bind_sdpops_f)find_export("bind_sdpops", 1, 0)))
 	{
 		LM_ERR("Failed to import bind_sdpops\n");
 		return -1;

+ 1 - 1
modules/sdpops/sdpops_mod.c

@@ -56,7 +56,7 @@ static cmd_export_t cmds[] = {
 	{"sdp_print",                  (cmd_function)w_sdp_print,
 		1, fixup_igp_null,  0, ANY_ROUTE},
 	{"bind_sdpops",                (cmd_function)bind_sdpops,
-		0, 0, 0, 0},
+		1, 0, 0, 0},
 	{0, 0, 0, 0, 0, 0}
 };