[Freeswitch-svn] [commit] r8652 - freeswitch/trunk/src/mod/languages/mod_spidermonkey
Freeswitch SVN
mikej at freeswitch.org
Sun May 25 20:18:57 EDT 2008
Author: mikej
Date: Sun May 25 20:18:57 2008
New Revision: 8652
Modified:
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
Log:
merge MODLANG-61
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Sun May 25 20:18:57 2008
@@ -2174,8 +2174,15 @@
CHANNEL_SANITY_CHECK();
if (argc > 1) {
- cause_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- cause = switch_channel_str2cause(cause_name);
+ if(JSVAL_IS_INT(argv[0])) {
+ int32 i = 0;
+ JS_ValueToInt32(cx, argv[0], &i);
+ cause = i;
+ }
+ else {
+ cause_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+ cause = switch_channel_str2cause(cause_name);
+ }
}
switch_channel_hangup(channel, cause);
@@ -2424,7 +2431,7 @@
enum session_tinyid {
SESSION_NAME, SESSION_STATE,
PROFILE_DIALPLAN, PROFILE_CID_NAME, PROFILE_CID_NUM, PROFILE_IP, PROFILE_ANI, PROFILE_ANI_II, PROFILE_DEST,
- SESSION_UUID, SESSION_CAUSE
+ SESSION_UUID, SESSION_CAUSE, SESSION_CAUSECODE
};
static JSFunctionSpec session_methods[] = {
@@ -2469,6 +2476,7 @@
{"destination", PROFILE_DEST, JSPROP_READONLY | JSPROP_PERMANENT},
{"uuid", SESSION_UUID, JSPROP_READONLY | JSPROP_PERMANENT},
{"cause", SESSION_CAUSE, JSPROP_READONLY | JSPROP_PERMANENT},
+ {"causecode", SESSION_CAUSECODE, JSPROP_READONLY | JSPROP_PERMANENT},
{0}
};
@@ -2501,6 +2509,11 @@
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_cause2str(jss->cause)));
}
break;
+ case SESSION_CAUSECODE:
+ if (jss) {
+ *vp = INT_TO_JSVAL(jss->cause);
+ }
+ break;
default:
*vp = BOOLEAN_TO_JSVAL(JS_FALSE);
}
@@ -2511,6 +2524,9 @@
case SESSION_CAUSE:
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_cause2str(switch_channel_get_cause(channel))));
break;
+ case SESSION_CAUSECODE:
+ *vp = INT_TO_JSVAL(switch_channel_get_cause(channel));
+ break;
case SESSION_NAME:
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_get_name(channel)));
break;
More information about the Freeswitch-svn
mailing list