Module: sip-router Branch: master Commit: bedf2c75669a27ccaf4195ef705312277fc5e090 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bedf2c75...
Author: pd peter.dunkley@crocodile-rcs.com Committer: pd peter.dunkley@crocodile-rcs.com Date: Thu Aug 18 16:35:51 2011 +0100
modules/app_lua, modules/sdpops: Fixed a couple of small issues with sdpops in app_lua
---
modules/app_lua/app_lua_exp.c | 18 ++++++++++++++++++ modules/sdpops/api.h | 2 +- modules/sdpops/sdpops_mod.c | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/modules/app_lua/app_lua_exp.c b/modules/app_lua/app_lua_exp.c index 0893089..3a69ff7 100644 --- a/modules/app_lua/app_lua_exp.c +++ b/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);
diff --git a/modules/sdpops/api.h b/modules/sdpops/api.h index 215dcce..c6a6f23 100644 --- a/modules/sdpops/api.h +++ b/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; diff --git a/modules/sdpops/sdpops_mod.c b/modules/sdpops/sdpops_mod.c index 1212053..9e47a0c 100644 --- a/modules/sdpops/sdpops_mod.c +++ b/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} };