[asterisk-commits] juggie: branch juggie/NoLossCDR r79087 - in /team/juggie/NoLossCDR: ./ apps/ ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Aug 10 14:25:40 CDT 2007
Author: juggie
Date: Fri Aug 10 14:25:39 2007
New Revision: 79087
URL: http://svn.digium.com/view/asterisk?view=rev&rev=79087
Log:
Merged revisions 78724,78756,78785,78811,78835,78868,78914,78965,79030,79054 via svnmerge from
https://origsvn.digium.com/svn/asterisk/team/group/CDRfix5
........
r78724 | automerge | 2007-08-09 12:29:01 -0400 (Thu, 09 Aug 2007) | 1 line
automerge commit
........
r78756 | automerge | 2007-08-09 13:29:37 -0400 (Thu, 09 Aug 2007) | 1 line
automerge commit
........
r78785 | automerge | 2007-08-09 14:28:48 -0400 (Thu, 09 Aug 2007) | 1 line
automerge commit
........
r78811 | automerge | 2007-08-09 15:26:44 -0400 (Thu, 09 Aug 2007) | 1 line
automerge commit
........
r78835 | automerge | 2007-08-09 16:29:01 -0400 (Thu, 09 Aug 2007) | 1 line
automerge commit
........
r78868 | automerge | 2007-08-09 18:28:04 -0400 (Thu, 09 Aug 2007) | 1 line
automerge commit
........
r78914 | automerge | 2007-08-09 20:27:41 -0400 (Thu, 09 Aug 2007) | 1 line
automerge commit
........
r78965 | automerge | 2007-08-10 10:27:49 -0400 (Fri, 10 Aug 2007) | 1 line
automerge commit
........
r79030 | automerge | 2007-08-10 12:26:32 -0400 (Fri, 10 Aug 2007) | 1 line
automerge commit
........
r79054 | automerge | 2007-08-10 14:27:54 -0400 (Fri, 10 Aug 2007) | 1 line
automerge cancel
........
Modified:
team/juggie/NoLossCDR/ (props changed)
team/juggie/NoLossCDR/Makefile
team/juggie/NoLossCDR/apps/app_meetme.c
team/juggie/NoLossCDR/apps/app_minivm.c
team/juggie/NoLossCDR/apps/app_voicemail.c
team/juggie/NoLossCDR/channels/chan_iax2.c
team/juggie/NoLossCDR/channels/chan_mgcp.c
team/juggie/NoLossCDR/channels/chan_sip.c
team/juggie/NoLossCDR/channels/chan_zap.c
team/juggie/NoLossCDR/configs/queues.conf.sample
team/juggie/NoLossCDR/funcs/func_devstate.c
team/juggie/NoLossCDR/include/asterisk/devicestate.h
team/juggie/NoLossCDR/include/asterisk/event_defs.h
team/juggie/NoLossCDR/include/asterisk/lock.h
team/juggie/NoLossCDR/main/devicestate.c
team/juggie/NoLossCDR/main/event.c
team/juggie/NoLossCDR/main/file.c
team/juggie/NoLossCDR/res/res_features.c
Propchange: team/juggie/NoLossCDR/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/juggie/NoLossCDR/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/juggie/NoLossCDR/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Aug 10 14:25:39 2007
@@ -1,1 +1,1 @@
-/team/group/CDRfix5:1-78691
+/team/group/CDRfix5:1-79085
Modified: team/juggie/NoLossCDR/Makefile
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/Makefile?view=diff&rev=79087&r1=79086&r2=79087
==============================================================================
--- team/juggie/NoLossCDR/Makefile (original)
+++ team/juggie/NoLossCDR/Makefile Fri Aug 10 14:25:39 2007
@@ -281,7 +281,11 @@
@echo " + Asterisk has successfully been built, and +"
@echo " + can be installed by running: +"
@echo " + +"
+ifeq ($(MAKE), gmake)
+ @echo " + $(MAKE) install +"
+else
@echo " + $(MAKE) install +"
+endif
@echo " +-------------------------------------------+"
_all: cleantest $(SUBDIRS)
@@ -490,14 +494,22 @@
@echo " + configuration files (overwriting any +"
@echo " + existing config files), run: +"
@echo " + +"
+ifeq ($(MAKE), gmake)
+ @echo " + $(MAKE) samples +"
+else
@echo " + $(MAKE) samples +"
+endif
@echo " + +"
@echo " +----------------- or ---------------------+"
@echo " + +"
@echo " + You can go ahead and install the asterisk +"
@echo " + program documentation now or later run: +"
@echo " + +"
+ifeq ($(MAKE), gmake)
+ @echo " + $(MAKE) progdocs +"
+else
@echo " + $(MAKE) progdocs +"
+endif
@echo " + +"
@echo " + **Note** This requires that you have +"
@echo " + doxygen installed on your local system +"
@@ -669,7 +681,11 @@
@echo " + directories, and logs, run the following +"
@echo " + command: +"
@echo " + +"
+ifeq ($(MAKE), gmake)
+ @echo " + $(MAKE) uninstall-all +"
+else
@echo " + $(MAKE) uninstall-all +"
+endif
@echo " +-------------------------------------------+"
uninstall-all: _uninstall
Modified: team/juggie/NoLossCDR/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/apps/app_meetme.c?view=diff&rev=79087&r1=79086&r2=79087
==============================================================================
--- team/juggie/NoLossCDR/apps/app_meetme.c (original)
+++ team/juggie/NoLossCDR/apps/app_meetme.c Fri Aug 10 14:25:39 2007
@@ -231,8 +231,7 @@
" 'D' -- dynamically add conference, prompting for a PIN\n"
" 'e' -- select an empty conference\n"
" 'E' -- select an empty pinless conference\n"
-" 'F' -- Pass DTMF through the conference. DTMF used to activate any\n"
-" conference features will not be passed through.\n"
+" 'F' -- Pass DTMF through the conference.\n"
" 'i' -- announce user join/leave with review\n"
" 'I' -- announce user join/leave without review\n"
" 'l' -- set listen only mode (Listen only, no talking)\n"
@@ -1516,7 +1515,7 @@
/* This device changed state now - if this is the first user */
if (conf->users == 1)
- ast_device_state_changed("meetme:%s", conf->confno);
+ ast_devstate_changed(AST_DEVICE_INUSE, "meetme:%s", conf->confno);
ast_mutex_unlock(&conf->playlock);
@@ -2031,6 +2030,9 @@
} else if ((f->frametype == AST_FRAME_DTMF) && (confflags & CONFFLAG_EXIT_CONTEXT)) {
char tmp[2];
+ if (confflags & CONFFLAG_PASS_DTMF)
+ conf_queue_dtmf(conf, user, f);
+
tmp[0] = f->subclass;
tmp[1] = '\0';
if (!ast_goto_if_exists(chan, exitcontext, tmp, 1)) {
@@ -2049,10 +2051,14 @@
pbx_builtin_setvar_helper(chan, "MEETME_EXIT_KEY", exitkey);
+ if (confflags & CONFFLAG_PASS_DTMF)
+ conf_queue_dtmf(conf, user, f);
ret = 0;
ast_frfree(f);
break;
} else if (((f->frametype == AST_FRAME_DTMF) && (f->subclass == '*') && (confflags & CONFFLAG_STARMENU)) || ((f->frametype == AST_FRAME_DTMF) && menu_active)) {
+ if (confflags & CONFFLAG_PASS_DTMF)
+ conf_queue_dtmf(conf, user, f);
if (ioctl(fd, ZT_SETCONF, &ztc_empty)) {
ast_log(LOG_WARNING, "Error setting conference\n");
close(fd);
@@ -2377,7 +2383,7 @@
/* Change any states */
if (!conf->users)
- ast_device_state_changed("meetme:%s", conf->confno);
+ ast_devstate_changed(AST_DEVICE_NOT_INUSE, "meetme:%s", conf->confno);
/* Return the number of seconds the user was in the conf */
snprintf(meetmesecs, sizeof(meetmesecs), "%d", (int) (time(NULL) - user->jointime));
@@ -3349,6 +3355,23 @@
return ringing_station;
}
+static enum ast_device_state sla_state_to_devstate(enum sla_trunk_state state)
+{
+ switch (state) {
+ case SLA_TRUNK_STATE_IDLE:
+ return AST_DEVICE_NOT_INUSE;
+ case SLA_TRUNK_STATE_RINGING:
+ return AST_DEVICE_RINGING;
+ case SLA_TRUNK_STATE_UP:
+ return AST_DEVICE_INUSE;
+ case SLA_TRUNK_STATE_ONHOLD:
+ case SLA_TRUNK_STATE_ONHOLD_BYME:
+ return AST_DEVICE_ONHOLD;
+ }
+
+ return AST_DEVICE_UNKNOWN;
+}
+
static void sla_change_trunk_state(const struct sla_trunk *trunk, enum sla_trunk_state state,
enum sla_which_trunk_refs inactive_only, const struct sla_trunk_ref *exclude)
{
@@ -3361,7 +3384,8 @@
|| trunk_ref == exclude)
continue;
trunk_ref->state = state;
- ast_device_state_changed("SLA:%s_%s", station->name, trunk->name);
+ ast_devstate_changed(sla_state_to_devstate(state),
+ "SLA:%s_%s", station->name, trunk->name);
break;
}
}
@@ -3853,7 +3877,7 @@
{
ast_atomic_fetchadd_int((int *) &event->trunk_ref->trunk->hold_stations, 1);
event->trunk_ref->state = SLA_TRUNK_STATE_ONHOLD_BYME;
- ast_device_state_changed("SLA:%s_%s",
+ ast_devstate_changed(AST_DEVICE_ONHOLD, "SLA:%s_%s",
event->station->name, event->trunk_ref->trunk->name);
sla_change_trunk_state(event->trunk_ref->trunk, SLA_TRUNK_STATE_ONHOLD,
INACTIVE_TRUNK_REFS, event->trunk_ref);
@@ -4363,7 +4387,8 @@
sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_UP, ALL_TRUNK_REFS, NULL);
else {
trunk_ref->state = SLA_TRUNK_STATE_UP;
- ast_device_state_changed("SLA:%s_%s", station->name, trunk_ref->trunk->name);
+ ast_devstate_changed(AST_DEVICE_INUSE,
+ "SLA:%s_%s", station->name, trunk_ref->trunk->name);
}
}
@@ -4580,21 +4605,7 @@
AST_RWLIST_UNLOCK(&sla_trunks);
break;
}
- switch (trunk_ref->state) {
- case SLA_TRUNK_STATE_IDLE:
- res = AST_DEVICE_NOT_INUSE;
- break;
- case SLA_TRUNK_STATE_RINGING:
- res = AST_DEVICE_RINGING;
- break;
- case SLA_TRUNK_STATE_UP:
- res = AST_DEVICE_INUSE;
- break;
- case SLA_TRUNK_STATE_ONHOLD:
- case SLA_TRUNK_STATE_ONHOLD_BYME:
- res = AST_DEVICE_ONHOLD;
- break;
- }
+ res = sla_state_to_devstate(trunk_ref->state);
AST_RWLIST_UNLOCK(&sla_trunks);
}
AST_RWLIST_UNLOCK(&sla_stations);
Modified: team/juggie/NoLossCDR/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/apps/app_minivm.c?view=diff&rev=79087&r1=79086&r2=79087
==============================================================================
--- team/juggie/NoLossCDR/apps/app_minivm.c (original)
+++ team/juggie/NoLossCDR/apps/app_minivm.c Fri Aug 10 14:25:39 2007
@@ -2275,11 +2275,11 @@
int len = strlen("\n");
switch (tmpwrite[1]) {
case 'n':
- strncpy(tmpwrite+len, tmpwrite+2, strlen(tmpwrite+2)+1);
+ memmove(tmpwrite + len, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
strncpy(tmpwrite, "\n", len);
break;
case 't':
- strncpy(tmpwrite+len, tmpwrite+2, strlen(tmpwrite+2)+1);
+ memmove(tmpwrite + len, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
strncpy(tmpwrite, "\t", len);
break;
default:
Modified: team/juggie/NoLossCDR/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/apps/app_voicemail.c?view=diff&rev=79087&r1=79086&r2=79087
==============================================================================
--- team/juggie/NoLossCDR/apps/app_voicemail.c (original)
+++ team/juggie/NoLossCDR/apps/app_voicemail.c Fri Aug 10 14:25:39 2007
@@ -1681,8 +1681,6 @@
copy(frompath2, topath2);
ast_variables_destroy(var);
}
-#endif
-
/*! \brief
* A negative return value indicates an error.
* \note Should always be called with a lock already set on dir.
@@ -1714,8 +1712,8 @@
return x - 1;
}
-#endif
-
+#endif /*#ifndef IMAP_STORAGE*/
+#endif /*#else of #ifdef ODBC_STORAGE*/
#ifndef ODBC_STORAGE
static int vm_delete(char *file)
{
@@ -2294,8 +2292,39 @@
};
return (id >= 0 && id < (sizeof(msgs)/sizeof(msgs[0]))) ? msgs[id] : "Unknown";
}
+#ifdef IMAP_STORAGE
+static int folder_int(const char *folder)
+{
+ /*assume a NULL folder means INBOX*/
+ if (!folder)
+ return 0;
+ if(!strcasecmp(folder, "INBOX"))
+ return 0;
+ else if (!strcasecmp(folder, "Old"))
+ return 1;
+ else if (!strcasecmp(folder, "Work"))
+ return 2;
+ else if (!strcasecmp(folder, "Family"))
+ return 3;
+ else if (!strcasecmp(folder, "Friends"))
+ return 4;
+ else if (!strcasecmp(folder, "Cust1"))
+ return 5;
+ else if (!strcasecmp(folder, "Cust2"))
+ return 6;
+ else if (!strcasecmp(folder, "Cust3"))
+ return 7;
+ else if (!strcasecmp(folder, "Cust4"))
+ return 8;
+ else if (!strcasecmp(folder, "Cust5"))
+ return 9;
+ else /*assume they meant INBOX if folder is not found otherwise*/
+ return 0;
+}
+#endif
#ifdef ODBC_STORAGE
+/*! XXX \todo Fix this function to support multiple mailboxes in the intput string */
static int inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
{
int x = -1;
@@ -2438,17 +2467,16 @@
static int has_voicemail(const char *mailbox, const char *folder)
{
- char *context, tmp[256];
+ char tmp[256], *tmp2 = tmp, *mbox, *context;
ast_copy_string(tmp, mailbox, sizeof(tmp));
- if ((context = strchr(tmp, '@')))
- *context++ = '\0';
- else
- context = "default";
-
- if (messagecount(context, tmp, folder))
- return 1;
- else
- return 0;
+ while ((context = mbox = strsep(&tmp2, ","))) {
+ strsep(&context, "@");
+ if (ast_strlen_zero(context))
+ context = "default";
+ if (messagecount(context, mbox, folder))
+ return 1;
+ }
+ return 0;
}
#elif defined(IMAP_STORAGE)
@@ -2521,66 +2549,24 @@
}
-static int inboxcount(const char *mailbox, int *newmsgs, int *oldmsgs)
+static int messagecount(const char *context, const char *mailbox, const char *folder)
{
SEARCHPGM *pgm;
SEARCHHEADER *hdr;
- struct ast_vm_user *vmu;
- struct vm_state *vms_p;
- char tmp[256] = "";
- char *mb, *cur;
- char *mailboxnc;
- char *context;
- int ret = 0;
-
- if (newmsgs)
- *newmsgs = 0;
-
- if (oldmsgs)
- *oldmsgs = 0;
-
- ast_debug(3,"Mailbox is set to %s\n",mailbox);
-
- /* If no mailbox, return immediately */
- if (ast_strlen_zero(mailbox))
- return 0;
-
- if (strchr(mailbox, ',')) {
- int tmpnew, tmpold;
- ast_copy_string(tmp, mailbox, sizeof(tmp));
- mb = tmp;
- ret = 0;
- while((cur = strsep(&mb, ", "))) {
- if (!ast_strlen_zero(cur)) {
- if (inboxcount(cur, newmsgs ? &tmpnew : NULL, oldmsgs ? &tmpold : NULL))
- return -1;
- else {
- if (newmsgs)
- *newmsgs += tmpnew;
- if (oldmsgs)
- *oldmsgs += tmpold;
- }
- }
- }
- return 0;
- }
-
- ast_copy_string(tmp, mailbox, sizeof(tmp));
-
- if ((context = strchr(tmp, '@'))) {
- *context = '\0';
- mailboxnc = tmp;
- context++;
- } else {
- context = "default";
- mailboxnc = (char *)mailbox;
- }
-
- /* We have to get the user before we can open the stream! */
- /*ast_debug(1,"Before find_user, context is %s and mailbox is %s\n",context,mailbox); */
- if (!(vmu = find_user(NULL, context, mailboxnc))) {
- ast_log(LOG_ERROR, "Couldn't find mailbox %s in context %s\n", mailboxnc, context);
+ struct ast_vm_user *vmu;
+ struct vm_state *vms_p;
+ int ret = 0;
+ int fold = folder_int(folder);
+
+ if (ast_strlen_zero(mailbox))
+ return 0;
+
+ /* We have to get the user before we can open the stream! */
+ /* ast_log (LOG_DEBUG,"Before find_user, context is %s and mailbox is %s\n",context,mailbox); */
+ vmu = find_user(NULL, context, mailbox);
+ if (!vmu) {
+ ast_log (LOG_ERROR,"Couldn't find mailbox %s in context %s\n",mailbox,context);
return -1;
}
@@ -2591,108 +2577,184 @@
return -1;
}
- /* check if someone is accessing this box right now... */
- if ((vms_p = get_vm_state_by_imapuser(vmu->imapuser, 1)) || (vms_p = get_vm_state_by_mailbox(mailboxnc, 1))) {
- ast_debug(3,"Returning before search - user is logged in\n");
- *newmsgs = vms_p->newmessages;
- *oldmsgs = vms_p->oldmessages;
- free_user(vmu);
- return 0;
- }
-
- /* add one if not there... */
- if (!(vms_p = get_vm_state_by_imapuser(vmu->imapuser, 0)) && !(vms_p = get_vm_state_by_mailbox(mailboxnc, 0))) {
+ /* check if someone is accessing this box right now... */
+ vms_p = get_vm_state_by_imapuser(vmu->imapuser,1);
+ if (!vms_p) {
+ vms_p = get_vm_state_by_mailbox(mailbox,1);
+ }
+ if (vms_p) {
+ ast_debug(3, "Returning before search - user is logged in\n");
+ if(fold == 0) {/*INBOX*/
+ free_user(vmu);
+ return vms_p->newmessages;
+ }
+ if(fold == 1) {/*Old messages*/
+ free_user(vmu);
+ return vms_p->oldmessages;
+ }
+ }
+
+ /* add one if not there... */
+ vms_p = get_vm_state_by_imapuser(vmu->imapuser,0);
+ if (!vms_p) {
+ vms_p = get_vm_state_by_mailbox(mailbox,0);
+ }
+
+ if (!vms_p) {
ast_debug(3,"Adding new vmstate for %s\n",vmu->imapuser);
if (!(vms_p = ast_calloc(1, sizeof(*vms_p)))) {
free_user(vmu);
return -1;
}
- ast_copy_string(vms_p->imapuser,vmu->imapuser, sizeof(vms_p->imapuser));
- ast_copy_string(vms_p->username, mailboxnc, sizeof(vms_p->username)); /* save for access from interactive entry point */
- vms_p->mailstream = NIL; /* save for access from interactive entry point */
- ast_debug(3,"Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
+ ast_copy_string(vms_p->imapuser,vmu->imapuser, sizeof(vms_p->imapuser));
+ ast_copy_string(vms_p->username, mailbox, sizeof(vms_p->username)); /* save for access from interactive entry point */
+ vms_p->mailstream = NIL; /* save for access from interactive entry point */
+ ast_debug(3, "Copied %s to %s\n",vmu->imapuser,vms_p->imapuser);
vms_p->updated = 1;
/* set mailbox to INBOX! */
- ast_copy_string(vms_p->curbox, mbox(NEW_FOLDER), sizeof(vms_p->curbox));
- init_vm_state(vms_p);
- vmstate_insert(vms_p);
- }
-
- /* If no mailstream exists yet and even after attempting to initialize it fails, bail out */
- ret = init_mailstream(vms_p, NEW_FOLDER);
+ ast_copy_string(vms_p->curbox, mbox(fold), sizeof(vms_p->curbox));
+ init_vm_state(vms_p);
+ vmstate_insert(vms_p);
+ }
+ ret = init_mailstream(vms_p, fold);
if (!vms_p->mailstream) {
ast_log (LOG_ERROR,"Houston we have a problem - IMAP mailstream is NULL\n");
free_user(vmu);
return -1;
}
-
- if (!ret && vms_p->updated > 0) {
- if (newmsgs) {
- pgm = mail_newsearchpgm();
- hdr = mail_newsearchheader("X-Asterisk-VM-Extension", (char *)mailboxnc);
- pgm->header = hdr;
+ if (ret == 0) {
+ pgm = mail_newsearchpgm ();
+ hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)mailbox);
+ pgm->header = hdr;
+ if (fold != 1) {
pgm->unseen = 1;
pgm->seen = 0;
- pgm->undeleted = 1;
- pgm->deleted = 0;
- vms_p->vmArrayIndex = 0;
- mail_search_full(vms_p->mailstream, NULL, pgm, NIL);
- *newmsgs = vms_p->vmArrayIndex;
- vms_p->newmessages = vms_p->vmArrayIndex;
- mail_free_searchpgm(&pgm);
- }
- if (oldmsgs) {
- pgm = mail_newsearchpgm ();
- hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)mailboxnc);
- pgm->header = hdr;
+ }
+ /* In the special case where fold is 1 (old messages) we have to do things a bit
+ * differently. Old messages are stored in the INBOX but are marked as "seen"
+ */
+ else {
pgm->unseen = 0;
pgm->seen = 1;
- pgm->undeleted = 1;
- pgm->deleted = 0;
- vms_p->vmArrayIndex = 0;
- mail_search_full(vms_p->mailstream, NULL, pgm, NIL);
- *oldmsgs = vms_p->vmArrayIndex;
+ }
+ pgm->undeleted = 1;
+ pgm->deleted = 0;
+
+ vms_p->vmArrayIndex = 0;
+ mail_search_full (vms_p->mailstream, NULL, pgm, NIL);
+ if(fold == 0)
+ vms_p->newmessages = vms_p->vmArrayIndex;
+ if(fold == 1)
vms_p->oldmessages = vms_p->vmArrayIndex;
- mail_free_searchpgm(&pgm);
- }
- }
-
- if (vms_p->updated > 1) { /* changes, so we did the searches above */
- vms_p->updated = 0;
- } else { /* no changes, so don't search */
- mail_ping(vms_p->mailstream);
- /* Keep the old data */
- *newmsgs = vms_p->newmessages;
- *oldmsgs = vms_p->oldmessages;
- }
-
+ /*Freeing the searchpgm also frees the searchhdr*/
+ mail_free_searchpgm(&pgm);
+ free_user(vmu);
+ vms_p->updated = 0;
+ return vms_p->vmArrayIndex;
+ } else {
+ mail_ping(vms_p->mailstream);
+ }
free_user(vmu);
- return 0;
- }
+ return 0;
+}
+static int inboxcount(const char *mailbox_context, int *newmsgs, int *oldmsgs)
+{
+ char tmp[PATH_MAX] = "";
+ char *mailboxnc;
+ char *context;
+ char *mb;
+ char *cur;
+ if (newmsgs)
+ *newmsgs = 0;
+ if (oldmsgs)
+ *oldmsgs = 0;
+
+ ast_debug(3,"Mailbox is set to %s\n",mailbox_context);
+ /* If no mailbox, return immediately */
+ if (ast_strlen_zero(mailbox_context))
+ return 0;
+
+ ast_copy_string(tmp, mailbox_context, sizeof(tmp));
+ context = strchr(tmp, '@');
+ if (strchr(mailbox_context, ',')) {
+ int tmpnew, tmpold;
+ ast_copy_string(tmp, mailbox_context, sizeof(tmp));
+ mb = tmp;
+ while((cur = strsep(&mb, ", "))) {
+ if (!ast_strlen_zero(cur)) {
+ if (inboxcount(cur, newmsgs ? &tmpnew : NULL, oldmsgs ? &tmpold : NULL))
+ return -1;
+ else {
+ if (newmsgs)
+ *newmsgs += tmpnew;
+ if (oldmsgs)
+ *oldmsgs += tmpold;
+ }
+ }
+ }
+ return 0;
+ }
+ if (context) {
+ *context = '\0';
+ mailboxnc = tmp;
+ context++;
+ } else {
+ context = "default";
+ mailboxnc = (char *)mailbox_context;
+ }
+ if (newmsgs) {
+ if((*newmsgs = messagecount(context, mailboxnc, "INBOX")) < 0)
+ return -1;
+ }
+ if (oldmsgs) {
+ if((*oldmsgs = messagecount(context, mailboxnc, "Old")) < 0)
+ return -1;
+ }
+ return 0;
+}
+
static int has_voicemail(const char *mailbox, const char *folder)
{
- int newmsgs, oldmsgs;
-
- if(inboxcount(mailbox, &newmsgs, &oldmsgs))
+ char tmp[256], *tmp2, *mbox, *context;
+ ast_copy_string(tmp, mailbox, sizeof(tmp));
+ tmp2 = tmp;
+ if(strchr(tmp2, ',')) {
+ while((mbox = strsep(&tmp2, ","))) {
+ if(!ast_strlen_zero(mbox)) {
+ if (has_voicemail(mbox, folder))
+ return 1;
+ }
+ }
+ }
+ if ((context= strchr(tmp, '@')))
+ *context++ = '\0';
+ else
+ context = "default";
+ return messagecount(context, tmp, folder) ? 1 : 0;
+}
+
+static int copy_message(struct ast_channel *chan, struct ast_vm_user *vmu, int imbox, int msgnum, long duration, struct ast_vm_user *recip, char *fmt, char *dir)
+{
+ char dest[256];
+ struct vm_state *sendvms = NULL, *destvms = NULL;
+ char messagestring[10]; /*I guess this could be a problem if someone has more than 999999999 messages...*/
+ if(!(sendvms = get_vm_state_by_imapuser(vmu->imapuser, 2)))
+ {
+ ast_log(LOG_ERROR, "Couldn't get vm_state for originator's mailbox!!\n");
+ return -1;
+ }
+ if(!(destvms = get_vm_state_by_imapuser(recip->imapuser, 2)))
+ {
+ ast_log(LOG_ERROR, "Couldn't get vm_state for destination mailbox!\n");
+ return -1;
+ }
+ imap_mailbox_name(dest, destvms, imbox, 1);
+ snprintf(messagestring, sizeof(messagestring), "%ld", sendvms->msgArray[msgnum]);
+ if((mail_copy(sendvms->mailstream, messagestring, dest) == T))
return 0;
- else
- return folder? oldmsgs: newmsgs;
-}
-
-static int messagecount(const char *context, const char *mailbox, const char *folder)
-{
- int newmsgs, oldmsgs;
- char tmp[256] = "";
-
- if (ast_strlen_zero(mailbox))
- return 0;
- sprintf(tmp,"%s@%s", mailbox, ast_strlen_zero(context)? "default": context);
-
- if(inboxcount(tmp, &newmsgs, &oldmsgs))
- return 0;
- else
- return folder? oldmsgs: newmsgs;
+ ast_log(LOG_WARNING, "Unable to copy message from mailbox %s to mailbox %s\n", vmu->mailbox, recip->mailbox);
+ return -1;
}
#endif
@@ -3241,7 +3303,6 @@
snprintf(tmpdur, sizeof(tmpdur), "%d", duration);
ast_update_realtime("voicemail_data", "id", tmpid, "filename", fn, "duration", tmpdur, NULL);
}
-#ifndef IMAP_STORAGE
/* We must store the file first, before copying the message, because
* ODBC storage does the entire copy with SQL.
*/
@@ -3265,7 +3326,6 @@
free_user(recip);
}
}
-#endif
/* Notification and disposal needs to happen after the copy, though. */
if (ast_fileexists(fn, NULL, NULL)) {
notify_new_message(chan, vmu, msgnum, duration, fmt, S_OR(chan->cid.cid_num, NULL), S_OR(chan->cid.cid_name, NULL));
@@ -3997,15 +4057,17 @@
static void queue_mwi_event(const char *mbox, int new, int old)
{
struct ast_event *event;
- char *mailbox;
+ char *mailbox, *context;
/* Strip off @default */
- mailbox = ast_strdupa(mbox);
- if (strstr(mailbox, "@default"))
- mailbox = strsep(&mailbox, "@");
+ context = mailbox = ast_strdupa(mbox);
+ strsep(&context, "@");
+ if (ast_strlen_zero(context))
+ context = "default";
if (!(event = ast_event_new(AST_EVENT_MWI,
AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, new,
AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, old,
AST_EVENT_IE_END))) {
@@ -4014,6 +4076,7 @@
ast_event_queue_and_cache(event,
AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR,
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR,
AST_EVENT_IE_END);
}
Modified: team/juggie/NoLossCDR/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/channels/chan_iax2.c?view=diff&rev=79087&r1=79086&r2=79087
==============================================================================
--- team/juggie/NoLossCDR/channels/chan_iax2.c (original)
+++ team/juggie/NoLossCDR/channels/chan_iax2.c Fri Aug 10 14:25:39 2007
@@ -6054,9 +6054,16 @@
if (!ast_strlen_zero(p->mailbox)) {
struct ast_event *event;
int new, old;
+ char *mailbox, *context;
+
+ context = mailbox = ast_strdupa(p->mailbox);
+ strsep(&context, "@");
+ if (ast_strlen_zero(context))
+ context = "default";
event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, p->mailbox,
+ AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
AST_EVENT_IE_END);
@@ -9315,8 +9322,14 @@
ast_free_ha(oldha);
if (!ast_strlen_zero(peer->mailbox)) {
+ char *mailbox, *context;
+ mailbox = ast_strdupa(peer->mailbox);
+ strsep(&context, "@");
+ if (ast_strlen_zero(context))
+ context = "default";
peer->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, NULL,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, peer->mailbox,
+ AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
AST_EVENT_IE_END);
}
Modified: team/juggie/NoLossCDR/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/channels/chan_mgcp.c?view=diff&rev=79087&r1=79086&r2=79087
==============================================================================
--- team/juggie/NoLossCDR/channels/chan_mgcp.c (original)
+++ team/juggie/NoLossCDR/channels/chan_mgcp.c Fri Aug 10 14:25:39 2007
@@ -468,9 +468,16 @@
{
int new_msgs;
struct ast_event *event;
+ char *mailbox, *context;
+
+ context = mailbox = ast_strdupa(p->mailbox);
+ strsep(&context, "@");
+ if (ast_strlen_zero(context))
+ context = "default";
event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, p->mailbox,
+ AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
AST_EVENT_IE_END);
@@ -3692,8 +3699,14 @@
ast_copy_string(e->musicclass, musicclass, sizeof(e->musicclass));
ast_copy_string(e->mailbox, mailbox, sizeof(e->mailbox));
if (!ast_strlen_zero(e->mailbox)) {
+ char *mailbox, *context;
+ context = mailbox = ast_strdupa(e->mailbox);
+ strsep(&context, "@");
+ if (ast_strlen_zero(context))
+ context = "default";
e->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, NULL,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, e->mailbox,
+ AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
AST_EVENT_IE_END);
}
Modified: team/juggie/NoLossCDR/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/channels/chan_sip.c?view=diff&rev=79087&r1=79086&r2=79087
==============================================================================
--- team/juggie/NoLossCDR/channels/chan_sip.c (original)
+++ team/juggie/NoLossCDR/channels/chan_sip.c Fri Aug 10 14:25:39 2007
@@ -1226,6 +1226,20 @@
int autoframing;
};
+/*!
+ * \brief A peer's mailbox
+ *
+ * We could use STRINGFIELDS here, but for only two strings, it seems like
+ * too much effort ...
+ */
+struct sip_mailbox {
+ char *mailbox;
+ char *context;
+ /*! Associated MWI subscription */
+ struct ast_event_sub *event_sub;
+ AST_LIST_ENTRY(sip_mailbox) entry;
+};
+
/*! \brief Structure for SIP peer data, we place calls to peers if registered or fixed IP address (host) */
/* XXX field 'name' must be first otherwise sip_addrcmp() will fail */
struct sip_peer {
@@ -1254,7 +1268,6 @@
int busy_level; /*!< Level of active channels where we signal busy */
enum transfermodes allowtransfer; /*! SIP Refer restriction scheme */
char vmexten[AST_MAX_EXTENSION]; /*!< Dialplan extension for MWI notify message*/
- char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox setting for MWI checks */
char language[MAX_LANGUAGE]; /*!< Default language for prompts */
char mohinterpret[MAX_MUSICCLASS];/*!< Music on Hold class */
char mohsuggest[MAX_MUSICCLASS];/*!< Music on Hold class */
@@ -1263,6 +1276,9 @@
int lastmsgssent;
unsigned int sipoptions; /*!< Supported SIP options */
struct ast_flags flags[2]; /*!< SIP_ flags */
+
+ /*! Mailboxes that this peer cares about */
+ AST_LIST_HEAD_NOLOCK(, sip_mailbox) mailboxes;
/* things that don't belong in flags */
char is_realtime; /*!< this is a 'realtime' peer */
@@ -1293,7 +1309,6 @@
struct ast_variable *chanvars; /*!< Variables to set for channel created by user */
struct sip_pvt *mwipvt; /*!< Subscription for MWI */
int autoframing;
- struct ast_event_sub *mwi_event_sub; /*!< The MWI event subscription */
};
@@ -2880,6 +2895,25 @@
}
}
+static void destroy_mailbox(struct sip_mailbox *mailbox)
+{
+ if (mailbox->mailbox)
+ ast_free(mailbox->mailbox);
+ if (mailbox->context)
+ ast_free(mailbox->context);
+ if (mailbox->event_sub)
+ ast_event_unsubscribe(mailbox->event_sub);
+ ast_free(mailbox);
+}
+
+static void clear_peer_mailboxes(struct sip_peer *peer)
+{
+ struct sip_mailbox *mailbox;
+
+ while ((mailbox = AST_LIST_REMOVE_HEAD(&peer->mailboxes, entry)))
+ destroy_mailbox(mailbox);
+}
+
/*! \brief Destroy peer object from memory */
static void sip_destroy_peer(struct sip_peer *peer)
{
@@ -2895,11 +2929,6 @@
if (peer->mwipvt) /* We have an active subscription, delete it */
peer->mwipvt = sip_destroy(peer->mwipvt);
-
- if (peer->mwi_event_sub) {
- ast_event_unsubscribe(peer->mwi_event_sub);
- peer->mwi_event_sub = NULL;
- }
if (peer->chanvars) {
ast_variables_destroy(peer->chanvars);
@@ -2923,6 +2952,7 @@
peer->auth = NULL;
if (peer->dnsmgr)
ast_dnsmgr_release(peer->dnsmgr);
+ clear_peer_mailboxes(peer);
ast_free(peer);
}
@@ -11098,6 +11128,19 @@
return _sip_show_peer(0, fd, NULL, NULL, argc, (const char **) argv);
}
+static void peer_mailboxes_to_str(struct ast_str **mailbox_str, struct sip_peer *peer)
+{
+ struct sip_mailbox *mailbox;
+
+ AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
+ ast_str_append(mailbox_str, 0, "%s%s%s%s",
+ mailbox->mailbox,
+ ast_strlen_zero(mailbox->context) ? "" : "@",
+ S_OR(mailbox->context, ""),
+ AST_LIST_NEXT(mailbox, entry) ? "," : "");
+ }
+}
+
/*! \brief Show one peer in detail (main function) */
static int _sip_show_peer(int type, int fd, struct mansession *s, const struct message *m, int argc, const char *argv[])
{
@@ -11132,6 +11175,7 @@
}
}
if (peer && type==0 ) { /* Normal listing */
+ struct ast_str *mailbox_str = ast_str_alloca(512);
ast_cli(fd,"\n\n");
ast_cli(fd, " * Name : %s\n", peer->name);
if (realtimepeers) { /* Realtime is enabled */
@@ -11159,7 +11203,8 @@
print_group(fd, peer->callgroup, 0);
ast_cli(fd, " Pickupgroup : ");
print_group(fd, peer->pickupgroup, 0);
- ast_cli(fd, " Mailbox : %s\n", peer->mailbox);
+ peer_mailboxes_to_str(&mailbox_str, peer);
+ ast_cli(fd, " Mailbox : %s\n", mailbox_str->str);
ast_cli(fd, " VM Extension : %s\n", peer->vmexten);
ast_cli(fd, " LastMsgsSent : %d/%d\n", (peer->lastmsgssent & 0x7fff0000) >> 16, peer->lastmsgssent & 0xffff);
ast_cli(fd, " Call limit : %d\n", peer->call_limit);
@@ -11234,6 +11279,7 @@
unref_peer(peer);
} else if (peer && type == 1) { /* manager listing */
char buf[256];
+ struct ast_str *mailbox_str = ast_str_alloca(512);
astman_append(s, "Channeltype: SIP\r\n");
astman_append(s, "ObjectName: %s\r\n", peer->name);
astman_append(s, "ChanObjectType: peer\r\n");
@@ -11253,7 +11299,8 @@
astman_append(s, "%s\r\n", ast_print_group(buf, sizeof(buf), peer->callgroup));
astman_append(s, "Pickupgroup: ");
astman_append(s, "%s\r\n", ast_print_group(buf, sizeof(buf), peer->pickupgroup));
- astman_append(s, "VoiceMailbox: %s\r\n", peer->mailbox);
+ peer_mailboxes_to_str(&mailbox_str, peer);
+ astman_append(s, "VoiceMailbox: %s\r\n", mailbox_str->str);
astman_append(s, "TransferMode: %s\r\n", transfermode2str(peer->allowtransfer));
astman_append(s, "LastMsgsSent: %d\r\n", peer->lastmsgssent);
astman_append(s, "Call-limit: %d\r\n", peer->call_limit);
@@ -11656,6 +11703,9 @@
arg->numchans++;
}
if (cur->subscribed != NONE && arg->subscriptions) {
+ struct ast_str *mailbox_str = ast_str_alloca(512);
+ if (cur->subscribed == MWI_NOTIFICATION && cur->relatedpeer)
+ peer_mailboxes_to_str(&mailbox_str, cur->relatedpeer);
ast_cli(arg->fd, FORMAT3, ast_inet_ntoa(dst->sin_addr),
S_OR(cur->username, S_OR(cur->cid_num, "(None)")),
cur->callid,
@@ -11663,7 +11713,7 @@
cur->subscribed == MWI_NOTIFICATION ? "--" : cur->subscribeuri,
cur->subscribed == MWI_NOTIFICATION ? "<none>" : ast_extension_state2str(cur->laststate),
subscription_type2str(cur->subscribed),
- cur->subscribed == MWI_NOTIFICATION ? (cur->relatedpeer ? cur->relatedpeer->mailbox : "<none>") : "<none>"
+ cur->subscribed == MWI_NOTIFICATION ? S_OR(mailbox_str->str, "<none>") : "<none>"
);
arg->numchans++;
}
@@ -12700,7 +12750,9 @@
} else if (!strcasecmp(colname, "useragent")) {
ast_copy_string(buf, peer->useragent, len);
} else if (!strcasecmp(colname, "mailbox")) {
- ast_copy_string(buf, peer->mailbox, len);
+ struct ast_str *mailbox_str = ast_str_alloca(512);
+ peer_mailboxes_to_str(&mailbox_str, peer);
+ ast_copy_string(buf, mailbox_str->str, len);
} else if (!strcasecmp(colname, "context")) {
ast_copy_string(buf, peer->context, len);
} else if (!strcasecmp(colname, "expire")) {
@@ -15595,6 +15647,18 @@
return 1;
}
+static void add_peer_mwi_subs(struct sip_peer *peer)
+{
+ struct sip_mailbox *mailbox;
+
+ AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
+ mailbox->event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, peer,
+ AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox->mailbox,
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, S_OR(mailbox->context, "default"),
+ AST_EVENT_IE_END);
+ }
+}
+
/*! \brief Handle incoming SUBSCRIBE request */
static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, char *e)
{
@@ -15777,7 +15841,7 @@
The subscribed URI needs to exist in the dial plan
In most devices, this is configurable to the voicemailmain extension you use
*/
- if (!authpeer || ast_strlen_zero(authpeer->mailbox)) {
+ if (!authpeer || AST_LIST_EMPTY(&authpeer->mailboxes)) {
transmit_response(p, "404 Not found (no mailbox)", req);
p->needdestroy = 1;
ast_log(LOG_NOTICE, "Received SIP subscribe for peer without mailbox: %s\n", authpeer->name);
@@ -15788,9 +15852,7 @@
p->subscribed = MWI_NOTIFICATION;
if (ast_test_flag(&authpeer->flags[1], SIP_PAGE2_SUBSCRIBEMWIONLY)) {
- authpeer->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, authpeer,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, authpeer->mailbox,
- AST_EVENT_IE_END);
+ add_peer_mwi_subs(authpeer);
}
if (authpeer->mwipvt && authpeer->mwipvt != p) /* Destroy old PVT if this is a new one */
/* We only allow one subscription per peer */
@@ -15827,7 +15889,7 @@
if (sipdebug) {
if (p->subscribed == MWI_NOTIFICATION && p->relatedpeer)
- ast_debug(2, "Adding subscription for mailbox notification - peer %s Mailbox %s\n", p->relatedpeer->name, p->relatedpeer->mailbox);
+ ast_debug(2, "Adding subscription for mailbox notification - peer %s\n", p->relatedpeer->name);
else
ast_debug(2, "Adding subscription for extension %s context %s for peer %s\n", p->exten, p->context, p->username);
}
@@ -16260,13 +16322,39 @@
return 1;
}
+/*!
+ * \brief Get cached MWI info
+ * \retval 0 At least one message is waiting
+ * \retval 1 no messages waiting
+ */
+static int get_cached_mwi(struct sip_peer *peer, int *new, int *old)
+{
+ struct sip_mailbox *mailbox;
+
+ AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
+ struct ast_event *event;
+ event = ast_event_get_cached(AST_EVENT_MWI,
+ AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox->mailbox,
+ AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, S_OR(mailbox->context, "default"),
+ AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
+ AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
+ AST_EVENT_IE_END);
+ if (!event)
+ continue;
+ *new += ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
+ *old += ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
+ ast_event_destroy(event);
+ }
+
+ return (*new || *old) ? 0 : 1;
+}
+
/*! \brief Send message waiting indication to alert peer that they've got voicemail */
static int sip_send_mwi_to_peer(struct sip_peer *peer, const struct ast_event *event, int cache_only)
{
/* Called with peerl lock, but releases it */
struct sip_pvt *p;
int newmsgs = 0, oldmsgs = 0;
- struct ast_event *cache_event = NULL;
if (ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY) && !peer->mwipvt)
return 0;
@@ -16275,24 +16363,18 @@
if (!peer->addr.sin_addr.s_addr && !peer->defaddr.sin_addr.s_addr)
return 0;
- if (!event) {
- /* Check the event cache for the mailbox info */
- event = cache_event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, peer->mailbox,
- AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
- AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
- AST_EVENT_IE_END);
- }
-
if (event) {
newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
oldmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
- if (cache_event)
- ast_event_destroy(cache_event);
+ } else if (!get_cached_mwi(peer, &newmsgs, &oldmsgs)) {
+ /* got it! Don't keep looking. */
} else if (cache_only) {
return 0;
- } else /* Fall back to manually checking the mailbox */
- ast_app_inboxcount(peer->mailbox, &newmsgs, &oldmsgs);
+ } else { /* Fall back to manually checking the mailbox */
+ struct ast_str *mailbox_str = ast_str_alloca(512);
+ peer_mailboxes_to_str(&mailbox_str, peer);
+ ast_app_inboxcount(mailbox_str->str, &newmsgs, &oldmsgs);
+ }
if (peer->mwipvt) {
/* Base message on subscription */
@@ -17232,11 +17314,11 @@
peer->fromdomain[0] = '\0';
peer->fromuser[0] = '\0';
peer->regexten[0] = '\0';
- peer->mailbox[0] = '\0';
peer->callgroup = 0;
peer->pickupgroup = 0;
peer->maxms = default_qualify;
peer->prefs = default_prefs;
+ clear_peer_mailboxes(peer);
}
/*! \brief Create temporary peer (used in autocreatepeer mode) */
@@ -17259,6 +17341,30 @@
reg_source_db(peer);
return peer;
+}
+
[... 781 lines stripped ...]
More information about the asterisk-commits
mailing list