提交 89b123d5 authored 作者: Anthony Minessale's avatar Anthony Minessale

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

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9049 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 0e41f84a
...@@ -50,9 +50,13 @@ bool Session::end_allow_threads() ...@@ -50,9 +50,13 @@ bool Session::end_allow_threads()
void Session::setLUA(lua_State * state) void Session::setLUA(lua_State * state)
{ {
if (uuid) {
L = state; L = state;
lua_setglobal(L, uuid); lua_setglobal(L, uuid);
lua_getfield(L, LUA_GLOBALSINDEX, uuid); lua_getfield(L, LUA_GLOBALSINDEX, uuid);
} else {
//did we fail to make a session?
}
} }
lua_State *Session::getLUA() lua_State *Session::getLUA()
......
...@@ -16,6 +16,7 @@ Session::Session():CoreSession() ...@@ -16,6 +16,7 @@ Session::Session():CoreSession()
Session::Session(char *uuid):CoreSession(uuid) Session::Session(char *uuid):CoreSession(uuid)
{ {
init_me(); init_me();
if (session) {
suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session)); suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session));
for (char *p = suuid; p && *p; p++) { for (char *p = suuid; p && *p; p++) {
if (*p == '-') { if (*p == '-') {
...@@ -25,17 +26,24 @@ Session::Session(char *uuid):CoreSession(uuid) ...@@ -25,17 +26,24 @@ Session::Session(char *uuid):CoreSession(uuid)
*p = '\0'; *p = '\0';
} }
} }
} else {
//handle failure
}
} }
Session::Session(switch_core_session_t *new_session):CoreSession(new_session) Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
{ {
init_me(); init_me();
if (session) {
suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session)); suuid = switch_core_session_sprintf(session, "main::uuid_%s\n", switch_core_session_get_uuid(session));
for (char *p = suuid; p && *p; p++) { for (char *p = suuid; p && *p; p++) {
if (*p == '-') { if (*p == '-') {
*p = '_'; *p = '_';
} }
} }
} else {
//handle failure
}
} }
static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup); static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup);
Session::~Session() Session::~Session()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论