Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app_voicemail - add manager actions to display and manipulate messages #182

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

mbradeen
Copy link
Contributor

@mbradeen mbradeen commented Jun 29, 2023

Adds manager actions to allow move/remove/forward individual messages in a particular mailbox folder. The forward command can be used to copy a message within a mailbox or to another mailbox. Also adds a VoicemailBoxSummarry, required to retrieve message ID's.

Resolves: #181

UserNote: The following manager actions have been added

VoicemailBoxSummary - Generate message list for a given mailbox

VoicemailRemove - Remove a message from a mailbox folder

VoicemailMove - Move a message from one folder to another within a mailbox

VoicemailForward - Copy a message from one folder in one mailbox
to another folder in another or the same mailbox.

@asterisk-org-access-app asterisk-org-access-app bot requested a review from a team June 29, 2023 18:27
@asterisk-org-access-app
Copy link

REMINDER: If this PR applies to other branches, please add a comment with the appropriate "cherry-pick-to" headers as per the Create a Pull Request process.

If you don't want it cherry-picked, please add a comment stating "No cherry-picks required" so we don't keep asking.

If, after adding "cherry-pick-to" comments, you change your mind, please edit the comment to DELETE the header lines and add "No cherry-picks required".

@mbradeen
Copy link
Contributor Author

cherry-pick-to: 20
cherry-pick-to: 18
cherry-pick-to: certified/18.9

@mbradeen mbradeen changed the title Adds manager actions to allow move/remove/forward individual messages in a particular mailbox folder. The forward command can be used to copy a message within a mailbox or to another mailbox. Also adds a VoicemailBoxSummarry, required to retrieve message ID's. app_voicemail - add manager actions to display and manipulate messages Jun 29, 2023
@mbradeen
Copy link
Contributor Author

mbradeen commented Jun 30, 2023

Example commands and output:
Get mailbox contents-

'VoicemailBoxSummary',
  Context='default',
  Mailbox='1000'
Response: Success
ActionID: 1
EventList: start
Message: Voicemail box detail will follow

Event : VoicemailBoxDetail -> {'ActionID': '1', 'Folder': 'INBOX', 'CallerID': '"Carrot" <1002>', 'Date': 'Tue Jun 20 03:59:44 PM UTC 2023', 'Duration': '0', 'Flag': '', 'ID': '1687276784-00000001'}
Event : VoicemailBoxDetail -> {'ActionID': '1', 'Folder': 'Old', 'CallerID': '"Carrot" <1002>', 'Date': 'Tue Jun 20 03:59:11 PM UTC 2023', 'Duration': '0', 'Flag': '', 'ID': '1687276751-00000000'}
Event : VoicemailBoxDetail -> {'ActionID': '1', 'Folder': 'Work', 'CallerID': '"Carrot" <1002>', 'Date': 'Tue Jun 20 04:00:03 PM UTC 2023', 'Duration': '0', 'Flag': '', 'ID': '1687276803-00000002'}
Event : VoicemailBoxDetailComplete -> {'ActionID': '1', 'EventList': 'Complete', 'ListItems': '3'}

Move a message from 'Urgent' to 'Inbox'

'VoicemailMove',
  Context='default',
  Mailbox='1000',
  Folder='Urgent',
  ID='1687276784-00000011',
  ToFolder='INBOX'
Response: Success
ActionID: 1
Message: Message move successful

Event : MessageWaiting -> {'Privilege': 'call,all', 'SequenceNumber': '12', 'File': 'manager_mwi.c', 'Line': '136', 'Func': 'mwi_update_cb', 'Mailbox': '1000@default', 'Waiting': '1', 'New': '1', 'Old': '1'}

struct ast_vm_msg_snapshot *msg;
int n = 0;

if((s == NULL) || (vmu == NULL) || (event_name == NULL) || (actionid == NULL)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't conform to our coding guidelines

int n = 0;

if((s == NULL) || (vmu == NULL) || (event_name == NULL) || (actionid == NULL)) {
ast_log(LOG_ERROR, "Wrong input parameter.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not useful as an error message within the content of this work

}

/* Take a snapshot of the mailbox and walk through each folder's contents */
if ((mailbox_snapshot = ast_vm_mailbox_snapshot_create(vmu->mailbox, vmu->context, NULL, 0, AST_VM_SNAPSHOT_SORT_BY_ID, 0))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduce indentation by returning -1 early if no mailbox snapshot

apps/app_voicemail.c Show resolved Hide resolved
apps/app_voicemail.c Show resolved Hide resolved
apps/app_voicemail.c Show resolved Hide resolved
/* walk through user's mailbox and append info for each message */
nummessages = append_vmbox_info_astman(s, vmu, "VoicemailBoxDetail", actionid);
if(nummessages < 0) {
ast_log(LOG_ERROR, "Could not append voicemail box info.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't contain enough information to be useful, such as the mailbox and context


/* walk through user's mailbox and append info for each message */
nummessages = append_vmbox_info_astman(s, vmu, "VoicemailBoxDetail", actionid);
if(nummessages < 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (nummessages < 0) {

nummessages = append_vmbox_info_astman(s, vmu, "VoicemailBoxDetail", actionid);
if(nummessages < 0) {
ast_log(LOG_ERROR, "Could not append voicemail box info.");
nummessages = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this fails part way through, what will the result be? Some details sent, but a total messages count of 0?

in a particular mailbox folder. The forward command can be used
to copy a message within a mailbox or to another mailbox. Also adds
a VoicemailBoxSummarry, required to retrieve message ID's.

Resolves: asterisk#181

UserNote: The following manager actions have been added

VoicemailBoxSummary - Generate message list for a given mailbox

VoicemailRemove - Remove a message from a mailbox folder

VoicemailMove - Move a message from one folder to another within a mailbox

VoicemailForward - Copy a message from one folder in one mailbox
to another folder in another or the same mailbox.
@gtjoseph gtjoseph added the cherry-pick-test Trigger dry run of cherry-picks label Jul 12, 2023
@github-actions github-actions bot added cherry-pick-testing-in-progress Cherry-Pick tests in progress cherry-pick-checks-passed Cherry-Pick checks passed cherry-pick-gates-failed Cherry-Pick gates failed and removed cherry-pick-test Trigger dry run of cherry-picks cherry-pick-testing-in-progress Cherry-Pick tests in progress labels Jul 12, 2023
@github-actions
Copy link

Successfully merged to branch master and cherry-picked to ["20","18","certified/18.9"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[improvement]: app_voicemail - add manager actions to display and manipulate messages
3 participants