[sr-dev] git:master: app_lua: exported sl get_reply_totag() to Lua

Daniel-Constantin Mierla miconda at gmail.com
Fri Jan 29 18:42:54 CET 2010


Module: sip-router
Branch: master
Commit: f844b74911d87b7a19d80fe1648582b399f228f2
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f844b74911d87b7a19d80fe1648582b399f228f2

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Jan 29 18:36:59 2010 +0100

app_lua: exported sl get_reply_totag() to Lua

---

 modules/app_lua/app_lua_exp.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/modules/app_lua/app_lua_exp.c b/modules/app_lua/app_lua_exp.c
index e879500..c7aaa48 100644
--- a/modules/app_lua/app_lua_exp.c
+++ b/modules/app_lua/app_lua_exp.c
@@ -86,8 +86,35 @@ static int lua_sr_sl_send_reply (lua_State *L)
 /**
  *
  */
+static int lua_sr_sl_get_reply_totag (lua_State *L)
+{
+	str txt;
+	int ret;
+	sr_lua_env_t *env_L;
+
+	env_L = sr_lua_env_get();
+
+	if(!(_sr_lua_exp_reg_mods&SR_LUA_EXP_MOD_SL))
+	{
+		LM_WARN("weird: sl function executed but module not registered\n");
+		return 0;
+	}
+	ret = _lua_slb.get_reply_totag(env_L->msg, &txt);
+	if(ret<0)
+	{
+		LM_WARN("sl get_reply_totag returned false\n");
+		return 0;
+	}
+	lua_pushlstring(L, txt.s, txt.len);
+	return 1;
+}
+
+/**
+ *
+ */
 static const luaL_reg _sr_sl_Map [] = {
-	{"send_reply", lua_sr_sl_send_reply},
+	{"send_reply",      lua_sr_sl_send_reply},
+	{"get_reply_totag", lua_sr_sl_get_reply_totag},
 	{NULL, NULL}
 };
 




More information about the sr-dev mailing list