<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/5904">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_voicemail: IMAP connection control<br><br>A new global option "imap_poll_logout" was added to specify whether need to<br>disconnect from the IMAP server after polling of mailboxes.<br><br>ASTERISK-27068 #close<br><br>Closing IMAP connection after loading mailbox from voicemail.conf<br><br>ASTERISK-24052 #close<br><br>Change-Id: Ib7558ba04516240a32b65f42e9be64372a0ae12a<br>---<br>M CHANGES<br>M apps/app_voicemail.c<br>M configs/samples/voicemail.conf.sample<br>3 files changed, 26 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/CHANGES b/CHANGES<br>index 3107630..7cf3f8a 100644<br>--- a/CHANGES<br>+++ b/CHANGES<br>@@ -12,6 +12,12 @@<br> --- Functionality changes from Asterisk 14.5.0 to Asterisk 14.6.0 ------------<br> ------------------------------------------------------------------------------<br> <br>+app_voicemail<br>+------------------<br>+ * A new global option "imap_poll_logout" was added to specify whether need to<br>+ disconnect from the IMAP server after polling of mailboxes.<br>+ Default: no<br>+<br> res_pjsip<br> ------------------<br> * A new endpoint option "refer_blind_progress" was added to turn off notifying<br>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c<br>index 2c14439..13ddb13 100644<br>--- a/apps/app_voicemail.c<br>+++ b/apps/app_voicemail.c<br>@@ -507,6 +507,7 @@<br> <br> static int expungeonhangup = 1;<br> static int imapgreetings = 0;<br>+static int imap_poll_logout = 0;<br> static char delimiter = '\0';<br> <br> /* mail_open cannot be protected on a stream basis */<br>@@ -544,6 +545,8 @@<br> static int imap_delete_old_greeting (char *dir, struct vm_state *vms);<br> static void check_quota(struct vm_state *vms, char *mailbox);<br> static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box);<br>+static void imap_logout(const char *mailbox_id);<br>+<br> struct vmstate {<br> struct vm_state *vms;<br> AST_LIST_ENTRY(vmstate) list;<br>@@ -12305,6 +12308,9 @@<br> strcat(mailbox_full, context);<br> <br> inboxcount2(mailbox_full, &urgent, &new, &old);<br>+#ifdef IMAP_STORAGE<br>+ imap_logout(mailbox_full);<br>+#endif<br> queue_mwi_event(NULL, mailbox_full, urgent, new, old);<br> <br> return 0;<br>@@ -13057,6 +13063,12 @@<br> <br> inboxcount2(mwi_sub->mailbox, &urgent, &new, &old);<br> <br>+#ifdef IMAP_STORAGE<br>+ if (imap_poll_logout) {<br>+ imap_logout(mwi_sub->mailbox);<br>+ }<br>+#endif<br>+<br> if (urgent != mwi_sub->old_urgent || new != mwi_sub->old_new || old != mwi_sub->old_old) {<br> mwi_sub->old_urgent = urgent;<br> mwi_sub->old_new = new;<br>@@ -13777,6 +13789,11 @@<br> } else {<br> ast_copy_string(greetingfolder, imapfolder, sizeof(greetingfolder));<br> }<br>+ if ((val = ast_variable_retrieve(cfg, "general", "imap_poll_logout"))) {<br>+ imap_poll_logout = ast_true(val);<br>+ } else {<br>+ imap_poll_logout = 0;<br>+ }<br> <br> /* There is some very unorthodox casting done here. This is due<br> * to the way c-client handles the argument passed in. It expects a <br>diff --git a/configs/samples/voicemail.conf.sample b/configs/samples/voicemail.conf.sample<br>index f8221ee..84e83a3 100644<br>--- a/configs/samples/voicemail.conf.sample<br>+++ b/configs/samples/voicemail.conf.sample<br>@@ -227,6 +227,9 @@<br> ;imapclosetimeout=60 ; The TCP close timeout (in seconds)<br> ;imapreadtimeout=60 ; The TCP read timeout (in seconds)<br> ;imapwritetimeout=60 ; The TCP write timeout (in seconds)<br>+;imap_poll_logout=no ; If pollmailboxes=yes, then specify whether need to<br>+ ; disconnect from the IMAP server after polling.<br>+ ; Default: no<br> <br> ; -----------------------------------------------------------------------------<br> ;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/5904">change 5904</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/5904"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 14 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ib7558ba04516240a32b65f42e9be64372a0ae12a </div>
<div style="display:none"> Gerrit-Change-Number: 5904 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>