diff options
-rw-r--r-- | apps/app_voicemail.c | 21 | ||||
-rw-r--r-- | channels/chan_pjsip.c | 4 | ||||
-rw-r--r-- | res/res_smdi.c | 10 |
3 files changed, 21 insertions, 14 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 5f8212859..f1b8bd1e1 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -6488,6 +6488,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ int ausemacro = 0; int ousemacro = 0; int ouseexten = 0; + int greeting_only = 0; char tmpdur[16]; char priority[16]; char origtime[16]; @@ -6547,6 +6548,13 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ ast_free(tmp); return res; } + + /* If maxmsg is zero, act as a "greetings only" voicemail: Exit successfully without recording */ + if (vmu->maxmsg == 0) { + greeting_only = 1; + ast_set_flag(options, OPT_SILENT); + } + /* Setup pre-file if appropriate */ if (strcmp(vmu->context, "default")) snprintf(ext_context, sizeof(ext_context), "%s@%s", ext, vmu->context); @@ -6671,12 +6679,6 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ ast_set_flag(options, OPT_SILENT); res = 0; } - /* If maxmsg is zero, act as a "greetings only" voicemail: Exit successfully without recording */ - if (vmu->maxmsg == 0) { - ast_debug(3, "Greetings only VM (maxmsg=0), Skipping voicemail recording\n"); - pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS"); - goto leave_vm_out; - } if (!res && !ast_test_flag(options, OPT_SILENT)) { res = ast_stream_and_wait(chan, INTRO, ecodes); if (res == '#') { @@ -6732,6 +6734,13 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ return res; } + if (greeting_only) { + ast_debug(3, "Greetings only VM (maxmsg=0), Skipping voicemail recording\n"); + pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS"); + res = 0; + goto leave_vm_out; + } + if (res < 0) { free_user(vmu); pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED"); diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index 4a24fa689..677dfd3dd 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -1484,14 +1484,14 @@ static struct topology_change_refresh_data *topology_change_refresh_data_alloc( static int on_topology_change_response(struct ast_sip_session *session, pjsip_rx_data *rdata) { - if (rdata->msg_info.msg->line.status.code == 200) { + if (PJSIP_IS_STATUS_IN_CLASS(rdata->msg_info.msg->line.status.code, 200)) { /* The topology was changed to something new so give notice to what requested * it so it queries the channel and updates accordingly. */ if (session->channel) { ast_queue_control(session->channel, AST_CONTROL_STREAM_TOPOLOGY_CHANGED); } - } else if (rdata->msg_info.msg->line.status.code != 100) { + } else if (300 <= rdata->msg_info.msg->line.status.code) { /* The topology change failed, so drop the current pending media state */ ast_sip_session_media_state_reset(session->pending_media_state); } diff --git a/res/res_smdi.c b/res/res_smdi.c index e2e5b17ba..7f9af5cd5 100644 --- a/res/res_smdi.c +++ b/res/res_smdi.c @@ -608,13 +608,12 @@ static void *smdi_read(void *iface_p) ast_debug(1, "Read a 'D' ... it's an MD message.\n"); - if (!(md_msg = ast_calloc(1, sizeof(*md_msg)))) { + md_msg = ao2_alloc(sizeof(*md_msg), NULL); + if (!md_msg) { ao2_ref(iface, -1); return NULL; } - md_msg = ao2_alloc(sizeof(*md_msg), NULL); - /* read the message desk number */ for (i = 0; i < sizeof(md_msg->mesg_desk_num) - 1; i++) { md_msg->mesg_desk_num[i] = fgetc(iface->file); @@ -710,13 +709,12 @@ static void *smdi_read(void *iface_p) ast_debug(1, "Read a 'W', it's an MWI message. (No more debug coming for MWI messages)\n"); - if (!(mwi_msg = ast_calloc(1, sizeof(*mwi_msg)))) { + mwi_msg = ao2_alloc(sizeof(*mwi_msg), NULL); + if (!mwi_msg) { ao2_ref(iface, -1); return NULL; } - mwi_msg = ao2_alloc(sizeof(*mwi_msg), NULL); - /* discard the 'I' (from 'MWI') */ fgetc(iface->file); |