]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
handle failed originate a little more gracefully (MODLANG-70)
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 16 Jul 2008 06:23:35 +0000 (06:23 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 16 Jul 2008 06:23:35 +0000 (06:23 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9049 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/languages/mod_lua/freeswitch_lua.cpp
src/mod/languages/mod_perl/freeswitch_perl.cpp

index 437335b8080406b9a4aee919346e688783160c7f..6a45242947a0e8b3b4dba570c030bcc1e3693458 100644 (file)
@@ -50,9 +50,13 @@ bool Session::end_allow_threads()
 
 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()
index f84572a80b47aa652434a514f54c124471ff8992..03453bab505265c8d2002ff3966186d6f6c58b5d 100644 (file)
@@ -16,25 +16,33 @@ Session::Session():CoreSession()
 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);