refactor to avoid some potential issues with channels that are hungup instantly after being answered

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4926 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2007-04-13 22:15:58 +00:00
1 parent ff44ce11cc
commit eb2124ae32
16 files changed
+1524 -1606

No files matched your search

+4
View File
@@ -76,4 +76,8 @@ package fs_perl;
package fs_perl;
*FREESWITCH_PEN = *fs_perlc::FREESWITCH_PEN;
*FREESWITCH_OID_PREFIX = *fs_perlc::FREESWITCH_OID_PREFIX;
*FREESWITCH_ITAD = *fs_perlc::FREESWITCH_ITAD;
*__EXTENSIONS__ = *fs_perlc::__EXTENSIONS__;
1;
File diff suppressed because it is too large. Load diff
@@ -81,7 +81,8 @@ typedef struct sm_loadable_module sm_loadable_module_t;
typedef enum {
S_HUP = (1 << 0),
S_FREE = (1 << 1)
S_FREE = (1 << 1),
S_RDLOCK = (1 << 2)
} session_flag_t;
struct input_callback_state {
@@ -2146,7 +2147,7 @@ static JSBool session_originate(JSContext * cx, JSObject * obj, uintN argc, jsva
}
jss->session = peer_session;
jss->flags = 0;
jss->flags = S_RDLOCK;
*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
@@ -2177,6 +2178,10 @@ static void session_destroy(JSContext * cx, JSObject * obj)
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
if (jss->session && switch_test_flag(jss, S_RDLOCK)) {
switch_core_session_rwunlock(jss->session);
}
if (switch_test_flag(jss, S_FREE)) {
free(jss);
}