update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7004 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
82f8473aee
commit
e87a87395e
|
@ -764,31 +764,31 @@ JSClass event_class = {
|
||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
static JSBool dtmf_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
|
static JSBool dtmf_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
switch_dtmf_t *dtmf;
|
||||||
|
int32 duration = SWITCH_DEFAULT_DTMF_DURATION;
|
||||||
|
char *ename;
|
||||||
|
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
switch_dtmf_t *dtmf;
|
ename = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
|
||||||
int32 duration = SWITCH_DEFAULT_DTMF_DURATION;
|
} else {
|
||||||
char *ename;
|
eval_some_js("~throw new Error(\"Invalid Args\");", cx, obj, rval);
|
||||||
|
return JS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (argc > 0) {
|
if (argc > 1) {
|
||||||
ename = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
|
JS_ValueToInt32(cx, argv[1], &duration);
|
||||||
} else {
|
if (duration <= 0) {
|
||||||
eval_some_js("~throw new Error(\"Invalid Args\");", cx, obj, rval);
|
duration = SWITCH_DEFAULT_DTMF_DURATION;
|
||||||
return JS_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc > 1) {
|
|
||||||
JS_ValueToInt32(cx, argv[1], &duration);
|
|
||||||
if (duration <= 0) {
|
|
||||||
duration = SWITCH_DEFAULT_DTMF_DURATION;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((dtmf = malloc(sizeof(*dtmf)))) {
|
|
||||||
JS_SetPrivate(cx, obj, dtmf);
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((dtmf = malloc(sizeof(*dtmf)))) {
|
||||||
|
JS_SetPrivate(cx, obj, dtmf);
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue