[Freeswitch-svn] [commit] r9049 - in freeswitch/trunk/src/mod/languages: mod_lua mod_perl

Freeswitch SVN anthm at freeswitch.org
Wed Jul 16 02:23:35 EDT 2008


Author: anthm
Date: Wed Jul 16 02:23:35 2008
New Revision: 9049

Modified:
   freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
   freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp

Log:
handle failed originate a little more gracefully (MODLANG-70)

Modified: freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/freeswitch_lua.cpp	Wed Jul 16 02:23:35 2008
@@ -50,9 +50,13 @@
 
 void Session::setLUA(lua_State * state)
 {
-	L = state;
-	lua_setglobal(L, uuid);
-	lua_getfield(L, LUA_GLOBALSINDEX, uuid);
+	if (uuid) {
+		L = state;
+		lua_setglobal(L, uuid);
+		lua_getfield(L, LUA_GLOBALSINDEX, uuid);
+	} else {
+		//did we fail to make a session?
+	}
 }
 
 lua_State *Session::getLUA()

Modified: freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_perl/freeswitch_perl.cpp	Wed Jul 16 02:23:35 2008
@@ -16,25 +16,33 @@
 Session::Session(char *uuid):CoreSession(uuid)
 {
 	init_me();
-	suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session));
-	for (char *p = suuid; p && *p; p++) {
-		if (*p == '-') {
-			*p = '_';
-		}
-		if (*p == '\n') {
-			*p = '\0';
+	if (session) {
+		suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session));
+		for (char *p = suuid; p && *p; p++) {
+			if (*p == '-') {
+				*p = '_';
+			}
+			if (*p == '\n') {
+				*p = '\0';
+			}
 		}
+	} else {
+		//handle failure
 	}
 }
 
 Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
 {
 	init_me();
-	suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session));
-	for (char *p = suuid; p && *p; p++) {
-		if (*p == '-') {
-			*p = '_';
+	if (session) {
+		suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session));
+		for (char *p = suuid; p && *p; p++) {
+			if (*p == '-') {
+				*p = '_';
+			}
 		}
+	} else {
+		//handle failure
 	}
 }
 static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup);



More information about the Freeswitch-svn mailing list