Freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
January 2008
- 8 participants
- 390 discussions
Author: anthm
Date: Thu Jan 10 19:43:49 2008
New Revision: 7165
Modified:
freeswitch/trunk/src/include/private/switch_core_pvt.h
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c
freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c
freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c
freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c
freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c
freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c
freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_core.c
freeswitch/trunk/src/switch_core_io.c
freeswitch/trunk/src/switch_core_port_allocator.c
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_ivr_async.c
freeswitch/trunk/src/switch_ivr_originate.c
freeswitch/trunk/src/switch_ivr_play_say.c
freeswitch/trunk/src/switch_rtp.c
freeswitch/trunk/src/switch_scheduler.c
freeswitch/trunk/src/switch_stun.c
freeswitch/trunk/src/switch_time.c
freeswitch/trunk/src/switch_utils.c
Log:
try to use clock_gettime to make sure we don't care if the system time changes
Modified: freeswitch/trunk/src/include/private/switch_core_pvt.h
==============================================================================
--- freeswitch/trunk/src/include/private/switch_core_pvt.h (original)
+++ freeswitch/trunk/src/include/private/switch_core_pvt.h Thu Jan 10 19:43:49 2008
@@ -158,6 +158,8 @@
struct switch_runtime {
switch_time_t initiated;
+ switch_time_t reference;
+ int64_t offset;
switch_hash_t *global_vars;
switch_hash_t *mime_types;
switch_memory_pool_t *memory_pool;
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Thu Jan 10 19:43:49 2008
@@ -1536,6 +1536,8 @@
SWITCH_DECLARE(void) switch_core_memory_reclaim_logger(void);
SWITCH_DECLARE(void) switch_core_memory_reclaim_all(void);
SWITCH_DECLARE(void) switch_core_setrlimits(void);
+SWITCH_DECLARE(void) switch_time_sync(void);
+SWITCH_DECLARE(time_t) switch_timestamp(time_t *t);
///\}
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Thu Jan 10 19:43:49 2008
@@ -1065,7 +1065,8 @@
SCSC_SPS,
SCSC_LAST_SPS,
SCSC_RECLAIM,
- SCSC_MAX_SESSIONS
+ SCSC_MAX_SESSIONS,
+ SCSC_SYNC_CLOCK
} switch_session_ctl_t;
typedef struct apr_pool_t switch_memory_pool_t;
Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Thu Jan 10 19:43:49 2008
@@ -600,11 +600,16 @@
}
switch_core_session_ctl(SCSC_SPS, &arg);
stream->write_function(stream, "+OK sessions per second: %d\n", arg);
+ } else if (!strcasecmp(argv[0], "sync_clock")) {
+ arg = 0;
+ switch_core_session_ctl(SCSC_SYNC_CLOCK, &arg);
+ stream->write_function(stream, "+OK clock syncronized\n");
} else {
stream->write_function(stream, "-ERR INVALID COMMAND\nUSAGE: fsctl %s", CTL_SYNTAX);
goto end;
- }
-
+ }
+
+
stream->write_function(stream, "+OK\n");
end:
free(mydata);
@@ -830,13 +835,13 @@
uint32_t mto;
if (*argv[4] == '+') {
if ((mto = atoi(argv[4]+1)) > 0) {
- to = time(NULL) + mto;
+ to = switch_timestamp(NULL) + mto;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
goto done;
}
} else {
- if ((to = atoi(argv[4])) < time(NULL)) {
+ if ((to = atoi(argv[4])) < switch_timestamp(NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
to = 0;
goto done;
@@ -930,7 +935,7 @@
time_t when;
if (*argv[0] == '+') {
- when = time(NULL) + atol(argv[0] + 1);
+ when = switch_timestamp(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -972,7 +977,7 @@
switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT;
if (*argv[0] == '+') {
- when = time(NULL) + atol(argv[0] + 1);
+ when = switch_timestamp(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -1091,7 +1096,7 @@
time_t when;
if (*argv[0] == '+') {
- when = time(NULL) + atol(argv[0] + 1);
+ when = switch_timestamp(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -1603,7 +1608,7 @@
*dcmd++ = '\0';
if (*tm == '+') {
- when = time(NULL) + atol(tm + 1);
+ when = switch_timestamp(NULL) + atol(tm + 1);
} else {
when = atol(tm);
}
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Thu Jan 10 19:43:49 2008
@@ -220,7 +220,7 @@
time_t when;
if (*argv[0] == '+') {
- when = time(NULL) + atol(argv[0] + 1);
+ when = switch_timestamp(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -245,7 +245,7 @@
switch_bool_t bleg = SWITCH_FALSE;
if (*argv[0] == '+') {
- when = time(NULL) + atol(argv[0] + 1);
+ when = switch_timestamp(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -277,7 +277,7 @@
switch_media_flag_t flags = SMF_NONE;
if (*argv[0] == '+') {
- when = time(NULL) + atol(argv[0] + 1);
+ when = switch_timestamp(NULL) + atol(argv[0] + 1);
} else {
when = atol(argv[0]);
}
@@ -749,7 +749,7 @@
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
- switch_time_exp_lt(&tm, switch_time_now());
+ switch_time_exp_lt(&tm, switch_timestamp_now());
switch_strftime(date, &retsize, sizeof(date), argv[1], &tm);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SET [%s]=[%s]\n", argv[0], date);
switch_channel_set_variable(channel, argv[0], date);
@@ -761,7 +761,7 @@
switch_time_t out;
if (switch_strlen_zero(cmd)) {
- out = switch_time_now();
+ out = switch_timestamp_now();
} else {
out = switch_str_time(cmd);
}
@@ -782,7 +782,7 @@
thetime = switch_time_make(atoi(cmd),0);
cmd = p+1;
} else {
- thetime = switch_time_now();
+ thetime = switch_timestamp_now();
}
switch_time_exp_lt(&tm, thetime);
switch_strftime(date, &retsize, sizeof(date), switch_strlen_zero(cmd) ? "%Y-%m-%d %T" : cmd, &tm);
@@ -969,12 +969,12 @@
uint32_t mto;
if (*argv[3] == '+') {
if ((mto = atol(argv[3]+1)) > 0) {
- to = time(NULL) + mto;
+ to = switch_timestamp(NULL) + mto;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
}
} else {
- if ((to = atol(argv[3])) < time(NULL)) {
+ if ((to = atol(argv[3])) < switch_timestamp(NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
to = 0;
}
Modified: freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_enum/mod_enum.c Thu Jan 10 19:43:49 2008
@@ -510,7 +510,7 @@
tv.tv_sec = i;
tv.tv_usec = 0;
i = select((int) (fd + 1), &fds, 0, 0, &tv);
- now = time(NULL);
+ now = switch_timestamp(NULL);
if (i > 0) {
dns_ioevent(nctx, now);
}
Modified: freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c Thu Jan 10 19:43:49 2008
@@ -182,7 +182,7 @@
}
}
- control_packet.unique_id = htonl((u_long)time(NULL));
+ control_packet.unique_id = htonl((u_long)switch_timestamp(NULL));
control_packet.command = htonl(LS_START_BCAST);
control_packet.ip = inet_addr(mcast_ip);
control_packet.port = htonl(mcast_port);
@@ -211,7 +211,7 @@
- control_packet.unique_id = htonl((u_long)time(NULL));
+ control_packet.unique_id = htonl((u_long)switch_timestamp(NULL));
control_packet.command = htonl(LS_STOP_BCAST);
bytes = 8;
switch_socket_sendto(socket, control_packet_addr, 0, (void *)&control_packet, &bytes);
Modified: freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c Thu Jan 10 19:43:49 2008
@@ -484,7 +484,7 @@
switch_size_t retsize;
char dtmf[5] = "";
- switch_time_exp_lt(&tm, switch_time_now());
+ switch_time_exp_lt(&tm, switch_timestamp_now());
switch_strftime(date, &retsize, sizeof(date), "%I:%M %p", &tm);
Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Thu Jan 10 19:43:49 2008
@@ -1380,7 +1380,7 @@
}
}
switch_snprintf(sql, sizeof(sql), "update voicemail_data set read_epoch=%ld where user='%s' and domain='%s' and flags='save'",
- (long)time(NULL), myid, domain_name);
+ (long)switch_timestamp(NULL), myid, domain_name);
vm_execute_sql(profile, sql, profile->mutex);
switch_snprintf(sql, sizeof(sql), "select file_path from voicemail_data where user='%s' and domain='%s' and flags='delete'", myid, domain_name);
vm_execute_sql_callback(profile, profile->mutex, sql, unlink_callback, NULL);
@@ -1891,7 +1891,7 @@
int total_new_urgent_messages = 0;
int total_saved_urgent_messages = 0;
- usql = switch_mprintf("insert into voicemail_data values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long)time(NULL),
+ usql = switch_mprintf("insert into voicemail_data values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long)switch_timestamp(NULL),
id, domain_name, uuid, caller_profile->caller_id_name, caller_profile->caller_id_number,
myfolder, file_path, message_len, read_flags);
vm_execute_sql(profile, usql, profile->mutex);
@@ -1936,7 +1936,7 @@
message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
&total_new_urgent_messages, &total_saved_urgent_messages);
- switch_time_exp_lt(&tm, switch_time_now());
+ switch_time_exp_lt(&tm, switch_timestamp_now());
switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
@@ -2255,7 +2255,7 @@
struct holder holder;
sql = switch_mprintf("update voicemail_data set read_epoch=%ld where user='%s' and domain='%s' and file_path like '%%%s'",
- (long)time(NULL), user, domain, file);
+ (long)switch_timestamp(NULL), user, domain, file);
vm_execute_sql(profile, sql, profile->mutex);
free(sql);
Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c Thu Jan 10 19:43:49 2008
@@ -637,7 +637,7 @@
{
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
- switch_time_t started = switch_time_now();
+ switch_time_t started = switch_timestamp_now();
unsigned int elapsed;
switch_byte_t *data;
@@ -680,7 +680,7 @@
}
if (timeout > -1) {
- elapsed = (unsigned int) ((switch_time_now() - started) / 1000);
+ elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000);
if (elapsed >= (unsigned int) timeout) {
return SWITCH_STATUS_SUCCESS;
}
@@ -724,7 +724,6 @@
switch_swap_linear(frame->data, (int) frame->datalen / 2);
}
#endif
- //printf("Send %ld %d\n", time(NULL), (int) frame->datalen);
iax_send_voice(tech_pvt->iax_session, tech_pvt->codec, frame->data, (int) frame->datalen, tech_pvt->write_codec.implementation->samples_per_frame);
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Thu Jan 10 19:43:49 2008
@@ -1242,7 +1242,7 @@
switch_assert(gp->state < REG_STATE_LAST);
stream->write_function(stream, "%25s\t%s\t %32s\t%s", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
- stream->write_function(stream, " (retry: %ds)", gp->retry - time(NULL));
+ stream->write_function(stream, " (retry: %ds)", gp->retry - switch_timestamp(NULL));
}
stream->write_function(stream, "\n");
}
@@ -1348,7 +1348,7 @@
if (!strcasecmp(argv[1], "stop") || !strcasecmp(argv[1], "restart")) {
int rsec = 3;
- int diff = (int) (time(NULL) - profile->started);
+ int diff = (int) (switch_timestamp(NULL) - profile->started);
int remain = rsec - diff;
if (diff < rsec) {
stream->write_function(stream, "Profile %s must be up for at least %d seconds to stop/restart.\nPlease wait %d second%s\n",
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Thu Jan 10 19:43:49 2008
@@ -345,7 +345,7 @@
char *rpid = switch_event_get_header(event, "orig-rpid");
char *call_id = switch_event_get_header(event, "orig-call-id");
char *user_agent = switch_event_get_header(event, "user-agent");
- long expires = (long) time(NULL) + atol(exp_str);
+ long expires = (long) switch_timestamp(NULL) + atol(exp_str);
char *profile_name = switch_event_get_header(event, "orig-profile-name");
sofia_profile_t *profile = NULL;
@@ -512,19 +512,19 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting thread for %s\n", profile->name);
- profile->started = time(NULL);
+ profile->started = switch_timestamp(NULL);
switch_yield(1000000);
sofia_set_pflag_locked(profile, PFLAG_RUNNING);
while (mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) {
if (++ireg_loops >= IREG_SECONDS) {
- sofia_reg_check_expire(profile, time(NULL));
+ sofia_reg_check_expire(profile, switch_timestamp(NULL));
ireg_loops = 0;
}
if (++gateway_loops >= GATEWAY_SECONDS) {
- sofia_reg_check_gateway(profile, time(NULL));
+ sofia_reg_check_gateway(profile, switch_timestamp(NULL));
gateway_loops = 0;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Thu Jan 10 19:43:49 2008
@@ -72,7 +72,7 @@
}
if (!tech_pvt->owner_id) {
- tech_pvt->owner_id = (uint32_t) time(NULL) - port;
+ tech_pvt->owner_id = (uint32_t) switch_timestamp(NULL) - port;
}
if (!tech_pvt->session_id) {
@@ -1468,7 +1468,8 @@
}
if (match) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Our existing codec is still good, let's keep it\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Our existing codec [%s] is still good, let's keep it\n",
+ tech_pvt->rm_encoding);
goto end;
}
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Thu Jan 10 19:43:49 2008
@@ -608,13 +608,13 @@
char *prpid;
int done = 0;
const char *ct;
- time_t exptime = time(NULL) + 3600;
+ time_t exptime = switch_timestamp(NULL) + 3600;
char exp[80] = "";
if (expires) {
long tmp = atol(expires);
if (tmp > 0) {
- exptime = tmp - time(NULL);
+ exptime = tmp - switch_timestamp(NULL);
}
}
@@ -855,7 +855,7 @@
}
id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
- expire_sec = (int)(expire_sec - time(NULL));
+ expire_sec = (int)(expire_sec - switch_timestamp(NULL));
if (expire_sec < 0) {
expire_sec = 3600;
}
@@ -1047,7 +1047,7 @@
full_via = sip_header_as_string(profile->home, (void *) sip->sip_via);
exp_raw = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600);
- exp = (long) time(NULL) + exp_raw;
+ exp = (long) switch_timestamp(NULL) + exp_raw;
switch_mutex_lock(profile->ireg_mutex);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c Thu Jan 10 19:43:49 2008
@@ -302,7 +302,7 @@
switch_mutex_lock(profile->ireg_mutex);
sql = switch_mprintf("insert into sip_authentication (nonce, expires) values('%q', %ld)",
- uuid_str, time(NULL) + profile->nonce_ttl);
+ uuid_str, switch_timestamp(NULL) + profile->nonce_ttl);
switch_assert(sql != NULL);
sofia_glue_execute_sql(profile, SWITCH_FALSE, sql, NULL);
switch_safe_free(sql);
@@ -495,7 +495,7 @@
sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','%q', '%q', %ld, '%q')", call_id,
to_user, to_host, contact_str, cd ? "Registered(NATHACK)" : "Registered",
- rpid, (long) time(NULL) + (long) exptime * 2, agent);
+ rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, agent);
if (sql) {
Modified: freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c Thu Jan 10 19:43:49 2008
@@ -87,7 +87,7 @@
close(fd->fd);
if (globals.rotate) {
- switch_time_exp_lt(&tm, switch_time_now());
+ switch_time_exp_lt(&tm, switch_timestamp_now());
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
len = strlen(fd->path) + strlen(date) + 2;
Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Thu Jan 10 19:43:49 2008
@@ -354,7 +354,7 @@
uint32_t max_len = sizeof(mbuf);
switch_channel_t *channel = NULL;
*event = NULL;
- start = time(NULL);
+ start = switch_timestamp(NULL);
ptr = mbuf;
@@ -436,7 +436,7 @@
}
if (timeout) {
- elapsed = (uint32_t) (time(NULL) - start);
+ elapsed = (uint32_t) (switch_timestamp(NULL) - start);
if (elapsed >= timeout) {
switch_clear_flag_locked(listener, LFLAG_RUNNING);
return SWITCH_STATUS_FALSE;
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 Thu Jan 10 19:43:49 2008
@@ -2077,14 +2077,14 @@
channel = switch_core_session_get_channel(jss->session);
switch_assert(channel != NULL);
- started = switch_time_now();
+ started = switch_timestamp_now();
if (argc > 0) {
JS_ValueToInt32(cx, argv[0], &timeout);
}
for (;;) {
- if (((elapsed = (unsigned int) ((switch_time_now() - started) / 1000)) > (switch_time_t) timeout)
+ if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
|| switch_channel_get_state(channel) >= CS_HANGUP) {
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
break;
@@ -2116,14 +2116,14 @@
channel = switch_core_session_get_channel(jss->session);
switch_assert(channel != NULL);
- started = switch_time_now();
+ started = switch_timestamp_now();
if (argc > 0) {
JS_ValueToInt32(cx, argv[0], &timeout);
}
for (;;) {
- if (((elapsed = (unsigned int) ((switch_time_now() - started) / 1000)) > (switch_time_t) timeout)
+ if (((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > (switch_time_t) timeout)
|| switch_channel_get_state(channel) >= CS_HANGUP) {
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
break;
Modified: freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c
==============================================================================
--- freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c (original)
+++ freeswitch/trunk/src/mod/loggers/mod_logfile/mod_logfile.c Thu Jan 10 19:43:49 2008
@@ -123,7 +123,7 @@
switch_mutex_lock(globals.mutex);
- switch_time_exp_lt(&tm, switch_time_now());
+ switch_time_exp_lt(&tm, switch_timestamp_now());
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
profile->log_size = 0;
Modified: freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_de/mod_say_de.c Thu Jan 10 19:43:49 2008
@@ -303,7 +303,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) time(NULL);
+ seconds = (int64_t) switch_timestamp(NULL);
}
if (seconds >= 60) {
Modified: freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_en/mod_say_en.c Thu Jan 10 19:43:49 2008
@@ -303,7 +303,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) time(NULL);
+ seconds = (int64_t) switch_timestamp(NULL);
}
if (seconds >= 60) {
Modified: freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_es/mod_say_es.c Thu Jan 10 19:43:49 2008
@@ -303,7 +303,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) time(NULL);
+ seconds = (int64_t) switch_timestamp(NULL);
}
if (seconds >= 60) {
Modified: freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_fr/mod_say_fr.c Thu Jan 10 19:43:49 2008
@@ -303,7 +303,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) time(NULL);
+ seconds = (int64_t) switch_timestamp(NULL);
}
if (seconds >= 60) {
Modified: freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_it/mod_say_it.c Thu Jan 10 19:43:49 2008
@@ -303,7 +303,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) time(NULL);
+ seconds = (int64_t) switch_timestamp(NULL);
}
if (seconds >= 60) {
Modified: freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c
==============================================================================
--- freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c (original)
+++ freeswitch/trunk/src/mod/say/mod_say_nl/mod_say_nl.c Thu Jan 10 19:43:49 2008
@@ -303,7 +303,7 @@
}
} else {
if ((seconds = atoi(tosay)) <= 0) {
- seconds = (int64_t) time(NULL);
+ seconds = (int64_t) switch_timestamp(NULL);
}
if (seconds >= 60) {
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Thu Jan 10 19:43:49 2008
@@ -1048,7 +1048,7 @@
}
caller_profile->times = (switch_channel_timetable_t *) switch_core_session_alloc(channel->session, sizeof(*caller_profile->times));
- caller_profile->times->profile_created = switch_time_now();
+ caller_profile->times->profile_created = switch_timestamp_now();
if (channel->caller_profile && channel->caller_profile->times) {
channel->caller_profile->times->transferred = caller_profile->times->profile_created;
@@ -1056,7 +1056,7 @@
caller_profile->times->created = channel->caller_profile->times->created;
caller_profile->times->hungup = channel->caller_profile->times->hungup;
} else {
- caller_profile->times->created = switch_time_now();
+ caller_profile->times->created = switch_timestamp_now();
}
caller_profile->next = channel->caller_profile;
@@ -1246,7 +1246,7 @@
if (channel->caller_profile && channel->caller_profile->times && !channel->caller_profile->times->hungup) {
switch_mutex_lock(channel->profile_mutex);
- channel->caller_profile->times->hungup = switch_time_now();
+ channel->caller_profile->times->hungup = switch_timestamp_now();
switch_mutex_unlock(channel->profile_mutex);
}
@@ -1403,7 +1403,7 @@
if (channel->caller_profile && channel->caller_profile->times) {
switch_mutex_lock(channel->profile_mutex);
- channel->caller_profile->times->answered = switch_time_now();
+ channel->caller_profile->times->answered = switch_timestamp_now();
switch_mutex_unlock(channel->profile_mutex);
}
Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c (original)
+++ freeswitch/trunk/src/switch_core.c Thu Jan 10 19:43:49 2008
@@ -80,13 +80,9 @@
send_heartbeat();
/* reschedule this task */
- task->runtime = time(NULL) + 20;
+ task->runtime = switch_timestamp(NULL) + 20;
}
-SWITCH_DECLARE(switch_time_t) switch_timestamp_now(void)
-{
- return runtime.timestamp ? runtime.timestamp : switch_time_now();
-}
SWITCH_DECLARE(switch_status_t) switch_core_set_console(const char *console)
{
@@ -832,7 +828,7 @@
switch_scheduler_task_thread_start();
runtime.initiated = switch_time_now();
- switch_scheduler_add_task(time(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
+ switch_scheduler_add_task(switch_timestamp(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
switch_uuid_get(&uuid);
@@ -966,7 +962,7 @@
SWITCH_DECLARE(switch_time_t) switch_core_uptime(void)
{
- return switch_time_now() - runtime.initiated;
+ return switch_timestamp_now() - runtime.initiated;
}
SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t * val)
@@ -976,6 +972,10 @@
}
switch (cmd) {
+ case SCSC_SYNC_CLOCK:
+ switch_time_sync();
+ *val = 0;
+ break;
case SCSC_PAUSE_INBOUND:
if (*val) {
switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Thu Jan 10 19:43:49 2008
@@ -270,7 +270,7 @@
switch_mutex_lock(bp->read_mutex);
switch_buffer_write(bp->raw_read_buffer, read_frame->data, read_frame->datalen);
if (bp->callback) {
- if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ) == SWITCH_FALSE || (bp->stop_time && bp->stop_time <= time(NULL))) {
+ if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ) == SWITCH_FALSE || (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
ok = SWITCH_FALSE;
}
}
@@ -404,7 +404,7 @@
if (bp->ready && switch_test_flag(bp, SMBF_READ_PING)) {
switch_mutex_lock(bp->read_mutex);
if (bp->callback) {
- if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_PING) == SWITCH_FALSE || (bp->stop_time && bp->stop_time <= time(NULL))) {
+ if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_PING) == SWITCH_FALSE || (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
ok = SWITCH_FALSE;
}
}
@@ -616,7 +616,7 @@
}
}
- if (bp->stop_time && bp->stop_time <= time(NULL)) {
+ if (bp->stop_time && bp->stop_time <= switch_timestamp(NULL)) {
ok = SWITCH_FALSE;
}
Modified: freeswitch/trunk/src/switch_core_port_allocator.c
==============================================================================
--- freeswitch/trunk/src/switch_core_port_allocator.c (original)
+++ freeswitch/trunk/src/switch_core_port_allocator.c Thu Jan 10 19:43:49 2008
@@ -118,7 +118,7 @@
int odd = switch_test_flag(alloc, SPF_ODD);
switch_mutex_lock(alloc->mutex);
- srand(getpid() + (unsigned)time(NULL));
+ srand(getpid() + (unsigned)switch_timestamp(NULL));
while(alloc->track_used < alloc->track_len) {
double r;
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Thu Jan 10 19:43:49 2008
@@ -40,17 +40,17 @@
{
switch_channel_t *channel;
switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_time_t start, now, done = switch_time_now() + (ms * 1000);
+ switch_time_t start, now, done = switch_timestamp_now() + (ms * 1000);
switch_frame_t *read_frame;
int32_t left, elapsed;
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
- start = switch_time_now();
+ start = switch_timestamp_now();
for (;;) {
- now = switch_time_now();
+ now = switch_timestamp_now();
elapsed = (int32_t) ((now - start) / 1000);
left = ms - elapsed;
@@ -548,7 +548,7 @@
}
if (timeout) {
- started = switch_time_now();
+ started = switch_timestamp_now();
}
while (switch_channel_ready(channel)) {
@@ -557,7 +557,7 @@
switch_dtmf_t dtmf = {0};
if (timeout) {
- elapsed = (uint32_t) ((switch_time_now() - started) / 1000);
+ elapsed = (uint32_t) ((switch_timestamp_now() - started) / 1000);
if (elapsed >= timeout) {
break;
}
@@ -1191,12 +1191,12 @@
stream->digits = tmp;
*(stream->digits + (len++)) = digit;
*(stream->digits + len) = '\0';
- stream->last_digit_time = switch_time_now() / 1000;
+ stream->last_digit_time = switch_timestamp_now() / 1000;
}
}
}
// don't allow collected digit string testing if there are varying sized keys until timeout
- if (parser->maxlen - parser->minlen > 0 && (switch_time_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) {
+ if (parser->maxlen - parser->minlen > 0 && (switch_timestamp_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) {
len = 0;
}
// if we have digits to test
Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c (original)
+++ freeswitch/trunk/src/switch_ivr_async.c Thu Jan 10 19:43:49 2008
@@ -307,7 +307,7 @@
switch_channel_pre_answer(channel);
if (limit) {
- to = time(NULL) + limit;
+ to = switch_timestamp(NULL) + limit;
}
if (flags && strchr(flags, 'm')) {
@@ -763,7 +763,7 @@
}
if (limit) {
- to = time(NULL) + limit;
+ to = switch_timestamp(NULL) + limit;
}
if ((status = switch_core_media_bug_add(session, record_callback, fh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Thu Jan 10 19:43:49 2008
@@ -899,7 +899,7 @@
}
- time(&start);
+ switch_timestamp(&start);
for (;;) {
uint32_t valid_channels = 0;
@@ -922,7 +922,7 @@
goto notready;
}
- if ((time(NULL) - start) > (time_t) timelimit_sec) {
+ if ((switch_timestamp(NULL) - start) > (time_t) timelimit_sec) {
to++;
idx = IDX_CANCEL;
goto notready;
@@ -1036,7 +1036,7 @@
}
// When the AND operator is being used, and fail_on_single_reject is set, a hangup indicates that the call should fail.
- if ((to = (uint8_t) ((time(NULL) - start) >= (time_t) timelimit_sec))
+ if ((to = (uint8_t) ((switch_timestamp(NULL) - start) >= (time_t) timelimit_sec))
|| (fail_on_single_reject && hups)) {
idx = IDX_CANCEL;
goto notready;
Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c (original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c Thu Jan 10 19:43:49 2008
@@ -434,7 +434,7 @@
}
if (limit) {
- start = time(NULL);
+ start = switch_timestamp(NULL);
}
if (fh->thresh) {
@@ -464,7 +464,7 @@
switch_ivr_parse_all_events(session);
}
- if (start && (time(NULL) - start) > limit) {
+ if (start && (switch_timestamp(NULL) - start) > limit) {
break;
}
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Thu Jan 10 19:43:49 2008
@@ -1063,7 +1063,7 @@
uint16_t in_digit_seq = ntohs((uint16_t) rtp_session->recv_msg.header.seq);
/* SHEESH.... Curse you RFC2833 inventors!!!! */
- if ((time(NULL) - rtp_session->dtmf_data.last_digit_time) > 2) {
+ if ((switch_timestamp(NULL) - rtp_session->dtmf_data.last_digit_time) > 2) {
rtp_session->dtmf_data.last_digit = 0;
rtp_session->dtmf_data.dc = 0;
rtp_session->dtmf_data.in_digit_seq = 0;
@@ -1073,7 +1073,7 @@
if (duration && end) {
if (key != rtp_session->dtmf_data.last_digit) {
switch_dtmf_t dtmf = { key, duration };
- time(&rtp_session->dtmf_data.last_digit_time);
+ switch_timestamp(&rtp_session->dtmf_data.last_digit_time);
switch_rtp_queue_rfc2833_in(rtp_session, &dtmf);
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK);
}
@@ -1347,7 +1347,7 @@
uint32_t rate = 0;
uint32_t codec_flags = 0;
uint32_t len = sizeof(decoded);
- time_t now = time(NULL);
+ time_t now = switch_timestamp(NULL);
send = 0;
@@ -1523,7 +1523,7 @@
rtp_session->vad_data.cng_freq = 50;
rtp_session->vad_data.ts = 1;
rtp_session->vad_data.start = 0;
- rtp_session->vad_data.next_scan = time(NULL);
+ rtp_session->vad_data.next_scan = switch_timestamp(NULL);
rtp_session->vad_data.scan_freq = 0;
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_VAD);
switch_set_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_CNG);
Modified: freeswitch/trunk/src/switch_scheduler.c
==============================================================================
--- freeswitch/trunk/src/switch_scheduler.c (original)
+++ freeswitch/trunk/src/switch_scheduler.c Thu Jan 10 19:43:49 2008
@@ -77,7 +77,7 @@
if (done) {
tp->destroyed = 1;
} else {
- int64_t now = time(NULL);
+ int64_t now = switch_timestamp(NULL);
if (now >= tp->task.runtime && !tp->in_thread) {
int32_t diff = (int32_t)(now - tp->task.runtime);
if (diff > 1) {
@@ -160,7 +160,7 @@
switch_zmalloc(container, sizeof(*container));
switch_assert(func);
container->func = func;
- container->task.created = time(NULL);
+ container->task.created = switch_timestamp(NULL);
container->task.runtime = task_runtime;
container->task.group = strdup(group ? group : "none");
container->task.cmd_id = cmd_id;
Modified: freeswitch/trunk/src/switch_stun.c
==============================================================================
--- freeswitch/trunk/src/switch_stun.c (original)
+++ freeswitch/trunk/src/switch_stun.c Thu Jan 10 19:43:49 2008
@@ -314,7 +314,7 @@
switch_stun_packet_attribute_add_username(packet, username, 32);
bytes = switch_stun_packet_length(packet);
switch_socket_sendto(sock, remote_addr, 0, (void *) packet, &bytes);
- started = switch_time_now();
+ started = switch_timestamp_now();
*ip = NULL;
*port = 0;
@@ -326,7 +326,7 @@
break;
}
- if ((elapsed = (unsigned int) ((switch_time_now() - started) / 1000)) > 5000) {
+ if ((elapsed = (unsigned int) ((switch_timestamp_now() - started) / 1000)) > 5000) {
*err = "Timeout";
switch_socket_shutdown(sock, SWITCH_SHUTDOWN_READWRITE);
switch_socket_close(sock);
Modified: freeswitch/trunk/src/switch_time.c
==============================================================================
--- freeswitch/trunk/src/switch_time.c (original)
+++ freeswitch/trunk/src/switch_time.c Thu Jan 10 19:43:49 2008
@@ -59,6 +59,9 @@
SWITCH_MODULE_DEFINITION(softtimer, softtimer_load, softtimer_shutdown, softtimer_runtime);
#define MAX_ELEMENTS 1000
+#define IDLE_SPEED 100
+#define STEP_MS 1
+#define STEP_MIC 1000
struct timer_private {
switch_size_t reference;
@@ -77,7 +80,45 @@
static timer_matrix_t TIMER_MATRIX[MAX_ELEMENTS + 1];
-#define IDLE_SPEED 100
+
+SWITCH_DECLARE(switch_time_t) switch_timestamp_now(void)
+{
+ return runtime.timestamp ? runtime.timestamp : switch_time_now();
+}
+
+
+SWITCH_DECLARE(time_t) switch_timestamp(time_t *t)
+{
+ time_t now = switch_timestamp_now() / APR_USEC_PER_SEC;
+ if (t) {
+ *t = now;
+ }
+ return now;
+}
+
+static switch_time_t time_now(int64_t offset)
+{
+ switch_time_t now;
+
+#if defined(HAVE_CLOCK_GETTIME)
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ now = ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec/1000) + offset;
+
+#else
+ now = switch_time_now();
+#endif
+
+ return now;
+}
+
+SWITCH_DECLARE(void) switch_time_sync(void)
+{
+ runtime.reference = switch_time_now();
+ runtime.offset = runtime.reference - time_now(0);
+ runtime.reference = time_now(runtime.offset);
+}
+
SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t)
@@ -225,15 +266,14 @@
}
-#define STEP_MS 1
-#define STEP_MIC 1000
-
SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
{
- switch_time_t reference = switch_time_now();
+ switch_time_t too_late = STEP_MIC * 128;
uint32_t current_ms = 0;
uint32_t x, tick = 0;
- switch_time_t ts = 0;
+ switch_time_t ts = 0, last = 0;
+
+ switch_time_sync();
memset(&globals, 0, sizeof(globals));
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
@@ -243,15 +283,35 @@
runtime.sps = runtime.sps_total;
switch_mutex_unlock(runtime.throttle_mutex);
+
while (globals.RUNNING == 1) {
- reference += STEP_MIC;
- while ((ts = switch_time_now()) < reference) {
+ runtime.reference += STEP_MIC;
+ while ((ts = time_now(runtime.offset)) < runtime.reference) {
+ if (ts < last) {
+ int64_t diff = (int64_t)(ts - last);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Reverse Clock Skew Detected!\n");
+ runtime.reference = switch_time_now();
+ current_ms = 0;
+ tick = 0;
+ runtime.initiated += diff;
+ }
switch_yield(STEP_MIC);
+ last = ts;
}
+
+ if (ts > (runtime.reference + too_late)) {
+ switch_time_t diff = ts - runtime.reference - STEP_MIC;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Forward Clock Skew Detected!\n");
+ runtime.reference = switch_time_now();
+ current_ms = 0;
+ tick = 0;
+ runtime.initiated += diff;
+ }
+
runtime.timestamp = ts;
current_ms += STEP_MS;
tick += STEP_MS;
-
+
if (tick >= 1000) {
if (runtime.sps <= 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Rate of %d!\n", runtime.sps_total);
Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c (original)
+++ freeswitch/trunk/src/switch_utils.c Thu Jan 10 19:43:49 2008
@@ -230,7 +230,7 @@
unsigned char in[B64BUFFLEN];
unsigned char out[B64BUFFLEN + 512];
- switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int)time(NULL), rand() & 0xffff);
+ switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int)switch_timestamp(NULL), rand() & 0xffff);
if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
if (file) {
@@ -691,7 +691,7 @@
switch_time_t ret = 0;
char *pattern = "^(\\d+)-(\\d+)-(\\d+)\\s*(\\d*):{0,1}(\\d*):{0,1}(\\d*)";
- switch_time_exp_lt(&tm, switch_time_now());
+ switch_time_exp_lt(&tm, switch_timestamp_now());
tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
if ((proceed = switch_regex_perform(in, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
1
0
Author: anthm
Date: Thu Jan 10 11:59:23 2008
New Revision: 7164
Modified:
freeswitch/trunk/src/include/switch_rtp.h
freeswitch/trunk/src/switch_rtp.c
Log:
always use our ssrc
Modified: freeswitch/trunk/src/include/switch_rtp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_rtp.h (original)
+++ freeswitch/trunk/src/include/switch_rtp.h Thu Jan 10 11:59:23 2008
@@ -352,7 +352,7 @@
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
void *data,
uint32_t datalen,
- uint8_t m, switch_payload_t payload, uint32_t ts, uint32_t ssrc, switch_frame_flag_t *flags);
+ uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags);
/*!
\brief Retrieve the SSRC from a given RTP session
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Thu Jan 10 11:59:23 2008
@@ -105,7 +105,6 @@
unsigned int out_digit_sofar;
unsigned int out_digit_dur;
uint16_t in_digit_seq;
- uint32_t out_digit_ssrc;
int32_t timestamp_dtmf;
char last_digit;
unsigned int dc;
@@ -138,7 +137,6 @@
uint32_t last_write_ts;
uint32_t last_write_samplecount;
uint16_t last_write_seq;
- uint32_t last_write_ssrc;
uint32_t flags;
switch_memory_pool_t *pool;
switch_sockaddr_t *from_addr;
@@ -486,7 +484,6 @@
return SWITCH_STATUS_MEMERR;
}
- rtp_session->dtmf_data.out_digit_ssrc = ssrc;
rtp_session->pool = pool;
rtp_session->te = 101;
@@ -819,7 +816,7 @@
4,
0,
rtp_session->te,
- rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_ssrc,
+ rtp_session->dtmf_data.timestamp_dtmf,
&flags);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%d dur=%d seq=%d\n",
loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit, rtp_session->dtmf_data.timestamp_dtmf,
@@ -847,7 +844,7 @@
rtp_session->dtmf_data.out_digit_packet[1] = 7;
rtp_session->dtmf_data.timestamp_dtmf = rtp_session->last_write_ts + samples;
- rtp_session->dtmf_data.out_digit_ssrc = rtp_session->last_write_ssrc;
+
switch_rtp_write_manual(rtp_session,
rtp_session->dtmf_data.out_digit_packet,
@@ -855,7 +852,7 @@
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BUGGY_2833) ? 0 : 1,
rtp_session->te,
rtp_session->dtmf_data.timestamp_dtmf,
- rtp_session->dtmf_data.out_digit_ssrc, &flags);
+ &flags);
switch_log_printf(SWITCH_CHANNEL_LOG,
SWITCH_LOG_DEBUG,
@@ -1452,7 +1449,6 @@
if (send) {
rtp_session->last_write_ts = ntohl(send_msg->header.ts);
- rtp_session->last_write_ssrc = ntohl(send_msg->header.ssrc);
rtp_session->last_write_seq = rtp_session->seq;
if (rtp_session->timer.interval) {
switch_core_timer_check(&rtp_session->timer);
@@ -1588,7 +1584,8 @@
if (switch_test_flag(frame, SFF_RTP_HEADER)) {
return switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, frame->m, frame->payload,
- (uint32_t)(frame->timestamp), frame->ssrc, &frame->flags);
+ (uint32_t)(frame->timestamp), &frame->flags);
+
}
if (fwd) {
@@ -1619,7 +1616,7 @@
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
void *data,
uint32_t datalen,
- uint8_t m, switch_payload_t payload, uint32_t ts, uint32_t ssrc, switch_frame_flag_t *flags)
+ uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags)
{
switch_size_t bytes;
uint16_t mseq;
@@ -1641,7 +1638,6 @@
rtp_session->write_msg = rtp_session->send_msg;
rtp_session->write_msg.header.seq = htons(mseq);
rtp_session->write_msg.header.ts = htonl(ts);
- rtp_session->write_msg.header.ssrc = htonl(ssrc);
rtp_session->write_msg.header.pt = payload;
rtp_session->write_msg.header.m = m ? 1 : 0;
memcpy(rtp_session->write_msg.body, data, datalen);
1
0
Author: anthm
Date: Wed Jan 9 22:12:32 2008
New Revision: 7163
Modified:
freeswitch/trunk/src/switch_core_file.c
Log:
fix mem err
Modified: freeswitch/trunk/src/switch_core_file.c
==============================================================================
--- freeswitch/trunk/src/switch_core_file.c (original)
+++ freeswitch/trunk/src/switch_core_file.c Wed Jan 9 22:12:32 2008
@@ -130,7 +130,7 @@
switch_assert(fh->file_interface != NULL);
if (fh->buffer && switch_buffer_inuse(fh->buffer)) {
- *len = switch_buffer_read(fh->buffer, data, orig_len);
+ *len = switch_buffer_read(fh->buffer, data, orig_len * 2) / 2;
return SWITCH_STATUS_SUCCESS;
}
@@ -154,21 +154,21 @@
fh->resampler->from_len = switch_short_to_float(data, fh->resampler->from, (int) *len);
fh->resampler->to_len =
switch_resample_process(fh->resampler, fh->resampler->from, fh->resampler->from_len, fh->resampler->to, fh->resampler->to_size, 0);
-
+
if (fh->resampler->to_len > orig_len) {
if (!fh->buffer) {
switch_buffer_create_dynamic(&fh->buffer, fh->resampler->to_len * 2, fh->resampler->to_len * 4, fh->resampler->to_len * 8);
switch_assert(fh->buffer);
}
if (!fh->dbuf) {
- fh->dbuflen = fh->resampler->to_len * 2;
+ fh->dbuflen = fh->resampler->to_len * 8;
fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
}
switch_assert(fh->resampler->to_len <= fh->dbuflen);
switch_float_to_short(fh->resampler->to, (int16_t *) fh->dbuf, fh->resampler->to_len);
switch_buffer_write(fh->buffer, fh->dbuf, fh->resampler->to_len * 2);
- *len = switch_buffer_read(fh->buffer, data, orig_len);
+ *len = switch_buffer_read(fh->buffer, data, orig_len * 2) / 2;
} else {
switch_float_to_short(fh->resampler->to, data, fh->resampler->to_len);
*len = fh->resampler->to_len;
1
0
Author: mikej
Date: Wed Jan 9 22:10:58 2008
New Revision: 7162
Modified:
freeswitch/trunk/src/include/switch_rtp.h
freeswitch/trunk/src/switch_rtp.c
Log:
always re-write sequence numbers (even passthrough) so we don't jump, use the ssrc that we are using (even if we are in passthrough) for sending 2833. Fix for FSCORE-83. Thanks wchance for all your testing help.
Modified: freeswitch/trunk/src/include/switch_rtp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_rtp.h (original)
+++ freeswitch/trunk/src/include/switch_rtp.h Wed Jan 9 22:10:58 2008
@@ -345,7 +345,6 @@
\param m set mark bit or not
\param payload the IANA payload number
\param ts then number of bytes to increment the timestamp by
- \param mseq the specific sequence number to use
\param ssrc the ssrc
\param flags frame flags
\return the number of bytes written
@@ -353,7 +352,7 @@
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
void *data,
uint32_t datalen,
- uint8_t m, switch_payload_t payload, uint32_t ts, uint16_t mseq, uint32_t ssrc, switch_frame_flag_t *flags);
+ uint8_t m, switch_payload_t payload, uint32_t ts, uint32_t ssrc, switch_frame_flag_t *flags);
/*!
\brief Retrieve the SSRC from a given RTP session
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Wed Jan 9 22:10:58 2008
@@ -814,14 +814,12 @@
for (x = 0; x < loops; x++) {
- rtp_session->seq++;
-
switch_rtp_write_manual(rtp_session,
rtp_session->dtmf_data.out_digit_packet,
4,
0,
rtp_session->te,
- rtp_session->dtmf_data.timestamp_dtmf, rtp_session->seq, rtp_session->dtmf_data.out_digit_ssrc,
+ rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_ssrc,
&flags);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%d dur=%d seq=%d\n",
loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit, rtp_session->dtmf_data.timestamp_dtmf,
@@ -849,15 +847,14 @@
rtp_session->dtmf_data.out_digit_packet[1] = 7;
rtp_session->dtmf_data.timestamp_dtmf = rtp_session->last_write_ts + samples;
+ rtp_session->dtmf_data.out_digit_ssrc = rtp_session->last_write_ssrc;
- rtp_session->seq++;
switch_rtp_write_manual(rtp_session,
rtp_session->dtmf_data.out_digit_packet,
4,
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BUGGY_2833) ? 0 : 1,
rtp_session->te,
rtp_session->dtmf_data.timestamp_dtmf,
- rtp_session->seq,
rtp_session->dtmf_data.out_digit_ssrc, &flags);
switch_log_printf(SWITCH_CHANNEL_LOG,
@@ -1300,6 +1297,8 @@
if (flags && *flags & SFF_RFC2833) {
send_msg->header.pt = rtp_session->te;
}
+ rtp_session->seq++;
+ send_msg->header.seq = htons(rtp_session->seq);
} else {
uint8_t m = 0;
@@ -1460,7 +1459,7 @@
rtp_session->last_write_samplecount = rtp_session->timer.samplecount;
}
switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) send_msg, &bytes);
- } else if (!fwd) {
+ } else {
/* nevermind save this seq inc for next time */
rtp_session->seq--;
rtp_session->send_msg.header.seq = htons(rtp_session->seq);
@@ -1589,7 +1588,7 @@
if (switch_test_flag(frame, SFF_RTP_HEADER)) {
return switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, frame->m, frame->payload,
- (uint32_t)(frame->timestamp), frame->seq, frame->ssrc, &frame->flags);
+ (uint32_t)(frame->timestamp), frame->ssrc, &frame->flags);
}
if (fwd) {
@@ -1620,9 +1619,10 @@
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
void *data,
uint32_t datalen,
- uint8_t m, switch_payload_t payload, uint32_t ts, uint16_t mseq, uint32_t ssrc, switch_frame_flag_t *flags)
+ uint8_t m, switch_payload_t payload, uint32_t ts, uint32_t ssrc, switch_frame_flag_t *flags)
{
switch_size_t bytes;
+ uint16_t mseq;
if (!switch_rtp_ready(rtp_session)) {
return -1;
@@ -1636,6 +1636,8 @@
return -1;
}
+ rtp_session->seq++;
+ mseq = rtp_session->seq;
rtp_session->write_msg = rtp_session->send_msg;
rtp_session->write_msg.header.seq = htons(mseq);
rtp_session->write_msg.header.ts = htonl(ts);
@@ -1660,8 +1662,12 @@
}
if (switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) &rtp_session->write_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
+ rtp_session->seq--;
return -1;
}
+
+ rtp_session->last_write_seq = rtp_session->seq;
+
return (int) bytes;
}
1
0
Author: anthm
Date: Wed Jan 9 19:57:06 2008
New Revision: 7161
Modified:
freeswitch/trunk/src/switch_ivr_bridge.c
Log:
update
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Wed Jan 9 19:57:06 2008
@@ -311,9 +311,8 @@
switch_channel_clear_flag(channel, CF_TRANSFER);
if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
- printf("XXXXXXXXXXXXXXXXXXXOK\n");
switch_channel_set_state(channel, CS_TRANSMIT);
- } else printf("XXXXXXXXXXXXXXXXXXXWTF\n");
+ }
return SWITCH_STATUS_SUCCESS;
}
@@ -386,7 +385,7 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", switch_core_session_get_uuid(session));
switch_event_fire(&event);
}
- printf("XXXXXXXXXXXXXXXXXXXBLAH\n");
+
switch_ivr_multi_threaded_bridge(session, other_session, NULL, NULL, NULL);
switch_core_session_rwunlock(other_session);
} else {
1
0
[commit] r7160 - in freeswitch/trunk/src: . include mod/applications/mod_dptools
by Freeswitch SVN 10 Jan '08
by Freeswitch SVN 10 Jan '08
10 Jan '08
Author: anthm
Date: Wed Jan 9 19:45:28 2008
New Revision: 7160
Modified:
freeswitch/trunk/src/include/switch_channel.h
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/switch_ivr_bridge.c
Log:
minor changes
Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h (original)
+++ freeswitch/trunk/src/include/switch_channel.h Wed Jan 9 19:45:28 2008
@@ -470,7 +470,7 @@
SWITCH_DECLARE(char *) switch_channel_build_param_string(switch_channel_t *channel, switch_caller_profile_t *caller_profile, const char *prefix);
SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *channel);
-#define switch_channel_stop_broadcast(_channel) switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
+#define switch_channel_stop_broadcast(_channel) if (switch_channel_test_flag(_channel, CF_BROADCAST)) switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
/** @} */
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Wed Jan 9 19:45:28 2008
@@ -95,6 +95,17 @@
}
}
+
+#define eavesdrop_SYNTAX "<uuid>"
+SWITCH_STANDARD_APP(three_way_function)
+{
+ if (switch_strlen_zero(data)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", eavesdrop_SYNTAX);
+ } else {
+ switch_ivr_eavesdrop_session(session, data, ED_MUX_READ | ED_MUX_WRITE);
+ }
+}
+
#define SET_USER_SYNTAX "<user>@<domain>"
SWITCH_STANDARD_APP(set_user_function)
{
@@ -1578,6 +1589,7 @@
SWITCH_ADD_APP(app_interface, "execute_extension", "Execute an extension", "Execute an extension", exe_function, EXE_SYNTAX, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "intercept", "intercept", "intercept", intercept_function, INTERCEPT_SYNTAX, SAF_NONE);
SWITCH_ADD_APP(app_interface, "eavesdrop", "eavesdrop on a uuid", "eavesdrop on a uuid", eavesdrop_function, eavesdrop_SYNTAX, SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "three_way", "three way call with a uuid", "three way call with a uuid", three_way_function, eavesdrop_SYNTAX, SAF_NONE);
SWITCH_ADD_APP(app_interface, "set_user", "Set a User", "Set a User", set_user_function, SET_USER_SYNTAX, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "stop_dtmf", "stop inband dtmf", "Stop detecting inband dtmf.", stop_dtmf_session_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_NONE);
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Wed Jan 9 19:45:28 2008
@@ -311,8 +311,9 @@
switch_channel_clear_flag(channel, CF_TRANSFER);
if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
+ printf("XXXXXXXXXXXXXXXXXXXOK\n");
switch_channel_set_state(channel, CS_TRANSMIT);
- }
+ } else printf("XXXXXXXXXXXXXXXXXXXWTF\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -322,7 +323,7 @@
switch_channel_t *channel = NULL;
switch_core_session_t *other_session;
const char *other_uuid = NULL;
-
+
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
@@ -385,7 +386,7 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application-Data", "%s", switch_core_session_get_uuid(session));
switch_event_fire(&event);
}
-
+ printf("XXXXXXXXXXXXXXXXXXXBLAH\n");
switch_ivr_multi_threaded_bridge(session, other_session, NULL, NULL, NULL);
switch_core_session_rwunlock(other_session);
} else {
@@ -810,8 +811,8 @@
switch_channel_set_caller_profile(originator_channel, cp);
switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp));
- switch_channel_set_flag(originator_channel, CF_BREAK);
- switch_channel_set_flag(originatee_channel, CF_BREAK);
+ switch_channel_stop_broadcast(originator_channel);
+ switch_channel_stop_broadcast(originatee_channel);
switch_channel_set_flag(originator_channel, CF_TRANSFER);
switch_channel_set_flag(originatee_channel, CF_TRANSFER);
1
0
[commit] r7159 - freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/sql
by Freeswitch SVN 09 Jan '08
by Freeswitch SVN 09 Jan '08
09 Jan '08
Author: intralanman
Date: Wed Jan 9 18:30:25 2008
New Revision: 7159
Added:
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/sql/
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0.sql
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0.sql
Log:
mysql schema to go along with my last commit.... it's not perfect, by far.... need to add some unique keys on some tables, etc
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0.sql
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0.sql Wed Jan 9 18:30:25 2008
@@ -0,0 +1,524 @@
+-- MySQL dump 10.11
+--
+-- Host: localhost Database: freeswitch
+-- ------------------------------------------------------
+-- Server version 5.0.45-community-nt
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL40' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+DROP TABLE IF EXISTS `conference_advertise`;
+CREATE TABLE `conference_advertise` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `room` varchar(64) NOT NULL,
+ `status` varchar(128) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_room` (`room`)
+) TYPE=InnoDB AUTO_INCREMENT=8;
+
+--
+-- Table structure for table `conference_controls`
+--
+
+DROP TABLE IF EXISTS `conference_controls`;
+CREATE TABLE `conference_controls` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `conf_group` varchar(64) NOT NULL,
+ `action` varchar(64) NOT NULL,
+ `digits` varchar(16) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_group_action` (`conf_group`,`action`)
+) TYPE=InnoDB AUTO_INCREMENT=25;
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+DROP TABLE IF EXISTS `conference_profiles`;
+CREATE TABLE `conference_profiles` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `profile_name` varchar(64) NOT NULL,
+ `param_name` varchar(64) NOT NULL,
+ `param_value` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `unique_profile_param` (`profile_name`,`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=13;
+
+--
+-- Table structure for table `db_data`
+--
+
+DROP TABLE IF EXISTS `db_data`;
+CREATE TABLE `db_data` (
+ `hostname` varchar(255) default NULL,
+ `realm` varchar(255) default NULL,
+ `data_key` varchar(255) default NULL,
+ `data` varchar(255) default NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `dialplan`
+--
+
+DROP TABLE IF EXISTS `dialplan`;
+CREATE TABLE `dialplan` (
+ `id` int(11) NOT NULL auto_increment,
+ `context` varchar(64) NOT NULL,
+ `extension` varchar(64) NOT NULL,
+ `condition_field` varchar(64) NOT NULL,
+ `condition_expression` varchar(64) NOT NULL,
+ `application_name` varchar(64) NOT NULL,
+ `application_data` text,
+ `weight` int(11) NOT NULL,
+ `type` varchar(16) NOT NULL default 'action',
+ `ext_continue` smallint(1) NOT NULL default '0',
+ `global_weight` int(11) NOT NULL default '10000',
+ `condition_continue` varchar(8) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=112;
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+DROP TABLE IF EXISTS `dingaling_profile_params`;
+CREATE TABLE `dingaling_profile_params` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `dingaling_id` int(10) unsigned NOT NULL,
+ `param_name` varchar(64) NOT NULL,
+ `param_value` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_type_name` (`dingaling_id`,`param_name`),
+ CONSTRAINT `dingaling_profile` FOREIGN KEY (`dingaling_id`) REFERENCES `dingaling_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) TYPE=InnoDB AUTO_INCREMENT=5;
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+DROP TABLE IF EXISTS `dingaling_profiles`;
+CREATE TABLE `dingaling_profiles` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `profile_name` varchar(64) NOT NULL,
+ `type` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_name` (`profile_name`)
+) TYPE=InnoDB AUTO_INCREMENT=3;
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+DROP TABLE IF EXISTS `dingaling_settings`;
+CREATE TABLE `dingaling_settings` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `param_name` varchar(64) NOT NULL,
+ `param_value` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_param` (`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=3;
+
+--
+-- Table structure for table `directory`
+--
+
+DROP TABLE IF EXISTS `directory`;
+CREATE TABLE `directory` (
+ `id` int(11) NOT NULL auto_increment,
+ `username` varchar(255) NOT NULL,
+ `domain` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=5;
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+DROP TABLE IF EXISTS `directory_gateway_params`;
+CREATE TABLE `directory_gateway_params` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `d_gw_id` int(10) unsigned NOT NULL,
+ `param_name` varchar(64) NOT NULL,
+ `param_value` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_gw_param` (`d_gw_id`,`param_name`)
+) TYPE=InnoDB AUTO_INCREMENT=10;
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+DROP TABLE IF EXISTS `directory_gateways`;
+CREATE TABLE `directory_gateways` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `directory_id` int(10) unsigned NOT NULL,
+ `gateway_name` varchar(128) NOT NULL,
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=4;
+
+--
+-- Table structure for table `directory_params`
+--
+
+DROP TABLE IF EXISTS `directory_params`;
+CREATE TABLE `directory_params` (
+ `id` int(11) NOT NULL auto_increment,
+ `directory_id` int(11) default NULL,
+ `param_name` varchar(255) default NULL,
+ `param_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=6;
+
+--
+-- Table structure for table `directory_vars`
+--
+
+DROP TABLE IF EXISTS `directory_vars`;
+CREATE TABLE `directory_vars` (
+ `id` int(11) NOT NULL auto_increment,
+ `directory_id` int(11) default NULL,
+ `var_name` varchar(255) default NULL,
+ `var_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=6;
+
+--
+-- Table structure for table `group_data`
+--
+
+DROP TABLE IF EXISTS `group_data`;
+CREATE TABLE `group_data` (
+ `hostname` varchar(255) default NULL,
+ `groupname` varchar(255) default NULL,
+ `url` varchar(255) default NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `iax_conf`
+--
+
+DROP TABLE IF EXISTS `iax_conf`;
+CREATE TABLE `iax_conf` (
+ `id` int(11) NOT NULL auto_increment,
+ `profile_name` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=4;
+
+--
+-- Table structure for table `iax_settings`
+--
+
+DROP TABLE IF EXISTS `iax_settings`;
+CREATE TABLE `iax_settings` (
+ `id` int(11) NOT NULL auto_increment,
+ `iax_id` int(11) default NULL,
+ `param_name` varchar(255) default NULL,
+ `param_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=43;
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+DROP TABLE IF EXISTS `ivr_conf`;
+CREATE TABLE `ivr_conf` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `name` varchar(64) NOT NULL,
+ `greet_long` varchar(255) NOT NULL,
+ `greet_short` varchar(255) NOT NULL,
+ `invalid_sound` varchar(255) NOT NULL,
+ `exit_sound` varchar(255) NOT NULL,
+ `max_failures` int(10) unsigned NOT NULL default '3',
+ `timeout` int(11) NOT NULL default '5',
+ `tts_engine` varchar(64) default NULL,
+ `tts_voice` varchar(64) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_name` (`name`)
+) TYPE=InnoDB AUTO_INCREMENT=4;
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+DROP TABLE IF EXISTS `ivr_entries`;
+CREATE TABLE `ivr_entries` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `ivr_id` int(10) unsigned NOT NULL,
+ `action` varchar(64) NOT NULL,
+ `digits` varchar(16) NOT NULL,
+ `params` varchar(255) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_ivr_digits` (`ivr_id`,`digits`)
+) TYPE=InnoDB AUTO_INCREMENT=11;
+
+--
+-- Table structure for table `jabber_subscriptions`
+--
+
+DROP TABLE IF EXISTS `jabber_subscriptions`;
+CREATE TABLE `jabber_subscriptions` (
+ `sub_from` varchar(255) default NULL,
+ `sub_to` varchar(255) default NULL,
+ `show_pres` varchar(255) default NULL,
+ `status` varchar(255) default NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `limit_conf`
+--
+
+DROP TABLE IF EXISTS `limit_conf`;
+CREATE TABLE `limit_conf` (
+ `id` int(11) NOT NULL auto_increment,
+ `name` varchar(255) default NULL,
+ `value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=2;
+
+--
+-- Table structure for table `limit_data`
+--
+
+DROP TABLE IF EXISTS `limit_data`;
+CREATE TABLE `limit_data` (
+ `hostname` varchar(255) default NULL,
+ `realm` varchar(255) default NULL,
+ `id` varchar(255) default NULL,
+ `uuid` varchar(255) default NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+DROP TABLE IF EXISTS `local_stream_conf`;
+CREATE TABLE `local_stream_conf` (
+ `id` int(11) NOT NULL auto_increment,
+ `directory_name` varchar(255) default NULL,
+ `directory_path` text,
+ `param_name` varchar(255) default NULL,
+ `param_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+DROP TABLE IF EXISTS `post_load_modules_conf`;
+CREATE TABLE `post_load_modules_conf` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `module_name` varchar(64) NOT NULL,
+ `load_module` tinyint(1) NOT NULL default '1',
+ `priority` int(10) unsigned NOT NULL default '1000',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_mod` (`module_name`)
+) TYPE=InnoDB AUTO_INCREMENT=52;
+
+--
+-- Table structure for table `rss_conf`
+--
+
+DROP TABLE IF EXISTS `rss_conf`;
+CREATE TABLE `rss_conf` (
+ `id` int(11) NOT NULL auto_increment,
+ `directory_id` int(11) NOT NULL,
+ `feed` text NOT NULL,
+ `local_file` text NOT NULL,
+ `description` text,
+ `priority` int(11) NOT NULL default '1000',
+ PRIMARY KEY (`id`)
+) TYPE=MyISAM AUTO_INCREMENT=15;
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+DROP TABLE IF EXISTS `sip_authentication`;
+CREATE TABLE `sip_authentication` (
+ `nonce` varchar(255) default NULL,
+ `expires` int(8) default NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+DROP TABLE IF EXISTS `sip_registrations`;
+CREATE TABLE `sip_registrations` (
+ `call_id` varchar(255) default NULL,
+ `sip_user` varchar(255) default NULL,
+ `sip_host` varchar(255) default NULL,
+ `contact` varchar(1024) default NULL,
+ `status` varchar(255) default NULL,
+ `rpid` varchar(255) default NULL,
+ `expires` int(11) default NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+DROP TABLE IF EXISTS `sip_subscriptions`;
+CREATE TABLE `sip_subscriptions` (
+ `proto` varchar(255) default NULL,
+ `sip_user` varchar(255) default NULL,
+ `sip_host` varchar(255) default NULL,
+ `sub_to_user` varchar(255) default NULL,
+ `sub_to_host` varchar(255) default NULL,
+ `event` varchar(255) default NULL,
+ `contact` varchar(1024) default NULL,
+ `call_id` varchar(255) default NULL,
+ `full_from` varchar(255) default NULL,
+ `full_via` varchar(255) default NULL,
+ `expires` int(11) default NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+DROP TABLE IF EXISTS `sofia_aliases`;
+CREATE TABLE `sofia_aliases` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `sofia_id` int(10) unsigned NOT NULL,
+ `alias_name` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=5;
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+DROP TABLE IF EXISTS `sofia_conf`;
+CREATE TABLE `sofia_conf` (
+ `id` int(11) NOT NULL auto_increment,
+ `profile_name` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=3;
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+DROP TABLE IF EXISTS `sofia_domains`;
+CREATE TABLE `sofia_domains` (
+ `id` int(11) NOT NULL auto_increment,
+ `sofia_id` int(11) default NULL,
+ `domain_name` varchar(255) default NULL,
+ `parse` tinyint(1) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB;
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+DROP TABLE IF EXISTS `sofia_gateways`;
+CREATE TABLE `sofia_gateways` (
+ `id` int(11) NOT NULL auto_increment,
+ `sofia_id` int(11) default NULL,
+ `gateway_name` varchar(255) default NULL,
+ `gateway_param` varchar(255) default NULL,
+ `gateway_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=15;
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+DROP TABLE IF EXISTS `sofia_settings`;
+CREATE TABLE `sofia_settings` (
+ `id` int(11) NOT NULL auto_increment,
+ `sofia_id` int(11) default NULL,
+ `param_name` varchar(255) default NULL,
+ `param_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=35;
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+DROP TABLE IF EXISTS `voicemail_conf`;
+CREATE TABLE `voicemail_conf` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `vm_profile` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_profile` (`vm_profile`)
+) TYPE=InnoDB AUTO_INCREMENT=3;
+
+--
+-- Table structure for table `voicemail_data`
+--
+
+DROP TABLE IF EXISTS `voicemail_data`;
+CREATE TABLE `voicemail_data` (
+ `created_epoch` int(8) default NULL,
+ `read_epoch` int(8) default NULL,
+ `user` varchar(255) default NULL,
+ `domain` varchar(255) default NULL,
+ `uuid` varchar(255) default NULL,
+ `cid_name` varchar(255) default NULL,
+ `cid_number` varchar(255) default NULL,
+ `in_folder` varchar(255) default NULL,
+ `file_path` varchar(255) default NULL,
+ `flags` varchar(255) default NULL,
+ `read_flags` varchar(255) default NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+DROP TABLE IF EXISTS `voicemail_email`;
+CREATE TABLE `voicemail_email` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `voicemail_id` int(10) unsigned NOT NULL,
+ `param_name` varchar(64) NOT NULL,
+ `param_value` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_profile_param` (`param_name`,`voicemail_id`)
+) TYPE=InnoDB AUTO_INCREMENT=4;
+
+--
+-- Table structure for table `voicemail_prefs`
+--
+
+DROP TABLE IF EXISTS `voicemail_prefs`;
+CREATE TABLE `voicemail_prefs` (
+ `user` varchar(255) default NULL,
+ `domain` varchar(255) default NULL,
+ `name_path` varchar(255) default NULL,
+ `greeting_path` varchar(255) default NULL
+) TYPE=MyISAM;
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+DROP TABLE IF EXISTS `voicemail_settings`;
+CREATE TABLE `voicemail_settings` (
+ `id` int(11) NOT NULL auto_increment,
+ `voicemail_id` int(11) default NULL,
+ `param_name` varchar(255) default NULL,
+ `param_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB AUTO_INCREMENT=31;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2008-01-09 23:26:19
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0.sql
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0.sql Wed Jan 9 18:30:25 2008
@@ -0,0 +1,532 @@
+-- MySQL dump 10.11
+--
+-- Host: localhost Database: freeswitch
+-- ------------------------------------------------------
+-- Server version 5.0.45-community-nt
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `conference_advertise`
+--
+
+DROP TABLE IF EXISTS `conference_advertise`;
+CREATE TABLE `conference_advertise` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `room` varchar(64) NOT NULL,
+ `status` varchar(128) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_room` (`room`)
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `conference_controls`
+--
+
+DROP TABLE IF EXISTS `conference_controls`;
+CREATE TABLE `conference_controls` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `conf_group` varchar(64) NOT NULL,
+ `action` varchar(64) NOT NULL,
+ `digits` varchar(16) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_group_action` USING BTREE (`conf_group`,`action`)
+) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `conference_profiles`
+--
+
+DROP TABLE IF EXISTS `conference_profiles`;
+CREATE TABLE `conference_profiles` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `profile_name` varchar(64) NOT NULL,
+ `param_name` varchar(64) NOT NULL,
+ `param_value` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `unique_profile_param` (`profile_name`,`param_name`)
+) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `db_data`
+--
+
+DROP TABLE IF EXISTS `db_data`;
+CREATE TABLE `db_data` (
+ `hostname` varchar(255) default NULL,
+ `realm` varchar(255) default NULL,
+ `data_key` varchar(255) default NULL,
+ `data` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `dialplan`
+--
+
+DROP TABLE IF EXISTS `dialplan`;
+CREATE TABLE `dialplan` (
+ `id` int(11) NOT NULL auto_increment,
+ `context` varchar(64) NOT NULL,
+ `extension` varchar(64) NOT NULL,
+ `condition_field` varchar(64) NOT NULL,
+ `condition_expression` varchar(64) NOT NULL,
+ `application_name` varchar(64) NOT NULL,
+ `application_data` text,
+ `weight` int(11) NOT NULL,
+ `type` varchar(16) NOT NULL default 'action',
+ `ext_continue` smallint(1) NOT NULL default '0',
+ `global_weight` int(11) NOT NULL default '10000',
+ `condition_continue` varchar(8) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=112 DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `dingaling_profile_params`
+--
+
+DROP TABLE IF EXISTS `dingaling_profile_params`;
+CREATE TABLE `dingaling_profile_params` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `dingaling_id` int(10) unsigned NOT NULL,
+ `param_name` varchar(64) NOT NULL,
+ `param_value` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_type_name` (`dingaling_id`,`param_name`),
+ CONSTRAINT `dingaling_profile` FOREIGN KEY (`dingaling_id`) REFERENCES `dingaling_profiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `dingaling_profiles`
+--
+
+DROP TABLE IF EXISTS `dingaling_profiles`;
+CREATE TABLE `dingaling_profiles` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `profile_name` varchar(64) NOT NULL,
+ `type` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_name` (`profile_name`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `dingaling_settings`
+--
+
+DROP TABLE IF EXISTS `dingaling_settings`;
+CREATE TABLE `dingaling_settings` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `param_name` varchar(64) NOT NULL,
+ `param_value` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_param` (`param_name`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `directory`
+--
+
+DROP TABLE IF EXISTS `directory`;
+CREATE TABLE `directory` (
+ `id` int(11) NOT NULL auto_increment,
+ `username` varchar(255) NOT NULL,
+ `domain` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `directory_gateway_params`
+--
+
+DROP TABLE IF EXISTS `directory_gateway_params`;
+CREATE TABLE `directory_gateway_params` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `d_gw_id` int(10) unsigned NOT NULL,
+ `param_name` varchar(64) NOT NULL,
+ `param_value` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_gw_param` (`d_gw_id`,`param_name`)
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `directory_gateways`
+--
+
+DROP TABLE IF EXISTS `directory_gateways`;
+CREATE TABLE `directory_gateways` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `directory_id` int(10) unsigned NOT NULL,
+ `gateway_name` varchar(128) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `directory_params`
+--
+
+DROP TABLE IF EXISTS `directory_params`;
+CREATE TABLE `directory_params` (
+ `id` int(11) NOT NULL auto_increment,
+ `directory_id` int(11) default NULL,
+ `param_name` varchar(255) default NULL,
+ `param_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `directory_vars`
+--
+
+DROP TABLE IF EXISTS `directory_vars`;
+CREATE TABLE `directory_vars` (
+ `id` int(11) NOT NULL auto_increment,
+ `directory_id` int(11) default NULL,
+ `var_name` varchar(255) default NULL,
+ `var_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `group_data`
+--
+
+DROP TABLE IF EXISTS `group_data`;
+CREATE TABLE `group_data` (
+ `hostname` varchar(255) default NULL,
+ `groupname` varchar(255) default NULL,
+ `url` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `iax_conf`
+--
+
+DROP TABLE IF EXISTS `iax_conf`;
+CREATE TABLE `iax_conf` (
+ `id` int(11) NOT NULL auto_increment,
+ `profile_name` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `iax_settings`
+--
+
+DROP TABLE IF EXISTS `iax_settings`;
+CREATE TABLE `iax_settings` (
+ `id` int(11) NOT NULL auto_increment,
+ `iax_id` int(11) default NULL,
+ `param_name` varchar(255) default NULL,
+ `param_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `ivr_conf`
+--
+
+DROP TABLE IF EXISTS `ivr_conf`;
+CREATE TABLE `ivr_conf` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `name` varchar(64) NOT NULL,
+ `greet_long` varchar(255) NOT NULL,
+ `greet_short` varchar(255) NOT NULL,
+ `invalid_sound` varchar(255) NOT NULL,
+ `exit_sound` varchar(255) NOT NULL,
+ `max_failures` int(10) unsigned NOT NULL default '3',
+ `timeout` int(11) NOT NULL default '5',
+ `tts_engine` varchar(64) default NULL,
+ `tts_voice` varchar(64) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_name` (`name`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `ivr_entries`
+--
+
+DROP TABLE IF EXISTS `ivr_entries`;
+CREATE TABLE `ivr_entries` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `ivr_id` int(10) unsigned NOT NULL,
+ `action` varchar(64) NOT NULL,
+ `digits` varchar(16) NOT NULL,
+ `params` varchar(255) default NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_ivr_digits` USING BTREE (`ivr_id`,`digits`)
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jabber_subscriptions`
+--
+
+DROP TABLE IF EXISTS `jabber_subscriptions`;
+CREATE TABLE `jabber_subscriptions` (
+ `sub_from` varchar(255) default NULL,
+ `sub_to` varchar(255) default NULL,
+ `show_pres` varchar(255) default NULL,
+ `status` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `limit_conf`
+--
+
+DROP TABLE IF EXISTS `limit_conf`;
+CREATE TABLE `limit_conf` (
+ `id` int(11) NOT NULL auto_increment,
+ `name` varchar(255) default NULL,
+ `value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `limit_data`
+--
+
+DROP TABLE IF EXISTS `limit_data`;
+CREATE TABLE `limit_data` (
+ `hostname` varchar(255) default NULL,
+ `realm` varchar(255) default NULL,
+ `id` varchar(255) default NULL,
+ `uuid` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `local_stream_conf`
+--
+
+DROP TABLE IF EXISTS `local_stream_conf`;
+CREATE TABLE `local_stream_conf` (
+ `id` int(11) NOT NULL auto_increment,
+ `directory_name` varchar(255) default NULL,
+ `directory_path` text,
+ `param_name` varchar(255) default NULL,
+ `param_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `post_load_modules_conf`
+--
+
+DROP TABLE IF EXISTS `post_load_modules_conf`;
+CREATE TABLE `post_load_modules_conf` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `module_name` varchar(64) NOT NULL,
+ `load_module` tinyint(1) NOT NULL default '1',
+ `priority` int(10) unsigned NOT NULL default '1000',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_mod` (`module_name`)
+) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `rss_conf`
+--
+
+DROP TABLE IF EXISTS `rss_conf`;
+CREATE TABLE `rss_conf` (
+ `id` int(11) NOT NULL auto_increment,
+ `directory_id` int(11) NOT NULL,
+ `feed` text NOT NULL,
+ `local_file` text NOT NULL,
+ `description` text,
+ `priority` int(11) NOT NULL default '1000',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `sip_authentication`
+--
+
+DROP TABLE IF EXISTS `sip_authentication`;
+CREATE TABLE `sip_authentication` (
+ `nonce` varchar(255) default NULL,
+ `expires` int(8) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `sip_registrations`
+--
+
+DROP TABLE IF EXISTS `sip_registrations`;
+CREATE TABLE `sip_registrations` (
+ `call_id` varchar(255) default NULL,
+ `sip_user` varchar(255) default NULL,
+ `sip_host` varchar(255) default NULL,
+ `contact` varchar(1024) default NULL,
+ `status` varchar(255) default NULL,
+ `rpid` varchar(255) default NULL,
+ `expires` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `sip_subscriptions`
+--
+
+DROP TABLE IF EXISTS `sip_subscriptions`;
+CREATE TABLE `sip_subscriptions` (
+ `proto` varchar(255) default NULL,
+ `sip_user` varchar(255) default NULL,
+ `sip_host` varchar(255) default NULL,
+ `sub_to_user` varchar(255) default NULL,
+ `sub_to_host` varchar(255) default NULL,
+ `event` varchar(255) default NULL,
+ `contact` varchar(1024) default NULL,
+ `call_id` varchar(255) default NULL,
+ `full_from` varchar(255) default NULL,
+ `full_via` varchar(255) default NULL,
+ `expires` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `sofia_aliases`
+--
+
+DROP TABLE IF EXISTS `sofia_aliases`;
+CREATE TABLE `sofia_aliases` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `sofia_id` int(10) unsigned NOT NULL,
+ `alias_name` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `sofia_conf`
+--
+
+DROP TABLE IF EXISTS `sofia_conf`;
+CREATE TABLE `sofia_conf` (
+ `id` int(11) NOT NULL auto_increment,
+ `profile_name` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `sofia_domains`
+--
+
+DROP TABLE IF EXISTS `sofia_domains`;
+CREATE TABLE `sofia_domains` (
+ `id` int(11) NOT NULL auto_increment,
+ `sofia_id` int(11) default NULL,
+ `domain_name` varchar(255) default NULL,
+ `parse` tinyint(1) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `sofia_gateways`
+--
+
+DROP TABLE IF EXISTS `sofia_gateways`;
+CREATE TABLE `sofia_gateways` (
+ `id` int(11) NOT NULL auto_increment,
+ `sofia_id` int(11) default NULL,
+ `gateway_name` varchar(255) default NULL,
+ `gateway_param` varchar(255) default NULL,
+ `gateway_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `sofia_settings`
+--
+
+DROP TABLE IF EXISTS `sofia_settings`;
+CREATE TABLE `sofia_settings` (
+ `id` int(11) NOT NULL auto_increment,
+ `sofia_id` int(11) default NULL,
+ `param_name` varchar(255) default NULL,
+ `param_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `voicemail_conf`
+--
+
+DROP TABLE IF EXISTS `voicemail_conf`;
+CREATE TABLE `voicemail_conf` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `vm_profile` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_profile` (`vm_profile`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `voicemail_data`
+--
+
+DROP TABLE IF EXISTS `voicemail_data`;
+CREATE TABLE `voicemail_data` (
+ `created_epoch` int(8) default NULL,
+ `read_epoch` int(8) default NULL,
+ `user` varchar(255) default NULL,
+ `domain` varchar(255) default NULL,
+ `uuid` varchar(255) default NULL,
+ `cid_name` varchar(255) default NULL,
+ `cid_number` varchar(255) default NULL,
+ `in_folder` varchar(255) default NULL,
+ `file_path` varchar(255) default NULL,
+ `flags` varchar(255) default NULL,
+ `read_flags` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `voicemail_email`
+--
+
+DROP TABLE IF EXISTS `voicemail_email`;
+CREATE TABLE `voicemail_email` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `voicemail_id` int(10) unsigned NOT NULL,
+ `param_name` varchar(64) NOT NULL,
+ `param_value` varchar(64) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `unique_profile_param` (`param_name`,`voicemail_id`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `voicemail_prefs`
+--
+
+DROP TABLE IF EXISTS `voicemail_prefs`;
+CREATE TABLE `voicemail_prefs` (
+ `user` varchar(255) default NULL,
+ `domain` varchar(255) default NULL,
+ `name_path` varchar(255) default NULL,
+ `greeting_path` varchar(255) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+--
+-- Table structure for table `voicemail_settings`
+--
+
+DROP TABLE IF EXISTS `voicemail_settings`;
+CREATE TABLE `voicemail_settings` (
+ `id` int(11) NOT NULL auto_increment,
+ `voicemail_id` int(11) default NULL,
+ `param_name` varchar(255) default NULL,
+ `param_value` varchar(255) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2008-01-09 23:18:24
1
0
[commit] r7158 - in freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl: . configuration
by Freeswitch SVN 09 Jan '08
by Freeswitch SVN 09 Jan '08
09 Jan '08
Author: intralanman
Date: Wed Jan 9 18:15:19 2008
New Revision: 7158
Added:
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/conference.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/dingaling.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/iax.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/ivr.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/limit.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/local_stream.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/rss.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/sofia.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/spidermonkey.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/dialplan_importer.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_configuration.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_curl.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_dialplan.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_directory.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/global_defines.php
freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/index.php
Log:
Initial check-in of fs_curl stuff.... this will pull configurations for the modules, directory, dialplan, and eventually take xml_cdr POSTs
the dialplan_importer will take a current xml file and import it to the db so that it's correctly returned as xml in the webpage exactly the same way it went in [ideally]
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/conference.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/conference.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,185 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * conference.conf.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+ header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Write XML for conference.conf
+*/
+class conference_conf extends fs_configuration {
+ /**
+ * Initializer method
+ * This method calls fs_configuration to initialize all of the
+ * objects and variables that we want to inherit
+ * @return void
+ */
+ public function conference_conf() {
+ $this -> fs_configuration();
+ }
+
+ /**
+ * Main sub-routine
+ * This method will call all of the other methods necessary
+ * to write out the XML for the conference.conf
+ * @return void
+ */
+ public function main() {
+ $this -> write_advertises();
+ $this -> write_controls();
+ $this -> write_profiles();
+ }
+
+ /**
+ * Write XML for <advertises>
+ * This method will write the elements and attributes for the
+ * conferences that are to be advertised
+ * @return void
+ */
+ private function write_advertises() {
+ $query = "SELECT * FROM conference_advertise ORDER BY room";
+ $advertises = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ if (MDB2::isError($advertises)) {
+ $this -> comment($query);
+ $this -> comment($advertises -> getMessage());
+ return ;
+ }
+ $advertise_count = count($advertises);
+ if ($advertise_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('advertise');
+ for ($i=0; $i<$advertise_count; $i++) {
+ //$this -> comment_array($advertises[$i]);
+ $this -> xmlw -> startElement('room');
+ $this -> xmlw -> writeAttribute('name', $advertises[$i]['room']);
+ $this -> xmlw -> writeAttribute('status', $advertises[$i]['status']);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ }
+
+
+ /**
+ * Pull conference profiles from the database
+ * This method will pull the conference profiles
+ * from the database using the PEAR MDB2 extension
+ * @return array
+ */
+ private function get_profiles_array() {
+ $query = sprintf('%s %s;'
+ , "SELECT * FROM conference_profiles"
+ , "ORDER BY profile_name"
+ );
+ $res = $this -> db -> query($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($query);
+ $this -> comment($res -> getMessage());
+ return array();
+ }
+ while ($row = $res -> fetchRow()) {
+ $pn = $row['profile_name'];
+ $profiles[$pn][] = $row;
+ }
+ return $profiles;
+ }
+
+ /**
+ * Write XML for <profiles>
+ * This method will write the XML of the array
+ * from get_profiles_array
+ * @return void
+ */
+ private function write_profiles() {
+ $profiles_array = $this -> get_profiles_array();
+ $profiles_count = count($profiles_array);
+ if ($profiles_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('profiles');
+
+ foreach ($profiles_array as $profile_name => $profile_data) {
+ $this -> xmlw -> startElement('profile');
+ $this -> xmlw -> writeAttribute('name', $profile_name);
+ foreach ($profile_data as $params) {
+ //$this -> comment_array($profiles_array[$i]);
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $params['param_name']);
+ $this -> xmlw -> writeAttribute('value', $params['param_value']);
+ $this -> xmlw -> endElement();//</param>
+
+ }
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ }
+
+ /**
+ * Pull caller-controls from database via MDB2
+ * This method will pull the conference caller-controls from
+ * the database using the PEAR MDB2 extension
+ * @return array
+ */
+ private function get_controls_array() {
+ $query = sprintf(
+ "SELECT * FROM conference_controls ORDER BY conf_group"
+ );
+ $res = $this -> db -> query($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($query);
+ $this -> comment($res -> getMessage());
+ return array();
+ }
+ while ($row = $res -> fetchRow()) {
+ $cg = $row['conf_group'];
+ $profiles[$cg][] = $row;
+ }
+ return $profiles;
+ }
+
+ /**
+ * Write XML for <caller-controls>
+ * This method will write the XML of the array
+ * from get_controls_array
+ * @return void
+ */
+ private function write_controls() {
+ $controls_array = $this -> get_controls_array();
+ $controls_count = count($controls_array);
+ if (MDB2::isError($controls_array)) {
+ $this -> comment($query);
+ $this -> comment($controls_array -> getMessage());
+ return ;
+ }
+ if ($controls_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('caller-controls');
+
+ foreach ($controls_array as $group_name => $control_data) {
+ $this -> xmlw -> startElement('group');
+ $this -> xmlw -> writeAttribute('name', $group_name);
+ foreach ($control_data as $controls) {
+
+ //$this -> comment_array($controls_array[$i]);
+ $this -> xmlw -> startElement('control');
+ $this -> xmlw -> writeAttribute('action', $controls['action']);
+ $this -> xmlw -> writeAttribute('digits', $controls['digits']);
+ $this -> xmlw -> endElement();
+
+ }
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ }
+}
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/console.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,50 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * console.conf.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+ header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * @todo make this configurable via db rather than hardcoded.
+ * File containing the base class for all curl XML output
+*/
+class console_conf extends fs_configuration {
+ function console_conf() {
+ $this -> fs_configuration();
+ }
+
+ /**
+ * Currently this method does pretty much everything
+ */
+ function main() {
+ $this -> xmlw -> startElement('configuration');
+ $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+ $this -> xmlw -> writeAttribute('description', 'Console configuration');
+
+ $this -> xmlw -> startElement('settings');
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', 'colorize');
+ $this -> xmlw -> writeAttribute('value', 'true');
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+
+ $this -> xmlw -> startElement('mappings');
+ $this -> xmlw -> startElement('map');
+ $this -> xmlw -> writeAttribute('name', 'all');
+ $this -> xmlw -> writeAttribute('value', 'notice,warning,error,crit,alert');
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+
+ $this -> xmlw -> endElement();
+ }
+}
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/dingaling.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/dingaling.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,142 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * dingaling.conf.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+ header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Write XML for dingaling.conf
+*/
+class dingaling_conf extends fs_configuration {
+ /**
+ * Initializer method
+ * This method calls fs_configuration to initialize all of the
+ * objects and variables that we want to inherit
+ * @return void
+ */
+ public function dingaling_conf() {
+ $this -> fs_configuration();
+ }
+
+ /**
+ * Main sub-routine
+ * This method will call all of the other methods necessary
+ * to write out the XML for the dingaling.conf
+ * @return void
+ */
+ public function main() {
+ $this -> write_settings();
+ $this -> write_profiles();
+ }
+
+ /**
+ * Pull dingaling profiles from the database
+ * @return array
+ */
+ private function get_params_array() {
+ $query = sprintf('%s %s;'
+ , "SELECT * FROM dingaling_profile_params"
+ , "ORDER BY dingaling_id"
+ );
+ $res = $this -> db -> query($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($query);
+ $this -> comment($res -> getMessage());
+ return array();
+ }
+ while ($row = $res -> fetchRow()) {
+ $id = $row['dingaling_id'];
+ $profiles[$id][] = $row;
+ }
+ return $profiles;
+ }
+
+ /**
+ * get dingaling profile names, types, and ids
+ * @return array
+ */
+ private function get_profile_array() {
+ $query = sprintf('SELECT * FROM dingaling_profiles');
+ $res = $this -> db -> query($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($query);
+ $this -> comment($res -> getMessage());
+ $this -> file_not_found();
+ }
+ while ($row = $res -> fetchRow()) {
+ $id = $row['id'];
+ $profiles[$id] = $row['type'];
+ }
+ return $profiles;
+ }
+
+
+ /**
+ * Write XML for <profile>s
+ * This method will write the XML of the array
+ * from get_profiles_array
+ * @return void
+ */
+ private function write_profiles() {
+ $profile_array = $this -> get_profile_array();
+ $params_array = $this -> get_params_array();
+ $params_count = count($params_array);
+ if ($params_count < 1) {
+ return ;
+ }
+ while (list($id, $type) = each($profile_array)) {
+ $this -> xmlw -> startElement('profile');
+ $this -> xmlw -> writeAttribute('type', $type);
+ if (!empty($params_array[$id])) {
+ $this_param_count = count($params_array[$id]);
+ for ($i=0; $i<$this_param_count; $i++) {
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute(
+ 'name', $params_array[$id][$i]['param_name']
+ );
+ $this -> xmlw -> writeAttribute(
+ 'value', $params_array[$id][$i]['param_value']
+ );
+ $this -> xmlw -> endElement();//</param>
+ }
+ $this -> xmlw -> endElement();
+ }
+ }
+ }
+
+
+ /**
+ * Write out the XML for the dingaling <settings>
+ *@return void
+ */
+ private function write_settings() {
+ $query = sprintf('SELECT * FROM dingaling_settings');
+ $res = $this -> db -> queryAll($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($query);
+ $this -> comment($res -> getMessage());
+ $this -> file_not_found();
+ }
+ $setting_count = count($res);
+ if ($setting_count > 0) {
+ $this -> xmlw -> startElement('settings');
+ for ($i=0; $i<$setting_count; $i++) {
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $res[$i]['param_name']);
+ $this -> xmlw -> writeAttribute('value', $res[$i]['param_value']);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ }
+ }
+}
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/iax.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/iax.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,172 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * iax.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * @todo add gateways, aliases, etc when support is added into FS
+ * Class to write XML for iax.conf
+*/
+class iax_conf extends fs_configuration {
+ public function iax_conf() {
+ $this -> fs_configuration();
+ }
+
+ public function main() {
+ $profiles = $this -> get_profiles();
+ $this -> write_config($profiles);
+ }
+
+ private function get_profiles() {
+ $query = "SELECT * FROM iax_conf ORDER BY id LIMIT 1";
+ $profiles = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ return $profiles;
+ }
+
+ private function write_aliases($profile_id) {
+ $query = "SELECT * FROM iax_aliases WHERE iax_id=$profile_id ";
+ $aliases_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $aliases_count = count($aliases_array);
+ if (MDB2::isError($aliases_array)) {
+ $this -> comment($query);
+ $this -> comment($aliases_array -> getMessage());
+ return ;
+ }
+ if ($aliases_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('aliases');
+
+ for ($i=0; $i<$aliases_count; $i++) {
+ //$this -> comment_array($aliases_array[$i]);
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $aliases_array[$i]['alias_name']);
+ $this -> xmlw -> endElement();//</param>
+ }
+ $this -> xmlw -> endElement();
+ }
+
+ private function write_settings($profile_id) {
+ $query = "SELECT * FROM iax_settings WHERE iax_id=$profile_id "
+ . "ORDER BY iax_id, param_name";
+ $settings_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $settings_count = count($settings_array);
+ if (MDB2::isError($settings_array)) {
+ $this -> comment($query);
+ $this -> comment($settings_array -> getMessage());
+ return ;
+ }
+ if ($settings_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('settings');
+
+ for ($i=0; $i<$settings_count; $i++) {
+ //$this -> comment_array($settings_array[$i]);
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
+ $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
+ $this -> xmlw -> endElement();//</param>
+ }
+ $this -> xmlw -> endElement();
+ }
+
+ private function write_gateways($profile_id) {
+ $query = "SELECT * FROM iax_gateways WHERE iax_id=$profile_id "
+ . "ORDER BY gateway_name, gateway_param";
+ $gateway_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $gateway_count = count($gateway_array);
+ //$this -> comment_array($gateway_array);
+ if (MDB2::isError($gateway_array)) {
+ $this -> comment($query);
+ $this -> comment($gateway_array -> getMessage());
+ return ;
+ }
+ if ($gateway_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('gateways');
+ for ($i=0; $i<$gateway_count; $i++) {
+ $this_gateway = $gateway_array[$i]['gateway_name'];
+ if ($this_gateway != $gateway_array[$i-1]['gateway_name']) {
+ $this -> xmlw -> startElement('gateway');
+ $this -> xmlw -> writeAttribute('name', $this_gateway);
+ }
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $gateway_array[$i]['gateway_param']);
+ $this -> xmlw -> writeAttribute('value', $gateway_array[$i]['gateway_value']);
+ $this -> xmlw -> endElement();
+ if (!array_key_exists($i+1, $gateway_array)
+ || $this_gateway != $gateway_array[$i+1]['gateway_name']) {
+ $this -> xmlw -> endElement();
+ }
+ $last_gateway = $this_gateway;
+ }
+ $this -> xmlw -> endElement(); //</gateways>
+ }
+
+ private function write_domains($profile_id) {
+ $query = "SELECT * FROM iax_domains WHERE iax_id=$profile_id";
+ $domain_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $domain_count = count($domain_array);
+ if (MDB2::isError($domain_array)) {
+ $this -> comment($query);
+ $this -> comment($domain_array -> getMessage());
+ return ;
+ }
+ if ($domain_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('domains');
+ for ($i=0; $i<$domain_count; $i++) {
+ $this -> xmlw -> startElement('domain');
+ $this -> xmlw -> writeAttribute('name', $domain_array[$i]['domain_name']);
+ $this -> xmlw -> writeAttribute(
+ 'parse', ($domain_array[$i]['parse'] == 1 ? 'true' : 'false')
+ );
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ }
+
+ private function write_single_profile($profile) {
+ /* //reserved for multi-profile
+ $this -> xmlw -> startElement('profile');
+ $this -> xmlw -> writeAttribute('name', $profile['profile_name']);
+ */
+ //$this -> write_aliases($profile['id']);
+ //$this -> write_domains($profile['id']);
+ //$this -> write_gateways($profile['id']);
+ $this -> write_settings($profile['id']);
+ //$this -> xmlw -> endElement(); //reserved for multi-profile
+ }
+
+ /**
+ * Write XML for iax.conf profiles
+ *
+ * @param unknown_type $profiles
+ */
+ private function write_config($profiles) {
+ $profile_count = count($profiles);
+ $this -> xmlw -> startElement('configuration');
+ $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+ $this -> xmlw -> writeAttribute('description', 'IAX Endpoint');
+ /*
+ $this -> xmlw -> startElement('profiles');
+ //we'll add this back if ever multiple iax profiles are supported
+ */
+ for ($i=0; $i<$profile_count; $i++) {
+ $this -> write_single_profile($profiles[$i]);
+ }
+ //$this -> xmlw -> endElement(); //this too
+ $this -> xmlw -> endElement();
+ }
+}
+
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/ivr.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/ivr.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,117 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * ivr.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Write XML for ivr.conf
+*/
+class ivr_conf extends fs_configuration {
+ public function ivr_conf() {
+ $this -> fs_configuration();
+ }
+
+ /**
+ * This method will run all of the methods necessary to return
+ * the XML for the ivr.conf
+ * @return void
+ */
+ public function main() {
+ $ivrs = $this -> get_ivr_array();
+ $this -> write_config($ivrs);
+ }
+
+ /**
+ * This method will fetch all of the ivr menus from the database
+ * using the MDB2 pear class
+ * @return array
+ */
+ private function get_ivr_array() {
+ $query = "SELECT * FROM ivr_conf";
+ $menus = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ return $menus;
+ }
+
+ /**
+ * This method will write all of the entry elements with
+ * their corresponding attributes
+ * @return void
+ */
+ private function write_entries($ivr_id) {
+ $query = sprintf(
+ "SELECT * FROM ivr_entries WHERE ivr_id=$ivr_id ORDER BY digits"
+ );
+ $entries_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ if (MDB2::isError($entries_array)) {
+ $this -> comment($query);
+ $this -> comment($entries_array -> getMessage());
+ return ;
+ }
+ $entries_count = count($entries_array);
+ if ($entries_count < 1) {
+ return ;
+ }
+ $entries_count = count($entries_array);
+ for ($i=0; $i<$entries_count; $i++) {
+ //$this -> comment_array($entries_array[$i]);
+ $this -> xmlw -> startElement('entry');
+ $this -> xmlw -> writeAttribute('action', $entries_array[$i]['action']);
+ $this -> xmlw -> writeAttribute('digits', $entries_array[$i]['digits']);
+ if (!empty($entries_array[$i]['params'])) {
+ $this -> xmlw -> writeAttribute('params', $entries_array[$i]['params']);
+ }
+ $this -> xmlw -> endElement();//</param>
+ }
+ }
+
+ /**
+ * This method will evaluate the data from the db and
+ * write attributes that need written
+ * @return void
+ */
+ private function write_menu_attributes($menu_data) {
+ $this -> xmlw -> writeAttribute('name', $menu_data['name']);
+ $this -> xmlw -> writeAttribute('greet-long', $menu_data['greet_long']);
+ $this -> xmlw -> writeAttribute('greet-short', $menu_data['greet_short']);
+ $this -> xmlw -> writeAttribute('invalid-sound', $menu_data['invalid_sound']);
+ $this -> xmlw -> writeAttribute('exit-sound', $menu_data['exit_sound']);
+ $this -> xmlw -> writeAttribute('timeout', $menu_data['timeout']);
+ $this -> xmlw -> writeAttribute('max-failures', $menu_data['max_failures']);
+ if (!empty($menu_data['tts_engine'])) {
+ $this -> xmlw -> writeAttribute('tts-engine', $menu_data['tts_engine']);
+ }
+ if (!empty($menu_data['tts_voice'])) {
+ $this -> xmlw -> writeAttribute('tts-voice', $menu_data['tts_voice']);
+ }
+ //$this -> xmlw -> writeAttribute('', $menu_data['']);
+ }
+
+ /**
+ * This method will do the writing of the "menu" elements
+ * and call the write_entries method to do the writing of
+ * individual menu's "entry" elements
+ * @return void
+ */
+ private function write_config($menus) {
+ $menu_count = count($menus);
+ $this -> xmlw -> startElement('configuration');
+ $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+ $this -> xmlw -> writeAttribute('description', 'Sofia SIP Endpoint');
+ $this -> xmlw -> startElement('menus');
+ for ($i=0; $i<$menu_count; $i++) {
+ $this -> xmlw -> startElement('menu');
+ $this -> write_menu_attributes($menus[$i]);
+ $this -> write_entries($menus[$i]['id']);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+ }
+}
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/limit.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/limit.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,74 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * limit.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Write XML for limit.conf
+*/
+class limit_conf extends fs_configuration {
+
+ public function limit_conf() {
+ $this -> fs_configuration();
+ }
+
+ public function main() {
+ $params = $this -> get_params_array($this -> db);
+ $this -> write_params_array($params);
+ $this -> output_xml();
+
+ }
+
+ /**
+ * Pull limit params from the db
+ * @return array
+ */
+ private function get_params_array() {
+ $query = sprintf('SELECT * FROM limit_conf;');
+ $res = $this -> db -> query($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($query);
+ $this -> comment($res -> getMessage());
+ return array();
+ }
+ $this -> comment($res -> numRows() . 'rows');
+ if ($res -> numRows() == 0) {
+ return array();
+ }
+ while ($row = $res -> fetchRow(MDB2_FETCHMODE_ASSOC)) {
+ $feeds_array[] = $row;
+ }
+ return $feeds_array;
+ }
+
+ /**
+ * Write out the XML of params retreived from get_params_array
+ * @see get_params_array
+ * @param unknown_type $params
+ */
+ private function write_params_array($params) {
+ $this -> xmlw -> startElement('configuration');
+ $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+ $this -> xmlw -> writeAttribute('description', 'Call Limiter');
+ $this -> xmlw -> startElement('settings');
+
+ $param_count = count($params);
+ for ($i=0; $i<$param_count; $i++) {
+ $this -> comment("$param_count/$i");
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $params[$i]['name']);
+ $this -> xmlw -> writeAttribute('value', $params[$i]['value']);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+ }
+
+}
+?>
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/local_stream.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/local_stream.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,73 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * local_stream.conf.php
+ */
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Class to write the XML for local_stream.conf
+ */
+class local_stream_conf extends fs_configuration {
+
+ public function local_stream_conf() {
+ $this -> fs_configuration();
+ }
+
+ public function main() {
+ $directories = $this -> get_directories();
+ $this -> write_directories($directories);
+ }
+
+ private function write_settings($profile_id) {
+ $query = sprintf('%s %s %s;'
+ , "SELECT * FROM local_stream_settings "
+ , "WHERE stream_id=$profile_id "
+ , "ORDER BY stream_id, param_name"
+ );
+ $settings_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $settings_count = count($settings_array);
+ if (MDB2::isError($settings_array)) {
+ $this -> comment($query);
+ $this -> comment($settings_array -> getMessage());
+ return ;
+ }
+ if ($settings_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('settings');
+
+ for ($i=0; $i<$settings_count; $i++) {
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
+ $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
+ $this -> xmlw -> endElement();//</param>
+ }
+ $this -> write_email($profile_id);
+ $this -> xmlw -> endElement();
+ }
+
+ private function get_directories() {
+ $query = sprintf('SELECT * FROM local_stream_conf;');
+ $profiles = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ if (MDB2::isError($profiles)) {
+ $this -> comment($query);
+ $this -> comment($profiles -> getMessage());
+ return array();
+ }
+ return $profiles;
+ }
+
+ private function write_directories($directories) {
+ $directory_count = count($directories);
+ for ($i=0; $i<$directory_count; $i++) {
+ $this -> write_settings($directories[$i]);
+ }
+ }
+}
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/post_load_modules.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,77 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * post_load_modules.conf.php
+ */
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Class to write the post_load_modules.conf XML for FreeSWITCH
+*/
+class post_load_modules_conf extends fs_configuration {
+
+ public function post_load_modules_conf() {
+ $this -> fs_configuration();
+ }
+
+ public function main() {
+ $params = $this -> get_modules_array($this -> db);
+ $this -> write_modules_array($params);
+ $this -> output_xml();
+
+ }
+
+ /**
+ * This method will pull the postloaded modules from the database
+ * @return array
+ */
+ function get_modules_array() {
+ $query = sprintf(
+ 'SELECT * FROM post_load_modules_conf WHERE load_module=1 ORDER BY priority;'
+ );
+ $res = $this -> db -> query($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($query);
+ $this -> comment($res -> getMessage());
+ return array();
+ }
+ $this -> comment($res -> numRows() . 'rows');
+ if ($res -> numRows() == 0) {
+ return array();
+ }
+ while ($row = $res -> fetchRow(MDB2_FETCHMODE_ASSOC)) {
+ $feeds_array[] = $row;
+ }
+ return $feeds_array;
+ }
+
+ /**
+ * This method will write the XML from the array returned by get_modules_array
+ * @see post_load_modules_conf::get_modules_array
+ * @param array $params array of modules to load
+ */
+ function write_modules_array($params) {
+ $this -> xmlw -> startElement('configuration');
+ $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+ $this -> xmlw -> writeAttribute(
+ 'description', 'Load All External Modules'
+ );
+ $this -> xmlw -> startElement('modules');
+
+ $param_count = count($params);
+ for ($i=0; $i<$param_count; $i++) {
+ $this -> xmlw -> startElement('load');
+ $this -> xmlw -> writeAttribute('module', $params[$i]['module_name']);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+ }
+
+}
+?>
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/rss.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/rss.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,70 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ *
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * class to write XML for rss.conf
+*/
+class rss_conf extends fs_configuration {
+
+ function rss_conf() {
+ $this -> fs_configuration();
+ }
+
+ function main() {
+ $feeds_array = $this -> get_feeds_array();
+ $this -> xmlw -> startElement('feeds');
+ $this -> xmlw -> endElement();
+ $this -> write_xml($feeds_array);
+ }
+
+ /**
+ * Get RSS feed info from DB
+ *
+ * @return array
+ */
+ function get_feeds_array() {
+ $query = sprintf(
+ 'SELECT * FROM rss_conf ORDER BY priority, local_file;'
+ );
+ $res = $this -> db -> query($query);
+ if (MDB2::isError($res)) {
+ return false;
+ }
+ while ($row = $res -> fetchRow(MDB2_FETCHMODE_ASSOC)) {
+ $feeds_array[] = $row;
+ }
+ return $feeds_array;
+ }
+
+ /**
+ * Write XML for RSS feeds that were pulled by get_feeds_arrray
+ * @see get_feeds_array
+ * @param unknown_type $feeds_in
+ */
+ function write_xml($feeds_in) {
+ $this -> xmlw -> startElement('configuration');
+ $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+ $this -> xmlw -> writeAttribute('description', 'RSS Parser');
+ $this -> xmlw -> startElement('feeds');
+ $feed_count = count($feeds_in);
+ for ($i=0; $i<$feed_count; $i++) {
+ $this -> xmlw -> startElement('feed');
+ $this -> xmlw -> writeAttribute(
+ 'name', $feeds_in[$i]['description']
+ );
+ $this -> xmlw -> text($feeds_in[$i]['local_file']);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ }
+}
+
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/sofia.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/sofia.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,196 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * sofia.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Write XML for sofia.conf
+*/
+class sofia_conf extends fs_configuration {
+ public function sofia_conf() {
+ $this -> fs_configuration();
+ }
+
+ public function main() {
+ $profiles = $this -> get_profiles();
+ $this -> write_config($profiles);
+ }
+
+ /**
+ * Pull the sofia profiles from the db
+ * @return array
+ */
+ private function get_profiles() {
+ $query = "SELECT * FROM sofia_conf";
+ $profiles = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ if (MDB2::isError($profiles)) {
+ $this -> comment($query);
+ $this -> comment($profiles -> getMessage());
+ $this -> file_not_found();
+ }
+ return $profiles;
+ }
+
+ /**
+ * Write aliases for current sofia <profile>
+ * @param integer $profile_id id of the sofia profile in sofia_conf
+ */
+ private function write_aliases($profile_id) {
+ $query = "SELECT * FROM sofia_aliases WHERE sofia_id=$profile_id ";
+ $aliases_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $aliases_count = count($aliases_array);
+ if (MDB2::isError($aliases_array)) {
+ $this -> comment($query);
+ $this -> comment($aliases_array -> getMessage());
+ return ;
+ }
+ if ($aliases_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('aliases');
+
+ for ($i=0; $i<$aliases_count; $i++) {
+ //$this -> comment_array($aliases_array[$i]);
+ $this -> xmlw -> startElement('alias');
+ $this -> xmlw -> writeAttribute('name', $aliases_array[$i]['alias_name']);
+ $this -> xmlw -> endElement();//</param>
+ }
+ $this -> xmlw -> endElement();
+ }
+
+ /**
+ * Write the <settings> for the current profile
+ * @param integer $profile_id id of the sofia profile in sofia_conf
+ */
+ private function write_settings($profile_id) {
+ $query = "SELECT * FROM sofia_settings WHERE sofia_id=$profile_id "
+ . "ORDER BY sofia_id, param_name";
+ $settings_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $settings_count = count($settings_array);
+ if (MDB2::isError($settings_array)) {
+ $this -> comment($query);
+ $this -> comment($settings_array -> getMessage());
+ return ;
+ }
+ if ($settings_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('settings');
+
+ for ($i=0; $i<$settings_count; $i++) {
+ //$this -> comment_array($settings_array[$i]);
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
+ $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
+ $this -> xmlw -> endElement();//</param>
+ }
+ $this -> xmlw -> endElement();
+ }
+
+ /**
+ * Write <gateways> XML for current profile
+ * @param integer $profile_id id of the sofia profile in sofia_conf
+ */
+ private function write_gateways($profile_id) {
+ $query = "SELECT * FROM sofia_gateways WHERE sofia_id=$profile_id "
+ . "ORDER BY gateway_name, gateway_param";
+ $gateway_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $gateway_count = count($gateway_array);
+ //$this -> comment_array($gateway_array);
+ if (MDB2::isError($gateway_array)) {
+ $this -> comment($query);
+ $this -> comment($gateway_array -> getMessage());
+ return ;
+ }
+ if ($gateway_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('gateways');
+ for ($i=0; $i<$gateway_count; $i++) {
+ $this_gateway = $gateway_array[$i]['gateway_name'];
+ if ($this_gateway != $gateway_array[$i-1]['gateway_name']) {
+ $this -> xmlw -> startElement('gateway');
+ $this -> xmlw -> writeAttribute('name', $this_gateway);
+ }
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $gateway_array[$i]['gateway_param']);
+ $this -> xmlw -> writeAttribute('value', $gateway_array[$i]['gateway_value']);
+ $this -> xmlw -> endElement();
+ if (!array_key_exists($i+1, $gateway_array)
+ || $this_gateway != $gateway_array[$i+1]['gateway_name']) {
+ $this -> xmlw -> endElement();
+ }
+ $last_gateway = $this_gateway;
+ }
+ $this -> xmlw -> endElement(); //</gateways>
+ }
+
+ /**
+ * Write <domains> XML for current sofia profile
+ * @param integer $profile_id id of sofia profile in sofia_conf
+ */
+ private function write_domains($profile_id) {
+ $query = "SELECT * FROM sofia_domains WHERE sofia_id=$profile_id";
+ $domain_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $domain_count = count($domain_array);
+ if (MDB2::isError($domain_array)) {
+ $this -> comment($query);
+ $this -> comment($domain_array -> getMessage());
+ return ;
+ }
+ if ($domain_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('domains');
+ for ($i=0; $i<$domain_count; $i++) {
+ $this -> xmlw -> startElement('domain');
+ $this -> xmlw -> writeAttribute('name', $domain_array[$i]['domain_name']);
+ $this -> xmlw -> writeAttribute(
+ 'parse', ($domain_array[$i]['parse'] == 1 ? 'true' : 'false')
+ );
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ }
+
+ /**
+ * Write XML for single sofia profile (including all subsections)
+ * This method opens and closes the <profile> as well as calling
+ * other methods to complete the other subsections of the XML
+ * @param array $profile array of the current profile
+ */
+ private function write_single_profile($profile) {
+ $this -> xmlw -> startElement('profile');
+ $this -> xmlw -> writeAttribute('name', $profile['profile_name']);
+ $this -> write_aliases($profile['id']);
+ $this -> write_domains($profile['id']);
+ $this -> write_gateways($profile['id']);
+ $this -> write_settings($profile['id']);
+ $this -> xmlw -> endElement();
+ }
+
+ /**
+ * Iterate over the profiles and write the corresponding XML via other methods
+ * @param array $profiles multi-dimentional array from get_profiles
+ */
+ private function write_config($profiles) {
+ $profile_count = count($profiles);
+ $this -> xmlw -> startElement('configuration');
+ $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+ $this -> xmlw -> writeAttribute('description', 'Sofia SIP Endpoint');
+ $this -> xmlw -> startElement('profiles');
+ for ($i=0; $i<$profile_count; $i++) {
+ $this -> write_single_profile($profiles[$i]);
+ }
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+ }
+}
+
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/spidermonkey.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/spidermonkey.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,51 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * spidermonkey.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * @todo make configuration get pulled from db? maybe just use defines if there's not evern gonna be too many options
+ * Class for writing spidermonkey.conf XML
+*/
+class spidermonkey_conf extends fs_configuration {
+
+ function spidermonkey_conf() {
+ $this -> fs_configuration();
+ }
+
+ function main() {
+ $params = $this -> get_params();
+ $this -> write_params($params);
+ }
+
+ private function get_params() {
+ return array(
+ 'mod_spidermonkey_teleone',
+ 'mod_spidermonkey_odbc',
+ 'mod_spidermonkey_core_db'
+ );
+ }
+
+ private function write_params($modules) {
+ $this -> xmlw -> startElement('configuration');
+ $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+ $this -> xmlw -> writeAttribute('description', 'JavaScript Plug-In Configuration');
+ $this -> xmlw -> startElement('modules');
+ $module_count = count($modules);
+ for ($i=0; $i<$module_count; $i++) {
+ $this -> xmlw -> startElement('load');
+ $this -> xmlw -> writeAttribute('module', $modules[$i]);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+ }
+}
+
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/voicemail.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,132 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * voicemail.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Writes out voicemail.conf XML
+ * @see fs_configuration
+*/
+class voicemail_conf extends fs_configuration {
+
+ public function voicemail_conf() {
+ $this -> fs_configuration();
+ }
+
+ public function main() {
+ $profiles = $this -> get_profiles();
+ $this -> write_config($profiles);
+ }
+
+ /**
+ * Get voicemail profiles from db
+ * @return array
+ */
+ private function get_profiles() {
+ $query = "SELECT * FROM voicemail_conf ORDER BY id";
+ $profiles = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ return $profiles;
+ }
+
+ /**
+ * Write XML for voicemail <settings>
+ * @return void
+ */
+ private function write_settings($profile_id) {
+ $query = sprintf('%s %s %s;'
+ , "SELECT * FROM voicemail_settings "
+ , "WHERE voicemail_id=$profile_id "
+ , "ORDER BY voicemail_id, param_name"
+ );
+ $settings_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $settings_count = count($settings_array);
+ if (MDB2::isError($settings_array)) {
+ $this -> comment($query);
+ $this -> comment($settings_array -> getMessage());
+ return ;
+ }
+ if ($settings_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('settings');
+
+ for ($i=0; $i<$settings_count; $i++) {
+ //$this -> comment_array($settings_array[$i]);
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
+ $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
+ $this -> xmlw -> endElement();//</param>
+ }
+ $this -> write_email($profile_id);
+ $this -> xmlw -> endElement();
+ }
+
+ /**
+ * Write XML for voicemail email settings
+ * @return void
+ */
+ private function write_email($profile_id) {
+ $query = sprintf('%s %s %s;'
+ , "SELECT * FROM voicemail_email "
+ , "WHERE voicemail_id=$profile_id "
+ , "ORDER BY voicemail_id, param_name"
+ );
+ $settings_array = $this -> db -> queryAll($query, null, MDB2_FETCHMODE_ASSOC);
+ $settings_count = count($settings_array);
+ if (MDB2::isError($settings_array)) {
+ $this -> comment($query);
+ $this -> comment($settings_array -> getMessage());
+ return ;
+ }
+ if ($settings_count < 1) {
+ return ;
+ }
+ $this -> xmlw -> startElement('email');
+
+ for ($i=0; $i<$settings_count; $i++) {
+ //$this -> comment_array($settings_array[$i]);
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $settings_array[$i]['param_name']);
+ $this -> xmlw -> writeAttribute('value', $settings_array[$i]['param_value']);
+ $this -> xmlw -> endElement();//</param>
+ }
+ $this -> xmlw -> endElement();
+ }
+
+ /**
+ * Write the XML for the current profile in write_profiles
+ * @return void
+ */
+ private function write_single_profile($profile) {
+ $this -> xmlw -> startElement('profile');
+ $this -> xmlw -> writeAttribute('name', $profile['vm_profile']);
+ $this -> write_settings($profile['id']);
+ $this -> xmlw -> endElement();
+ }
+
+ /**
+ * Write the entire XML config for the voicemail module
+ * Write XML by calling other methods to do specific areas of config
+ * @return void
+ */
+ private function write_config($profiles) {
+ $profile_count = count($profiles);
+ $this -> xmlw -> startElement('configuration');
+ $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+ $this -> xmlw -> writeAttribute('description', 'voicemail Endpoint');
+ $this -> xmlw -> startElement('profiles');
+ for ($i=0; $i<$profile_count; $i++) {
+ $this -> write_single_profile($profiles[$i]);
+ }
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+ }
+}
+
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/configuration/xml_cdr.conf.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,49 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * xml_cdr.conf.php
+ */
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Class for writing xml_cdr.conf XML
+*/
+class xml_cdr_conf extends fs_configuration {
+ function xml_cdr_conf() {
+ $this -> fs_configuration();
+ }
+
+ function main() {
+ $params = $this -> get_settings();
+ $this -> write_settings($params);
+ }
+
+ function get_settings() {
+ return array('url'=>'http://localhost/fs_curl/index_test.php', 'encode'=>'true');
+ return array(
+ 'url'=>'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']
+ , 'encode'=>'true'
+ );
+ }
+
+ function write_settings($params) {
+ $this -> xmlw -> startElement('configuration');
+ $this -> xmlw -> writeAttribute('name', basename(__FILE__, '.php'));
+ $this -> xmlw -> writeAttribute('description', 'CDRs via XML Post');
+ $this -> xmlw -> startElement('settings');
+ while (list($name, $value) = each($params)) {
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $name);
+ $this -> xmlw -> writeAttribute('value', $value);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+ }
+}
+
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/dialplan_importer.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/dialplan_importer.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,147 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Dialplan
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+*/
+
+/**
+ * include MDB2 PEAR Extension
+ */
+require_once('MDB2.php');
+/**
+ * require global definitions for FS_CURL
+ */
+require_once('global_defines.php');
+
+/**
+ * Output the upload form
+ * echo out the HTML for the upload form.
+ * @return null
+*/
+function upload_form() {
+ echo '<html>';
+ echo '<h1>Select A File To Import</h1>';
+ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data">';
+ echo '<input type="file" name="file">';
+ echo '<input type="submit" name="confirmed">';
+ echo '</form>';
+ echo '</html>';
+}
+
+/**
+ * Perform Insert Query
+ * take MDB2 object and query as params and
+ * perform query, setting error flag in the event
+ * of a db error.
+ * @return null
+*/
+function run_query($db, $query) {
+ $affected = $db -> exec($query);
+ if (MDB2::isError($affected)) {
+ if (!defined('UNSUCCESSFUL_QUERY')) {
+ define('UNSUCCESSFUL_QUERY', true);
+ }
+ echo "$query\n";
+ echo $affected -> getMessage() . "\n";
+ }
+}
+
+/**
+ * Check uploaded file for obvious problems
+ * This function checks the uploaded file's
+ * size, type, length, etc to make sure it's
+ * worth continuing with processing
+ * @return bool
+*/
+function check_uploaded_file($file_array) {
+ if (!is_uploaded_file($file_array['tmp_name'])) {
+ echo "File NOT uploaded OK<br>";
+ die(upload_form());
+ } elseif ($file_array['size'] < 1) {
+ echo "File was empty";
+ die(upload_form());
+ } elseif ($file_array['error'] > 0) {
+ echo "Uploading file encountered error #" . $file_array['error'];
+ die(upload_form());
+ } elseif ($file_array['type'] != 'text/xml') {
+ echo "Expected file of type 'text/xml', but got " . $file_array['type'];
+ die(upload_form());
+ } else {
+ //echo "File seems uploaded OK<br>";
+ return true;
+ }
+}
+
+
+if (!array_key_exists('confirmed', $_REQUEST)) {
+ die(upload_form());
+}
+
+/*
+foreach ($_REQUEST as $key => $val) {
+echo "$key => $val <br>\n";
+}
+if (is_array($_FILES) && count($_FILES)>0) {
+echo "<h2>FILES is an array</h2>";
+print_r($_FILES);
+}
+*/
+
+
+// no need to do anything till we check that the file's ok
+if (check_uploaded_file($_FILES['file'])) {
+ $xml_file = $_FILES['file']['tmp_name'];
+ move_uploaded_file($tmp_file, $xml_file);
+ //echo $xml_file . "\n<br>";
+ $xml_str = sprintf('<?xml version="1.0" encoding="UTF-8" standalone="no"?>%s', file_get_contents($xml_file));
+ //echo $xml_str;
+}
+
+$db = MDB2::connect(DEFAULT_DSN);
+if (MDB2::isError($db)) {
+ echo $db -> getMessage() . "\n";
+}
+
+$xml_obj = new SimpleXMLElement($xml_str);
+foreach ($xml_obj -> context as $context) {
+ $cn = $context['name'];
+ $global_weight = 100;
+ foreach ($context -> extension as $extension) {
+ $en = $extension['name'];
+ $ec = is_numeric($extension['continue']) ? $extension['continue'] : '0';
+ $global_weight+=100;
+ foreach ($extension -> condition as $condition) {
+ //print_r($condition);
+ $cf = $condition['field'];
+ $ce = $condition['expression'];
+ $cc = $condition['continue'];
+ $weight = 0;
+ foreach ($condition as $type => $action) {
+ //echo "-------------------$type-----------------------------\n";
+ $app_name = $action['application'];
+ $app_data = $action['data'];
+ $weight++;
+ //echo "$cn\t$en\t$cf\t$ce\t$cc\t$app_name\t$app_data\t$ec\t$global_weight\t$weight\n";
+ $query = sprintf('%s %s %s %s %s %s;',
+ "INSERT INTO curl_dialplan SET",
+ "context='$cn', extension='$en', condition_field='$cf',",
+ "condition_expression='$ce', application_name='$app_name',",
+ "application_data='$app_data', weight='$weight', type='$type',",
+ "ext_continue='$ec', global_weight='$global_weight',",
+ "condition_continue='$cc'"
+ );
+ run_query($db, $query);
+ }
+ }
+ }
+}
+if (defined(UNSUCCESSFUL_QUERY) && UNSUCCESSFUL_QUERY == true) {
+ echo "<h2>Some Queries Were Not Successful</h2>";
+} else {
+ echo "<h2>File Successfully Imported</h2>";
+}
+upload_form();
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_configuration.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_configuration.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,72 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * fs_configuration.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+ header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Class for all module configurations
+ * @return object
+*/
+class fs_configuration extends fs_curl {
+ /**
+ * Class Instantiation
+ * This method will instantiate all other objects upon which it relies.
+ * @return void
+ */
+ function fs_configuration() {
+ $this -> fs_curl();
+ $mod_name = sprintf('mod_%s', str_replace('.conf', '', $this -> request['key_value']));
+ $this -> comment("module name is $mod_name");
+ if (!$this -> is_mod_enabled($mod_name)) {
+ $this -> comment('module not enabled');
+ $this -> file_not_found();
+ }
+ $this -> xmlw -> startElement('section');
+ $this -> xmlw -> writeAttribute('name', 'configuration');
+ $this -> xmlw -> writeAttribute(
+ 'description', 'FreeSWITCH Configuration'
+ );
+ }
+
+ /**
+ * Enabled module checker
+ * This method will check if a module is enabled before
+ * returning the XML for the module. If the module's not
+ * enabled, the file_not_found method will be called.
+ * @param string $mod_name name of module to check
+ * @return bool
+ */
+ function is_mod_enabled($mod_name) {
+ if ($mod_name == 'mod_post_load_modules') {
+ return true;
+ }
+ $query = sprintf('%s %s'
+ , "SELECT * FROM post_load_modules_conf"
+ , "WHERE module_name='$mod_name' AND load_module=1"
+ );
+ $res = $this -> db -> query($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($query);
+ $this -> comment($res -> getMessage());
+ return true; //default allow policy
+ return false; //comment previous line to default deny
+ $this -> file_not_found();
+ } elseif ($res -> numRows() == 1) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
+
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_curl.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_curl.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,290 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Configuration
+ * fs_curl.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+ header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * FreeSWITCH CURL base class
+ * Base class for all curl XML output, contains methods for XML output and
+ * connecting to a database
+ * @return void
+*/
+class fs_curl {
+ /**
+ * MDB2 Object
+ * @link http://pear.php.net/MDB2
+ * @var $db MDB2
+ */
+ public $db;
+ /**
+ * Array of _REQUEST parameters passed
+ *
+ * @var array
+ */
+ public $request;
+ /**
+ * XMLWriter object
+ * @link http://php.net/XMLWriter
+ * @var object
+ */
+ public $xmlw;
+ /**
+ * Array of comments to be output in the XML
+ * @see fs_curl::comment
+ * @var array
+ */
+ private $comments;
+
+ /**
+ * Instantiation of XMLWriter and MDB2
+ * This method will instantiate the MDB2 and XMLWriter classes for use
+ * in child classes
+ * @return void
+ */
+ public function fs_curl() {
+ header('Content-Type: text/xml');
+ $this -> open_xml();
+ $this -> generate_request_array();
+ $inc = array('required'=>'MDB2.php');
+ $this -> include_files($inc);
+ $this -> connect_db(DEFAULT_DSN);
+ set_error_handler(array($this, 'error_handler'));
+ //trigger_error('blah', E_USER_ERROR);
+ }
+
+ /**
+ * Connect to a database via MDB2
+ * @param mixed $dsn data source for database connection (array or string)
+ * @return void
+ */
+ public function connect_db($dsn) {
+ $this -> db = MDB2::connect($dsn);
+ if (MDB2::isError($this -> db)) {
+ $this -> comment($this -> db -> getMessage());
+ $this -> file_not_found();
+ }
+ $this -> db -> setFetchMode(MDB2_FETCHMODE_ASSOC);
+ }
+
+ /**
+ * Method to add comments to XML
+ * Adds a comment to be displayed in the final XML
+ * @param string $comment comment string to be output in XML
+ * @return void
+ */
+ public function comment($comment) {
+ $this -> comments[] = $comment;
+ }
+
+ /**
+ * Generate a globally accesible array of the _REQUEST parameters passed
+ * Generates an array from the _REQUEST parameters that were passed, keeping
+ * all key => value combinations intact
+ * @return void
+ */
+ private function generate_request_array() {
+ while (list($req_key, $req_val) = each($_REQUEST)) {
+ //$this -> comment("$req_key => $req_val");
+ $this -> request[$req_key] = $req_val;
+ }
+ }
+
+ /**
+ * Actual Instantiation of XMLWriter Object
+ * This method creates an XMLWriter Object and sets some needed options
+ * @return void
+ */
+ private function open_xml() {
+ $this -> xmlw = new XMLWriter();
+ $this -> xmlw -> openMemory();
+ $this -> xmlw -> setIndent(true);
+ $this -> xmlw -> setIndentString(' ');
+ $this -> xmlw -> startDocument('1.0', 'UTF-8', 'no');
+ //set the freeswitch document type
+ $this -> xmlw -> startElement('document');
+ $this -> xmlw -> writeAttribute('type', 'freeswitch/xml');
+ }
+
+ /**
+ * Method to call on any error that can not be revovered from
+ * This method was written to return a valid XML response to FreeSWITCH
+ * in the event that we are unable to generate a valid configuration file
+ * from the passed information
+ * @return void
+ */
+ public function file_not_found() {
+ $this -> comment('Include Path = ' . ini_get('include_path'));
+ $not_found = new XMLWriter();
+ $not_found -> openMemory();
+ $not_found -> setIndent(true);
+ $not_found -> setIndentString(' ');
+ $not_found -> startDocument('1.0', 'UTF-8', 'no');
+ //set the freeswitch document type
+ $not_found -> startElement('document');
+ $not_found -> writeAttribute('type', 'freeswitch/xml');
+ $not_found -> startElement('section');
+ $not_found -> writeAttribute('name', 'result');
+ $not_found -> startElement('result');
+ $not_found -> writeAttribute('status', 'not found');
+ $not_found -> endElement();
+ $not_found -> endElement();
+ $not_found -> endElement();
+ $this -> comments2xml($not_found, $this -> comments);
+ echo $not_found -> outputMemory();
+ exit();
+ }
+
+ /**
+ * Generate XML comments from comments array
+ * This [recursive] method will iterate over the passed array, writing XML
+ * comments and calling itself in the event that the "comment" is an array
+ * @param object $xml_obj Already instantiated XMLWriter object
+ * @param array $comments [Multi-dementional] Array of comments to be added
+ * @param integer $space_pad Number of spaces to indent the comments
+ * @return void
+ */
+ private function comments2xml($xml_obj, $comments, $space_pad=0) {
+ $comment_count = count($comments);
+ for ($i = 0; $i < $comment_count; $i++) {
+ if (!is_array($comments[$i])) {
+ $xml_obj -> writeComment($comments[$i]);
+ } else {
+ $this -> comments2xml($xml_obj, $comments[$i], $space_pad + 2);
+ }
+ }
+ }
+
+ /**
+ * End open XML elments in XMLWriter object
+ * @return void
+ */
+ private function close_xml() {
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+ }
+
+ /**
+ * Close and Output XML and stop script execution
+ * @return void
+ */
+ public function output_xml() {
+ $this -> close_xml();
+ $comment_count = count($this -> comments);
+ for ($i = 0; $i < $comment_count; $i++) {
+ $this -> xmlw -> writeComment($this -> comments[$i]);
+ }
+ echo $this -> xmlw -> outputMemory();
+ exit();
+ }
+
+ /**
+ * Recursive method to add an array of comments
+ * @return void
+ */
+ public function comment_array($array, $spacepad=0) {
+ $spaces = str_repeat(' ', $spacepad);
+ foreach ($array as $key => $val) {
+ if (is_array($val)) {
+ $this -> comment("$spaces$key => Array");
+ $this -> comment_array($val, $spacepad+2);
+ } else {
+ $this -> comment("$spaces$key => $val");
+ }
+ }
+ }
+
+ /**
+ * Include files for child classes
+ * This method will include the files needed by child classes.
+ * Expects an associative array of type => path
+ * where type = [required|any other string]
+ * @param array $file_array associative array of files to include
+ * @return void
+ * @todo add other types for different levels of errors
+ */
+ public function include_files($file_array) {
+ $return = FS_CURL_SUCCESS;
+ while (list($type, $file) = each($file_array)) {
+ $inc = @include_once($file);
+ if (!$inc) {
+ $comment = sprintf(
+ 'Unable To Include %s File %s', $type, $file
+ );
+ $this -> comment($comment);
+ if ($type == 'required') {
+ $return = FS_CURL_CRITICAL;
+ } else {
+ if ($return != FS_CURL_CRITICAL) {
+ $return = FS_CURL_WARNING;
+ }
+ }
+ }
+ }
+ if ($return == FS_CURL_CRITICAL) {
+ $this -> file_not_found();
+ }
+ return $return;
+ }
+
+ /**
+ * Class-wide error handler
+ * This method should be called whenever there is an error in any child
+ * classes, script execution and returning is pariatlly determined by
+ * defines
+ * @see RETURN_ON_WARN
+ * @return void
+ * @todo add other defines that control what, if any, comments gets output
+ */
+ public function error_handler($no, $str, $file, $line) {
+ /*
+ $this -> comment("USER_ERROR " . E_USER_ERROR);
+ $this -> comment("USER_NOTICE " . E_USER_NOTICE);
+ $this -> comment("USER_WARNING " . E_USER_WARNING);
+ $this -> comment("ALL " . E_ALL);
+ $this -> comment("COMPILE_ERROR " . E_COMPILE_ERROR);
+ $this -> comment("COMPILE_WARNING " . E_COMPILE_WARNING);
+ $this -> comment("CORE_ERROR " . E_CORE_ERROR);
+ $this -> comment("CORE_WARNING " . E_CORE_WARNING);
+ $this -> comment("ERROR " . E_ERROR);
+ $this -> comment("NOTICE " . E_NOTICE);
+ $this -> comment("WARNING " . E_WARNING);
+ $this -> comment("PARSE " . E_PARSE);
+ $this -> comment("RECOVERABLE_ERROR " . E_RECOVERABLE_ERROR);
+ $this -> comment("STRICT " . E_STRICT);
+ //$this -> comment(E);
+ */
+ if ($no == E_STRICT) {
+ return true;
+ }
+
+ $file = ereg_replace('\.(inc|php)$', '', $file);
+ $this -> comment(basename($file) . ":$line - $no:$str");
+
+ switch ($no) {
+ case E_USER_NOTICE:
+ case E_NOTICE:
+ break;
+ case E_USER_WARNING:
+ case E_WARNING:
+ if (defined('RETURN_ON_WARN') && RETURN_ON_WARN == true) {
+ break;
+ }
+ case E_ERROR:
+ case E_USER_ERROR:
+ default:
+ $this -> file_not_found();
+ }
+ return true;
+ }
+}
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_dialplan.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_dialplan.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,127 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Dialplan
+ * @todo i should probably add a condition_weight to order the conditions inside a given extension
+ * fs_dialplan.php
+ */
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+ header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Dialplan
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Class for XML dialplan
+*/
+class fs_dialplan extends fs_curl {
+ public function fs_dialplan() {
+ $this -> fs_curl();
+ }
+
+ public function main() {
+ $this -> comment($this -> request);
+ $context = $this -> request['context'];
+ $dp_array = $this -> get_dialplan($context);
+ $this -> writeDialplan($dp_array);
+ $this -> output_xml();
+ }
+
+ /**
+ * This method will pull dialplan from database
+ *
+ * @param string $context context name for XML dialplan
+ * @return array
+ */
+ private function get_dialplan($context) {
+ $dp_array = array();
+ $dpQuery = sprintf("%s %s;"
+ , "SELECT * FROM dialplan WHERE context='$context' ORDER BY"
+ , "global_weight, context, extension, weight"
+ );
+ $res = $this -> db -> query($dpQuery);
+ if (MDB2::isError($res)) {
+ $this -> comment($res -> getMessage());
+ $this -> file_not_found();
+ }
+ $condition_number = 0;
+ while ($row = $res -> fetchRow()) {
+ $ct = $row['context'];
+ $et = $row['extension'];
+ $ec = $row['ext_continue'];
+ $app = $row['application_name'];
+ $data = $row['application_data'];
+ $type = $row['type'];
+ $cf = $row['condition_field'];
+ $ce = $row['condition_expression'];
+ $cc = empty($row['condition_continue']) ? '0' : $row['condition_continue'];
+ $dp_array[$ct]["$et;$ec"]["$cf;$ce;$cc"][] = array(
+ 'type'=>$type,
+ 'application'=>$app,
+ 'data'=>$data
+ );
+ }
+ return $dp_array;
+ }
+
+ /**
+ * Write XML dialplan from the array returned by get_dialplan
+ * @see fs_dialplan::get_dialplan
+ * @param array $dpArray Multi-dimentional array from which we write the XML
+ */
+ private function writeDialplan($dpArray) {
+ //print_r($dpArray);
+ if (is_array($dpArray)) {
+ //$this -> comment('dpArray is an array');
+ foreach ($dpArray as $context => $extensions_array) {
+ //$this -> comment($context);
+ //start the context
+ $this -> xmlw -> startElement('context');
+ $this -> xmlw -> writeAttribute('name', $context);
+ if (is_array($extensions_array)) {
+ foreach ($extensions_array as $extension => $conditions) {
+ //start an extension
+ $ex_split = split(';', $extension);
+ $this -> xmlw -> startElement('extension');
+ $this -> xmlw -> writeAttribute('name', $ex_split[0]);
+ if ($ex_split[1] > 0) {
+ $this -> xmlw -> writeAttribute('continue', $ex_split[1]);
+ }
+ foreach ($conditions as $condition => $app_array) {
+ $c_split = split(';', $condition);
+ $this -> xmlw -> startElement('condition');
+ if (!empty($c_split[0])) {
+ $this -> xmlw -> writeAttribute('field', $c_split[0]);
+ }
+ if (!empty($c_split[1])) {
+ $this -> xmlw -> writeAttribute('expression', $c_split[1]);
+ }
+ //$this -> comment($c_split[2]);
+ if ($c_split[2] != '0') {
+ $this -> xmlw -> writeAttribute('continue', $c_split[2]);
+ }
+ foreach ($app_array as $app) {
+ $this -> xmlw -> startElement($app['type']);
+ $this -> xmlw -> writeAttribute('application', $app['application']);
+ if (!empty($app['data'])) {
+ $this -> xmlw -> writeAttribute('data', $app['data']);
+ }
+ $this -> xmlw -> endElement();
+ }
+ //</condition>
+ $this -> xmlw -> endElement();
+ }
+ // </extension>
+ $this -> xmlw -> endElement();
+ }
+ }
+ // </context>
+ $this -> xmlw -> endElement();
+ }
+ }
+ }
+}
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_directory.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/fs_directory.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,214 @@
+<?php
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * fs_directory.php
+*/
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+ header('Location: index.php');
+}
+
+/**
+ * @package FS_CURL
+ * @subpackage FS_CURL_Directory
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * Class for XML directory
+*/
+class fs_directory extends fs_curl {
+ public function fs_directory() {
+ $this -> fs_curl();
+ }
+
+ public function main() {
+ $this -> comment($this -> request);
+ $directory_array = $this -> get_directory();
+ $this -> writedirectory($directory_array);
+ $this -> output_xml();
+ }
+
+ /**
+ * This method will pull directory from database
+ * @return array
+ * @todo add GROUP BY to query to make sure we don't get duplicate users
+ */
+ private function get_directory() {
+ $directory_array = array();
+ if (!array_key_exists('domain', $this -> request)) {
+ $this -> comment('domain not passed');
+ $this -> file_not_found();
+ }
+ if (GLOBAL_USERS != true) {
+ $where_array[] = sprintf("domain='%s'", $this -> request['domain']);
+ }
+ if (array_key_exists('user', $this -> request)) {
+ $where_array[] = sprintf("username='%s'", $this -> request['user']);
+ }
+ if (!empty($where_array)) {
+ $this -> comment('where array has contents');
+ if (count($where_array) > 1) {
+ $where_clause = sprintf('WHERE ', implode(' AND ', $where_array));
+ } else {
+ $where_clause = sprintf('WHERE %s', $where_array[0]);
+ }
+ } else {
+ $where_clause = '';
+ }
+ $query = sprintf(
+ "SELECT * FROM directory %s ORDER BY username"
+ , $where_clause
+ );
+ $res = $this -> db -> queryAll($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($query);
+ $this -> comment($res -> getMessage());
+ $this -> file_not_found();
+ }
+ return $res;
+ }
+
+ /**
+ * Writes XML for directory user's <params>
+ * This method will pull all of the user params based on the passed user_id
+ * @param integer $user_id
+ * @return void
+ */
+ private function write_params($user_id) {
+ $query = sprintf(
+ "SELECT * FROM directory_params WHERE directory_id='$user_id';"
+ );
+ $res = $this -> db -> queryAll($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($query);
+ $this -> comment($res -> getMessage());
+ $this -> file_not_found();
+ }
+ $param_count = count($res);
+ if ($param_count > 0) {
+ $this -> xmlw -> startElement('params');
+ for ($i=0; $i<$param_count; $i++) {
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $res[$i]['param_name']);
+ $this -> xmlw -> writeAttribute('value', $res[$i]['param_value']);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ }
+ }
+
+ /**
+ * Write all the <variables> for a given user
+ *
+ * @param integer $user_id
+ * @return void
+ */
+ private function write_variables($user_id) {
+ $query = sprintf(
+ "SELECT * FROM directory_vars WHERE directory_id='$user_id';"
+ );
+ $res = $this -> db -> queryAll($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($res -> getMessage());
+ $this -> file_not_found();
+ }
+ $var_count = count($res);
+ if ($var_count > 0) {
+ $this -> xmlw -> startElement('variables');
+ for ($i=0; $i<$var_count; $i++) {
+ $this -> xmlw -> startElement('variable');
+ $this -> xmlw -> writeAttribute('name', $res[$i]['var_name']);
+ $this -> xmlw -> writeAttribute('value', $res[$i]['var_value']);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ }
+ }
+
+ /**
+ * Write all of the XML for the user's <gateways>
+ * This method takes the id of the user from the directory table and pulls
+ * all of the user's gateways. It then calls write_single_gateway for
+ * each of them to write out all of the params
+ * @param integer $user_id
+ * @return void
+ */
+ private function write_gateways($user_id) {
+ $query = sprintf(
+ "SELECT * FROM directory_gateways WHERE directory_id='$user_id';"
+ );
+ $res = $this -> db -> queryAll($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($res -> getMessage());
+ $this -> file_not_found();
+ }
+ $gw_count = count($res);
+ if ($gw_count > 0) {
+ $this -> xmlw -> startElement('gateways');
+ for ($i=0; $i<$gw_count; $i++) {
+ $this -> xmlw -> startElement('gateway');
+ $this -> xmlw -> writeAttribute('name', $res[$i]['gateway_name']);
+ $this -> write_single_gateway($res[$i]['id']);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ }
+ }
+
+ /**
+ * Write out the <params> XML for each user-specific gateway
+ *
+ * @param integer $d_gw_id id from directory_gateways
+ * @return void
+ */
+ private function write_single_gateway($d_gw_id) {
+ $query = sprintf(
+ "SELECT * FROM directory_gateway_params WHERE d_gw_id='%s';", $d_gw_id
+ );
+ $res = $this -> db -> queryAll($query);
+ if (MDB2::isError($res)) {
+ $this -> comment($res -> getMessage());
+ $this -> file_not_found();
+ }
+ $param_count = count($res);
+ if ($param_count > 0) {
+ for ($i=0; $i<$param_count; $i++) {
+ $this -> xmlw -> startElement('param');
+ $this -> xmlw -> writeAttribute('name', $res[$i]['param_name']);
+ $this -> xmlw -> writeAttribute('value', $res[$i]['param_value']);
+ $this -> xmlw -> endElement();
+ }
+ }
+ }
+
+ /**
+ * Write XML directory from the array returned by get_directory
+ * @see fs_directory::get_directory
+ * @param array $directory Multi-dimentional array from which we write the XML
+ * @return void
+ */
+ private function writedirectory($directory) {
+ if (empty($directory)) {
+ $this -> comment('no users found');
+ $this -> file_not_found();
+ }
+ $directory_count = count($directory);
+ $this -> xmlw -> startElement('section');
+ $this -> xmlw -> writeAttribute('name', 'directory');
+ $this -> xmlw -> writeAttribute('description', 'FreeSWITCH Dialplan');
+ $this -> xmlw -> startElement('domain');
+ $this -> xmlw -> writeAttribute('name', $this -> request['domain']);
+ for ($i=0; $i<$directory_count; $i++) {
+ $this -> xmlw -> startElement('user');
+ $this -> xmlw -> writeAttribute('id', $directory[$i]['username']);
+ $this -> write_params($directory[$i]['id']);
+ $this -> write_variables($directory[$i]['id']);
+ $this -> write_gateways($directory[$i]['id']);
+ $this -> xmlw -> endElement();
+ }
+ $this -> xmlw -> endElement();
+ $this -> xmlw -> endElement();
+ }
+}
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/global_defines.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/global_defines.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,46 @@
+<?php
+/**
+ * @package FS_CURL
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ */
+
+if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
+ header('Location: index.php');
+}
+
+/**
+ * Defines the default dsn for the MDB2 PEAR class
+ */
+define('DEFAULT_DSN', 'mysql://freeswitch:Fr33Sw1tch@localhost/freeswitch');
+/**
+ * Generic return success
+ */
+define('FS_CURL_SUCCESS', 0);
+/**
+ * Generic return warning
+ */
+define('FS_CURL_WARNING', 1);
+/**
+ * Generic return critical
+ */
+define('FS_CURL_CRITICAL', 2);
+
+/**
+ * determines how the error handler handles warnings
+ */
+define('RETURN_ON_WARN', true);
+
+/**
+ * Determines whether or not users should be domain specific
+ * If GLOBAL_USERS is true, user info will be returned for whatever
+ * domain is passed.....
+ * NOTE: using a1 hashes will NOT work with this setting
+ */
+define('GLOBAL_USERS', true);
+
+
+
+//define('', '');
+?>
\ No newline at end of file
Added: freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/index.php
==============================================================================
--- (empty file)
+++ freeswitch/trunk/scripts/contrib/intralanman/PHP/fs_curl/index.php Wed Jan 9 18:15:19 2008
@@ -0,0 +1,71 @@
+<?php
+/**
+ * @package FS_CURL
+ * @license
+ * @author Raymond Chandler (intralanman) <intralanman(a)gmail.com>
+ * @version 0.1
+ * initial page hit in all curl requests
+ */
+
+/**
+ * Pre-Class initialization die function
+ * This function should be called on any
+ * critical error condition before the fs_curl
+ * class is successfully instantiated.
+ * @return void
+*/
+function file_not_found($no=false, $str=false, $file=false, $line=false) {
+ header('Content-Type: text/xml');
+ $xmlw = new XMLWriter();
+ $xmlw -> openMemory();
+ $xmlw -> setIndent(true);
+ $xmlw -> setIndentString(' ');
+ $xmlw -> startDocument('1.0', 'UTF-8', 'no');
+ //set the freeswitch document type
+ $xmlw -> startElement('document');
+ $xmlw -> writeAttribute('type', 'freeswitch/xml');
+ $xmlw -> startElement('section');
+ $xmlw -> writeAttribute('name', 'result');
+ $xmlw -> startElement('result');
+ $xmlw -> writeAttribute('status', 'not found');
+ $xmlw -> endElement();
+ $xmlw -> endElement();
+ $xmlw -> endElement();
+ echo $xmlw -> outputMemory();
+ exit();
+}
+
+if (!(@include_once('fs_curl.php'))
+|| !(@include_once('global_defines.php'))) {
+ file_not_found();
+}
+$section = $_REQUEST['section'];
+$section_file = sprintf('fs_%s.php', $section);
+/**
+ * this include will differ based on the section that's passed
+ */
+if (!(@include_once($section_file))) {
+ file_not_found();
+}
+switch ($section) {
+ case 'configuration':
+ $config = $_REQUEST['key_value'];
+ $processor = sprintf('configuration/%s.php', $config);
+ $class = str_replace('.', '_', $config);
+ if (!(@include_once($processor))) {
+ file_not_found();
+ exit();
+ }
+ $conf = new $class;
+ $conf -> comment("class name is $class");
+ break;
+ case 'dialplan':
+ $conf = new fs_dialplan();
+ break;
+ case 'directory':
+ $conf = new fs_directory();
+ break;
+}
+$conf -> main();
+$conf -> output_xml();
+?>
\ No newline at end of file
1
0
Author: mikej
Date: Wed Jan 9 15:18:33 2008
New Revision: 7157
Modified:
freeswitch/trunk/src/switch_rtp.c
Log:
fix timestamp base in 2833 when not re-writing timestamps (partial fix for FSCORE-83)
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Wed Jan 9 15:18:33 2008
@@ -848,15 +848,8 @@
rtp_session->dtmf_data.out_digit_packet[0] = (unsigned char) switch_char_to_rfc2833(rdigit->digit);
rtp_session->dtmf_data.out_digit_packet[1] = 7;
- if (rtp_session->timer.timer_interface) {
- rtp_session->dtmf_data.timestamp_dtmf = rtp_session->timer.samplecount + samples;
- } else {
- rtp_session->dtmf_data.timestamp_dtmf = rtp_session->last_write_ts + samples;
- }
-
-
+ rtp_session->dtmf_data.timestamp_dtmf = rtp_session->last_write_ts + samples;
-
rtp_session->seq++;
switch_rtp_write_manual(rtp_session,
rtp_session->dtmf_data.out_digit_packet,
1
0
09 Jan '08
Author: brian
Date: Wed Jan 9 14:40:43 2008
New Revision: 7156
Modified:
freeswitch/trunk/conf/autoload_configs/conference.conf.xml
freeswitch/trunk/conf/lang/en/vm/sounds.xml
Log:
tweak a few things
Modified: freeswitch/trunk/conf/autoload_configs/conference.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/conference.conf.xml (original)
+++ freeswitch/trunk/conf/autoload_configs/conference.conf.xml Wed Jan 9 14:40:43 2008
@@ -52,37 +52,37 @@
<!-- If TTS is enabled all audio-file params beginning with -->
<!-- 'say:' will be considered text to say with TTS -->
<!-- Set a default path here so you can use relative paths in the other sound params-->
- <!--<param name="sound-prefix" value="/soundfiles"/>-->
+ <param name="sound-prefix" value="${base_dir}/en/us/callie"/>
<!-- File to play to acknowledge succees -->
<!--<param name="ack-sound" value="beep.wav"/>-->
<!-- File to play to acknowledge failure -->
<!--<param name="nack-sound" value="beeperr.wav"/>-->
<!-- File to play to acknowledge muted -->
- <!--<param name="muted-sound" value="muted.wav"/>-->
+ <param name="muted-sound" value="conference/conf-muted.wav"/>
<!-- File to play to acknowledge unmuted -->
- <!--<param name="unmuted-sound" value="unmuted.wav"/>-->
+ <param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
<!-- File to play if you are alone in the conference -->
- <!--<param name="alone-sound" value="yactopitc.wav"/>-->
+ <param name="alone-sound" value="conference/conf-alone.wav"/>
<!-- File to play endlessly (nobody will ever be able to talk) -->
<!--<param name="perpetual-sound" value="perpetual.wav"/>-->
<!-- File to play when you're alone (music on hold)-->
<param name="moh-sound" value="$${moh_uri}"/>
<!-- File to play when you join the conference -->
- <param name="enter-sound" value="tone_stream://%(1000,0,500)"/>
+ <param name="enter-sound" value="tone_stream://%(500,0,500,600)"/>
<!-- File to play when you leave the conference -->
- <!--<param name="exit-sound" value="exit.wav"/>-->
+ <param name="exit-sound" value="tone_stream://%(500,0,300,200)"/>
<!-- File to play when you ae ejected from the conference -->
- <!--<param name="kicked-sound" value="kicked.wav"/>-->
+ <param name="kicked-sound" value="conference/conf-kicked.wav"/>
<!-- File to play when the conference is locked -->
- <!--<param name="locked-sound" value="locked.wav"/>-->
+ <param name="locked-sound" value="conference/conf-locked.wav"/>
<!-- File to play when the conference is locked during the call-->
- <!--<param name="is-locked-sound" value="is-locked.wav"/>-->
+ <param name="is-locked-sound" value="conference/conf-is-locked.wav"/>
<!-- File to play when the conference is unlocked during the call-->
- <!--<param name="is-unlocked-sound" value="is-unlocked.wav"/>-->
+ <param name="is-unlocked-sound" value="conference/conf-is-unlocked.wav"/>
<!-- File to play to prompt for a pin -->
- <!--<param name="pin-sound" value="pin.wav"/>-->
+ <param name="pin-sound" value="conference/conf-pin.wav"/>
<!-- File to play to when the pin is invalid -->
- <!--<param name="bad-pin-sound" value="invalid-pin.wav"/>-->
+ <param name="bad-pin-sound" value="conference/conf-bad-pin.wav"/>
<!-- Conference pin -->
<!--<param name="pin" value="12345"/>-->
<!-- Default Caller ID Name for outbound calls -->
Modified: freeswitch/trunk/conf/lang/en/vm/sounds.xml
==============================================================================
--- freeswitch/trunk/conf/lang/en/vm/sounds.xml (original)
+++ freeswitch/trunk/conf/lang/en/vm/sounds.xml Wed Jan 9 14:40:43 2008
@@ -137,7 +137,7 @@
<macro name="voicemail_record_urgent_check">
<input pattern="^([0-9#*]):([0-9#*])$">
<match>
- <action function="play-file" data="voicemail/vm-mark_urgent.wav"/>
+ <action function="play-file" data="voicemail/vm-mark-urgent.wav"/>
<action function="play-file" data="voicemail/vm-press.wav"/>
<action function="say" data="$1" method="pronounced" type="name_spelled"/>
<action function="play-file" data="voicemail/vm-continue.wav"/>
@@ -270,13 +270,13 @@
<input pattern="^(emailed)$">
<match>
<action function="play-file" data="voicemail/vm-message.wav"/>
- <action function="play-file" data="voicemail/vm-saved.wav"/>
+ <action function="play-file" data="voicemail/vm-$1.wav"/>
</match>
</input>
<input pattern="^(marked-urgent)$">
<match>
<action function="play-file" data="voicemail/vm-message.wav"/>
- <action function="play-file" data="voicemail/vm-saved.wav"/>
+ <action function="play-file" data="voicemail/vm-$1.wav"/>
</match>
</input>
</macro>
1
0