[sr-dev] git:master: modules/app_lua: Added registrar:save_uri support
Peter Dunkley
peter.dunkley at crocodile-rcs.com
Tue Jun 12 03:25:53 CEST 2012
Module: sip-router
Branch: master
Commit: 0aae547c7f18186372f01b07144b64a646b37971
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0aae547c7f18186372f01b07144b64a646b37971
Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date: Tue Jun 12 02:10:30 2012 +0100
modules/app_lua: Added registrar:save_uri support
- Feature by Hugh Waite @ Crocodile RCS Ltd
---
modules/app_lua/app_lua_exp.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/modules/app_lua/app_lua_exp.c b/modules/app_lua/app_lua_exp.c
index ce69a1d..8716b48 100644
--- a/modules/app_lua/app_lua_exp.c
+++ b/modules/app_lua/app_lua_exp.c
@@ -1262,6 +1262,7 @@ static int lua_sr_registrar_save(lua_State *L)
int ret;
int flags;
char *table;
+ str uri ={NULL, 0};
sr_lua_env_t *env_L;
flags = 0;
@@ -1283,6 +1284,11 @@ static int lua_sr_registrar_save(lua_State *L)
} else if(lua_gettop(L)==2) {
table = (char*)lua_tostring(L, -2);
flags = lua_tointeger(L, -1);
+ } else if(lua_gettop(L)==3) {
+ table = (char*)lua_tostring(L, -3);
+ flags = lua_tointeger(L, -2);
+ uri.s = (char*)lua_tostring(L, -1);
+ uri.len = strlen(uri.s);
} else {
LM_WARN("invalid number of parameters from Lua\n");
return app_lua_return_error(L);
@@ -1292,7 +1298,11 @@ static int lua_sr_registrar_save(lua_State *L)
LM_WARN("invalid parameters from Lua\n");
return app_lua_return_error(L);
}
- ret = _lua_registrarb.save(env_L->msg, table, flags);
+ if (lua_gettop(L)==3) {
+ ret = _lua_registrarb.save_uri(env_L->msg, table, flags, &uri);
+ } else {
+ ret = _lua_registrarb.save(env_L->msg, table, flags);
+ }
return app_lua_return_int(L, ret);
}
More information about the sr-dev
mailing list