diff options
Diffstat (limited to 'res')
-rw-r--r-- | res/res_clialiases.c | 8 | ||||
-rw-r--r-- | res/res_hep.c | 2 | ||||
-rw-r--r-- | res/res_musiconhold.c | 4 | ||||
-rw-r--r-- | res/res_pjsip.c | 1 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_options.c | 32 | ||||
-rw-r--r-- | res/res_pjsip_session.c | 9 | ||||
-rw-r--r-- | res/res_smdi.c | 44 |
7 files changed, 61 insertions, 39 deletions
diff --git a/res/res_clialiases.c b/res/res_clialiases.c index 1a2fc6939..337c31c97 100644 --- a/res/res_clialiases.c +++ b/res/res_clialiases.c @@ -103,7 +103,7 @@ static char *cli_alias_passthrough(struct ast_cli_entry *e, int cmd, struct ast_ struct cli_alias tmp = { .cli_entry.command = e->command, }; - char *generator; + char *generator = NULL; const char *line; /* Try to find the alias based on the CLI entry */ @@ -118,14 +118,10 @@ static char *cli_alias_passthrough(struct ast_cli_entry *e, int cmd, struct ast_ case CLI_GENERATE: line = a->line; line += (strlen(alias->alias)); - if (!strncasecmp(alias->alias, alias->real_cmd, strlen(alias->alias))) { - generator = NULL; - } else if (!ast_strlen_zero(a->word)) { + if (strncasecmp(alias->alias, alias->real_cmd, strlen(alias->alias))) { struct ast_str *real_cmd = ast_str_alloca(strlen(alias->real_cmd) + strlen(line) + 1); ast_str_append(&real_cmd, 0, "%s%s", alias->real_cmd, line); generator = ast_cli_generator(ast_str_buffer(real_cmd), a->word, a->n); - } else { - generator = ast_cli_generator(alias->real_cmd, a->word, a->n); } ao2_ref(alias, -1); return generator; diff --git a/res/res_hep.c b/res/res_hep.c index 25b4d13b1..ba036d70f 100644 --- a/res/res_hep.c +++ b/res/res_hep.c @@ -421,7 +421,7 @@ int hepv3_is_loaded(void) { RAII_VAR(struct module_config *, config, ao2_global_obj_ref(global_config), ao2_cleanup); - return (config != NULL) ? 1 : 0; + return config && config->general->enabled; } struct hepv3_capture_info *hepv3_create_capture_info(const void *payload, size_t len) diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index ef1b81c2a..17e91b70c 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -333,6 +333,7 @@ static int ast_moh_files_next(struct ast_channel *chan) } } else { state->announcement = 0; + state->samples = 0; } if (!state->class->total_files) { @@ -1934,6 +1935,9 @@ static char *handle_cli_moh_show_classes(struct ast_cli_entry *e, int cmd, struc ast_cli(a->fd, "Class: %s\n", class->name); ast_cli(a->fd, "\tMode: %s\n", S_OR(class->mode, "<none>")); ast_cli(a->fd, "\tDirectory: %s\n", S_OR(class->dir, "<none>")); + if (ast_test_flag(class, MOH_ANNOUNCEMENT)) { + ast_cli(a->fd, "\tAnnouncement: %s\n", S_OR(class->announcement, "<none>")); + } if (ast_test_flag(class, MOH_CUSTOM)) { ast_cli(a->fd, "\tApplication: %s\n", S_OR(class->args, "<none>")); ast_cli(a->fd, "\tKill Escalation Delay: %zu ms\n", class->kill_delay / 1000); diff --git a/res/res_pjsip.c b/res/res_pjsip.c index 21e43f073..b50ee5fc7 100644 --- a/res/res_pjsip.c +++ b/res/res_pjsip.c @@ -2282,6 +2282,7 @@ <enumlist> <enum name="Reachable"/> <enum name="Unreachable"/> + <enum name="NonQualified"/> </enumlist> </parameter> <parameter name="RoundtripUsec"> diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c index fbe07d53d..f9df2f0a5 100644 --- a/res/res_pjsip/pjsip_options.c +++ b/res/res_pjsip/pjsip_options.c @@ -41,7 +41,7 @@ static const char *status_map [] = { [UNAVAILABLE] = "Unreachable", [AVAILABLE] = "Reachable", [UNKNOWN] = "Unknown", - [CREATED] = "Created", + [CREATED] = "NonQualified", [REMOVED] = "Removed", }; @@ -49,7 +49,7 @@ static const char *short_status_map [] = { [UNAVAILABLE] = "Unavail", [AVAILABLE] = "Avail", [UNKNOWN] = "Unknown", - [CREATED] = "Created", + [CREATED] = "NonQual", [REMOVED] = "Removed", }; @@ -205,24 +205,12 @@ static void update_contact_status(const struct ast_sip_contact *contact, return; } - if (is_contact_refresh - && status->status == CREATED) { - /* - * The contact status hasn't been updated since creation - * and we don't want to re-send a created status. - */ - if (contact->qualify_frequency - || status->rtt_start.tv_sec > 0) { - /* Ignore, the status will change soon. */ - return; - } - - /* - * Convert to a regular contact status update - * because the status may never change. - */ - is_contact_refresh = 0; - value = UNKNOWN; + /* + * If the current status is CREATED, and it's a refresh or the given value is + * also CREATED then there is nothing to update as nothing needs to change. + */ + if (status->status == CREATED && (is_contact_refresh || status->status == value)) { + return; } update = ast_sorcery_alloc(ast_sip_get_sorcery(), CONTACT_STATUS, @@ -595,7 +583,7 @@ static void qualify_and_schedule(struct ast_sip_contact *contact) schedule_qualify(contact, contact->qualify_frequency * 1000); } else { - update_contact_status(contact, UNKNOWN, 0); + update_contact_status(contact, CREATED, 0); } } @@ -1127,7 +1115,7 @@ static void qualify_and_schedule_contact(struct ast_sip_contact *contact) if (contact->qualify_frequency) { schedule_qualify(contact, initial_interval); } else { - update_contact_status(contact, UNKNOWN, 0); + update_contact_status(contact, CREATED, 0); } } diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 55b91208a..958f2254b 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -3878,10 +3878,15 @@ static struct pjmedia_sdp_session *create_local_sdp(pjsip_inv_session *inv, stru if (!session->pending_media_state->topology || !ast_stream_topology_get_count(session->pending_media_state->topology)) { /* We've encountered a situation where we have been told to create a local SDP but noone has given us any indication - * of what kind of stream topology they would like. As a fallback we use the topology from the configured endpoint. + * of what kind of stream topology they would like. We try to not alter the current state of the SDP negotiation + * by using what is currently negotiated. If this is unavailable we fall back to what is configured on the endpoint. */ ast_stream_topology_free(session->pending_media_state->topology); - session->pending_media_state->topology = ast_stream_topology_clone(session->endpoint->media.topology); + if (session->active_media_state->topology) { + session->pending_media_state->topology = ast_stream_topology_clone(session->active_media_state->topology); + } else { + session->pending_media_state->topology = ast_stream_topology_clone(session->endpoint->media.topology); + } if (!session->pending_media_state->topology) { return NULL; } diff --git a/res/res_smdi.c b/res/res_smdi.c index 0edabb83c..054e6aab6 100644 --- a/res/res_smdi.c +++ b/res/res_smdi.c @@ -586,9 +586,8 @@ static void *smdi_read(void *iface_p) struct ast_smdi_interface *iface = iface_p; struct ast_smdi_md_message *md_msg; struct ast_smdi_mwi_message *mwi_msg; - char c = '\0'; char *cp = NULL; - int i; + int i, c; int start = 0; /* read an smdi message */ @@ -616,7 +615,14 @@ static void *smdi_read(void *iface_p) /* 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); + c = fgetc(iface->file); + if (c == EOF) { + ast_log(LOG_ERROR, "Unexpected EOF while reading MD message\n"); + ao2_ref(md_msg, -1); + ao2_ref(iface, -1); + return NULL; + } + md_msg->mesg_desk_num[i] = (char) c; ast_debug(1, "Read a '%c'\n", md_msg->mesg_desk_num[i]); } @@ -626,7 +632,14 @@ static void *smdi_read(void *iface_p) /* read the message desk terminal number */ for (i = 0; i < sizeof(md_msg->mesg_desk_term) - 1; i++) { - md_msg->mesg_desk_term[i] = fgetc(iface->file); + c = fgetc(iface->file); + if (c == EOF) { + ast_log(LOG_ERROR, "Unexpected EOF while reading SMDI message\n"); + ao2_ref(md_msg, -1); + ao2_ref(iface, -1); + return NULL; + } + md_msg->mesg_desk_term[i] = (char) c; ast_debug(1, "Read a '%c'\n", md_msg->mesg_desk_term[i]); } @@ -635,7 +648,14 @@ static void *smdi_read(void *iface_p) ast_debug(1, "The message desk terminal is '%s'\n", md_msg->mesg_desk_term); /* read the message type */ - md_msg->type = fgetc(iface->file); + c = fgetc(iface->file); + if (c == EOF) { + ast_log(LOG_ERROR, "Unexpected EOF while reading SMDI message\n"); + ao2_ref(md_msg, -1); + ao2_ref(iface, -1); + return NULL; + } + md_msg->type = (char) c; ast_debug(1, "Message type is '%c'\n", md_msg->type); @@ -717,7 +737,7 @@ static void *smdi_read(void *iface_p) /* discard the 'I' (from 'MWI') */ fgetc(iface->file); - + /* read the forwarding station number (may be blank) */ cp = &mwi_msg->fwd_st[0]; for (i = 0; i < sizeof(mwi_msg->fwd_st) - 1; i++) { @@ -740,8 +760,16 @@ static void *smdi_read(void *iface_p) ast_copy_string(mwi_msg->name, mwi_msg->fwd_st, sizeof(mwi_msg->name)); /* read the mwi failure cause */ - for (i = 0; i < sizeof(mwi_msg->cause) - 1; i++) - mwi_msg->cause[i] = fgetc(iface->file); + for (i = 0; i < sizeof(mwi_msg->cause) - 1; i++) { + c = fgetc(iface->file); + if (c == EOF) { + ast_log(LOG_ERROR, "Unexpected EOF while reading MWI message\n"); + ao2_ref(mwi_msg, -1); + ao2_ref(iface, -1); + return NULL; + } + mwi_msg->cause[i] = (char) c; + } mwi_msg->cause[sizeof(mwi_msg->cause) - 1] = '\0'; |