[Freeswitch-svn] [commit] r7256 - freeswitch/trunk/src/mod/applications/mod_limit
Freeswitch SVN
silik0n at freeswitch.org
Wed Jan 16 16:44:28 EST 2008
Author: silik0n
Date: Wed Jan 16 16:44:28 2008
New Revision: 7256
Modified:
freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
Log:
small mod to mod limit...
Add Optional user setable transfer destination number
example usage:
<application="limit" data="<realm> <id> <max> [transfer_destination_number]"/>
existing functionality is not changed... if limit is exceeded and
transfer_destination_number is not specified call will still be redirected to limit_exceeded
Also add new channel variable limit_original_destination which is set to the
destination_number before mod_limit does its thing
Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c Wed Jan 16 16:44:28 2008
@@ -568,8 +568,9 @@
}
-#define LIMIT_USAGE "<realm> <id> <max>"
+#define LIMIT_USAGE "<realm> <id> <max> [transfer_destination_number]"
#define LIMIT_DESC "limit access to an extension"
+static char *limit_def_xfer_exten="limit_exceeded";
SWITCH_STANDARD_APP(limit_function)
{
@@ -579,6 +580,7 @@
char *sql = NULL;
char *realm = NULL;
char *id = NULL;
+ char *xfer_exten = NULL;
int max = 0, got = 0;
char buf[80] = "";
callback_t cbt = { 0 };
@@ -606,6 +608,12 @@
id = argv[1];
max = atoi(argv[2]);
+ if (argc == 4) {
+ xfer_exten = argv[3];
+ } else {
+ xfer_exten = limit_def_xfer_exten;
+ }
+
if (max < 0) {
max = 0;
}
@@ -613,6 +621,7 @@
switch_channel_set_variable(channel, "limit_realm", realm);
switch_channel_set_variable(channel, "limit_id", id);
switch_channel_set_variable(channel, "limit_max", argv[2]);
+ switch_channel_set_variable(channel, "limit_orignal_destination", switch_channel_get_variable(channel, "destination_number"));
cbt.buf = buf;
cbt.len = sizeof(buf);
@@ -621,7 +630,7 @@
got = atoi(buf);
if (got + 1 > max) {
- switch_ivr_session_transfer(session, "limit_exceeded", NULL, NULL);
+ switch_ivr_session_transfer(session, xfer_exten, NULL, NULL);
goto done;
}
More information about the Freeswitch-svn
mailing list