[asterisk-commits] anthonyl: branch anthonyl/voicemail-fixups
r51175 - in /team/anthonyl/voicema...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Jan 16 18:22:09 MST 2007
Author: anthonyl
Date: Tue Jan 16 19:22:09 2007
New Revision: 51175
URL: http://svn.digium.com/view/asterisk?view=rev&rev=51175
Log:
svnmerge merge
Added:
team/anthonyl/voicemail-fixups/doc/voicemail_odbc_postgresql.txt (props changed)
- copied unchanged from r51172, branches/1.4/doc/voicemail_odbc_postgresql.txt
Modified:
team/anthonyl/voicemail-fixups/ (props changed)
team/anthonyl/voicemail-fixups/apps/app_voicemail.c
team/anthonyl/voicemail-fixups/channels/chan_iax2.c
team/anthonyl/voicemail-fixups/contrib/scripts/vmdb.sql
team/anthonyl/voicemail-fixups/main/rtp.c
Propchange: team/anthonyl/voicemail-fixups/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/anthonyl/voicemail-fixups/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jan 16 19:22:09 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-51155
+/branches/1.4:1-51174
Modified: team/anthonyl/voicemail-fixups/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/voicemail-fixups/apps/app_voicemail.c?view=diff&rev=51175&r1=51174&r2=51175
==============================================================================
--- team/anthonyl/voicemail-fixups/apps/app_voicemail.c (original)
+++ team/anthonyl/voicemail-fixups/apps/app_voicemail.c Tue Jan 16 19:22:09 2007
@@ -672,6 +672,12 @@
ast_copy_string(retval->fullname, tmp->value, sizeof(retval->fullname));
} else if (!strcasecmp(tmp->name, "context")) {
ast_copy_string(retval->context, tmp->value, sizeof(retval->context));
+#ifdef IMAP_STORAGE
+ } else if (!strcasecmp(tmp->name, "imapuser")) {
+ ast_copy_string(retval->imapuser, tmp->value, sizeof(retval->imapuser));
+ } else if (!strcasecmp(tmp->name, "imappassword")) {
+ ast_copy_string(retval->imappassword, tmp->value, sizeof(retval->imappassword));
+#endif
} else
apply_option(retval, tmp->name, tmp->value);
tmp = tmp->next;
@@ -1041,7 +1047,7 @@
}
if (!strcasecmp(coltitle, "recording")) {
off_t offset;
- res = SQLGetData(stmt, x + 1, SQL_BINARY, NULL, 0, &colsize2);
+ res = SQLGetData(stmt, x + 1, SQL_BINARY, rowdata, 0, &colsize2);
fdlen = colsize2;
if (fd > -1) {
char tmp[1]="";
@@ -1053,15 +1059,14 @@
}
/* Read out in small chunks */
for (offset = 0; offset < colsize2; offset += CHUNKSIZE) {
- /* +1 because SQLGetData likes null-terminating binary data */
- if ((fdm = mmap(NULL, CHUNKSIZE + 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) {
+ if ((fdm = mmap(NULL, CHUNKSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset)) == (void *)-1) {
ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
goto yuck;
} else {
- res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, CHUNKSIZE + 1, NULL);
- munmap(fdm, 0);
+ res = SQLGetData(stmt, x + 1, SQL_BINARY, fdm, CHUNKSIZE, NULL);
+ munmap(fdm, CHUNKSIZE);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Get Data error!\n[%s]\n\n", sql);
unlink(full_fn);
@@ -8229,6 +8234,28 @@
}
#endif
+static struct ast_vm_user *find_user_realtime_imapuser(const char *imapuser)
+{
+ struct ast_variable *var;
+ struct ast_vm_user *vmu;
+
+ vmu = ast_calloc(1, sizeof *vmu);
+ if (!vmu)
+ return NULL;
+ ast_set_flag(vmu, VM_ALLOCED);
+ populate_defaults(vmu);
+
+ var = ast_load_realtime("voicemail", "imapuser", imapuser, NULL);
+ if (var) {
+ apply_options_full(vmu, var);
+ ast_variables_destroy(var);
+ return vmu;
+ } else {
+ free(vmu);
+ return NULL;
+ }
+}
+
/* Interfaces to C-client */
void mm_exists(MAILSTREAM * stream, unsigned long number)
@@ -8362,6 +8389,12 @@
if(!strcasecmp(mb->user, vmu->imapuser)) {
ast_copy_string(pwd, vmu->imappassword, MAILTMPLEN);
break;
+ }
+ }
+ if (!vmu) {
+ if ((vmu = find_user_realtime_imapuser(mb->user))) {
+ ast_copy_string(pwd, vmu->imappassword, MAILTMPLEN);
+ free_user(vmu);
}
}
}
Modified: team/anthonyl/voicemail-fixups/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/voicemail-fixups/channels/chan_iax2.c?view=diff&rev=51175&r1=51174&r2=51175
==============================================================================
--- team/anthonyl/voicemail-fixups/channels/chan_iax2.c (original)
+++ team/anthonyl/voicemail-fixups/channels/chan_iax2.c Tue Jan 16 19:22:09 2007
@@ -908,26 +908,25 @@
#define schedule_action(func, data) __schedule_action(func, data, __PRETTY_FUNCTION__)
#endif
+static int send_ping(void *data);
+
static void __send_ping(void *data)
{
int callno = (long)data;
ast_mutex_lock(&iaxsl[callno]);
- if (iaxs[callno])
+ if (iaxs[callno] && iaxs[callno]->pingid != -1) {
send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1);
+ iaxs[callno]->pingid = ast_sched_add(sched, ping_time * 1000, send_ping, data);
+ }
ast_mutex_unlock(&iaxsl[callno]);
}
static int send_ping(void *data)
{
- int callno = (long)data;
- if (iaxs[callno]) {
#ifdef SCHED_MULTITHREADED
- if (schedule_action(__send_ping, data))
+ if (schedule_action(__send_ping, data))
#endif
- __send_ping(data);
- return 1;
- } else
- return 0;
+ __send_ping(data);
return 0;
}
@@ -943,27 +942,26 @@
return e;
}
+static int send_lagrq(void *data);
+
static void __send_lagrq(void *data)
{
int callno = (long)data;
/* Ping only if it's real not if it's bridged */
ast_mutex_lock(&iaxsl[callno]);
- if (iaxs[callno])
+ if (iaxs[callno] && iaxs[callno]->lagid != -1) {
send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_LAGRQ, 0, NULL, 0, -1);
+ iaxs[callno]->lagid = ast_sched_add(sched, lagrq_time * 1000, send_lagrq, data);
+ }
ast_mutex_unlock(&iaxsl[callno]);
}
static int send_lagrq(void *data)
{
- int callno = (long)data;
- if (iaxs[callno]) {
#ifdef SCHED_MULTITHREADED
- if (schedule_action(__send_lagrq, data))
+ if (schedule_action(__send_lagrq, data))
#endif
- __send_lagrq(data);
- return 1;
- } else
- return 0;
+ __send_lagrq(data);
return 0;
}
Modified: team/anthonyl/voicemail-fixups/contrib/scripts/vmdb.sql
URL: http://svn.digium.com/view/asterisk/team/anthonyl/voicemail-fixups/contrib/scripts/vmdb.sql?view=diff&rev=51175&r1=51174&r2=51175
==============================================================================
--- team/anthonyl/voicemail-fixups/contrib/scripts/vmdb.sql (original)
+++ team/anthonyl/voicemail-fixups/contrib/scripts/vmdb.sql Tue Jan 16 19:22:09 2007
@@ -7,5 +7,7 @@
email VARCHAR(80) NOT NULL DEFAULT '',
pager VARCHAR(80) NOT NULL DEFAULT '',
options VARCHAR(160) NOT NULL DEFAULT '',
+imapuser VARCHAR(80) DEFAULT NULL,
+imappassword VARCHAR(80) DEFAULT NULL,
PRIMARY KEY (context, mailbox)
);
Propchange: team/anthonyl/voicemail-fixups/doc/voicemail_odbc_postgresql.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/anthonyl/voicemail-fixups/doc/voicemail_odbc_postgresql.txt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: team/anthonyl/voicemail-fixups/doc/voicemail_odbc_postgresql.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/anthonyl/voicemail-fixups/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/anthonyl/voicemail-fixups/main/rtp.c?view=diff&rev=51175&r1=51174&r2=51175
==============================================================================
--- team/anthonyl/voicemail-fixups/main/rtp.c (original)
+++ team/anthonyl/voicemail-fixups/main/rtp.c Tue Jan 16 19:22:09 2007
@@ -143,7 +143,8 @@
unsigned int dtmfduration;
/* DTMF Transmission Variables */
unsigned int lastdigitts;
- char send_digit;
+ char sending_digit; /* boolean - are we sending digits */
+ char send_digit; /* digit we are sending */
int send_payload;
int send_duration;
int nat;
@@ -1091,7 +1092,7 @@
struct ast_rtp *bridged = NULL;
/* If time is up, kill it */
- if (rtp->send_digit)
+ if (rtp->sending_digit)
ast_rtp_senddigit_continuation(rtp);
len = sizeof(sin);
@@ -2138,6 +2139,7 @@
}
/* Since we received a begin, we can safely store the digit and disable any compensation */
+ rtp->sending_digit = 1;
rtp->send_digit = digit;
rtp->send_payload = payload;
@@ -2229,6 +2231,7 @@
ast_inet_ntoa(rtp->them.sin_addr),
ntohs(rtp->them.sin_port), rtp->send_payload, rtp->seqno, rtp->lastdigitts, res - hdrlen);
}
+ rtp->sending_digit = 0;
rtp->send_digit = 0;
/* Increment lastdigitts */
rtp->lastdigitts += 960;
More information about the asterisk-commits
mailing list