diff options
Diffstat (limited to 'res/res_pjsip')
-rw-r--r-- | res/res_pjsip/config_transport.c | 10 | ||||
-rw-r--r-- | res/res_pjsip/location.c | 1 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_cli.c | 24 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_configuration.c | 4 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_global_headers.c | 4 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_message_filter.c | 18 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_options.c | 55 | ||||
-rw-r--r-- | res/res_pjsip/pjsip_session.c | 1 |
8 files changed, 66 insertions, 51 deletions
diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c index 2f29456ab..a9a90ac92 100644 --- a/res/res_pjsip/config_transport.c +++ b/res/res_pjsip/config_transport.c @@ -917,6 +917,12 @@ static int transport_tls_method_handler(const struct aco_option *opt, struct ast state->tls.method = PJSIP_SSL_UNSPECIFIED_METHOD; } else if (!strcasecmp(var->value, "tlsv1")) { state->tls.method = PJSIP_TLSV1_METHOD; +#ifdef HAVE_PJSIP_TLS_TRANSPORT_PROTO + } else if (!strcasecmp(var->value, "tlsv1_1")) { + state->tls.method = PJSIP_TLSV1_1_METHOD; + } else if (!strcasecmp(var->value, "tlsv1_2")) { + state->tls.method = PJSIP_TLSV1_2_METHOD; +#endif } else if (!strcasecmp(var->value, "sslv2")) { state->tls.method = PJSIP_SSLV2_METHOD; } else if (!strcasecmp(var->value, "sslv3")) { @@ -933,6 +939,10 @@ static int transport_tls_method_handler(const struct aco_option *opt, struct ast static const char *tls_method_map[] = { [PJSIP_SSL_UNSPECIFIED_METHOD] = "unspecified", [PJSIP_TLSV1_METHOD] = "tlsv1", +#ifdef HAVE_PJSIP_TLS_TRANSPORT_PROTO + [PJSIP_TLSV1_1_METHOD] = "tlsv1_1", + [PJSIP_TLSV1_2_METHOD] = "tlsv1_2", +#endif [PJSIP_SSLV2_METHOD] = "sslv2", [PJSIP_SSLV3_METHOD] = "sslv3", [PJSIP_SSLV23_METHOD] = "sslv23", diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c index 2bd40e84f..40490b255 100644 --- a/res/res_pjsip/location.c +++ b/res/res_pjsip/location.c @@ -1347,4 +1347,3 @@ int ast_sip_destroy_sorcery_location(void) return 0; } - diff --git a/res/res_pjsip/pjsip_cli.c b/res/res_pjsip/pjsip_cli.c index 56ec191ed..4544a1717 100644 --- a/res/res_pjsip/pjsip_cli.c +++ b/res/res_pjsip/pjsip_cli.c @@ -82,31 +82,22 @@ int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags) return 0; } -static char *complete_show_sorcery_object(struct ao2_container *container, +static void complete_show_sorcery_object(struct ao2_container *container, struct ast_sip_cli_formatter_entry *formatter_entry, - const char *word, int state) + const char *word) { - char *result = NULL; - int wordlen = strlen(word); - int which = 0; - - struct ao2_iterator i = ao2_iterator_init(container, 0); + size_t wordlen = strlen(word); void *object; + struct ao2_iterator i = ao2_iterator_init(container, 0); while ((object = ao2_t_iterator_next(&i, "iterate thru endpoints table"))) { const char *id = formatter_entry->get_id(object); - if (!strncasecmp(word, id, wordlen) - && ++which > state) { - result = ast_strdup(id); + if (!strncasecmp(word, id, wordlen)) { + ast_cli_completion_add(ast_strdup(id)); } ao2_t_ref(object, -1, "toss iterator endpoint ptr before break"); - if (result) { - break; - } } ao2_iterator_destroy(&i); - - return result; } static void dump_str_and_free(int fd, struct ast_str *buf) @@ -211,7 +202,8 @@ char *ast_sip_cli_traverse_objects(struct ast_cli_entry *e, int cmd, struct ast_ if (cmd == CLI_GENERATE) { ast_free(context.output_buffer); - return complete_show_sorcery_object(container, formatter_entry, a->word, a->n); + complete_show_sorcery_object(container, formatter_entry, a->word); + return NULL; } if (is_container) { diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index 54c6c4929..9aab75b83 100644 --- a/res/res_pjsip/pjsip_configuration.c +++ b/res/res_pjsip/pjsip_configuration.c @@ -1565,8 +1565,8 @@ static int ami_show_endpoint(struct mansession *s, const struct message *m) return 0; } - astman_send_listack(s, m, "Following are Events for each object " - "associated with the the Endpoint", "start"); + astman_send_listack(s, m, "Following are Events for each object associated with the Endpoint", + "start"); /* the endpoint detail needs to always come first so apply as such */ if (format_ami_endpoint(endpoint, &ami) || diff --git a/res/res_pjsip/pjsip_global_headers.c b/res/res_pjsip/pjsip_global_headers.c index 501f5f523..4de28b586 100644 --- a/res/res_pjsip/pjsip_global_headers.c +++ b/res/res_pjsip/pjsip_global_headers.c @@ -55,7 +55,7 @@ struct header { static struct header *alloc_header(const char *name, const char *value) { struct header *alloc; - + alloc = ast_calloc_with_stringfields(1, struct header, 32); if (!alloc) { @@ -139,7 +139,7 @@ static int add_header(struct header_list *headers, const char *name, const char } AST_RWLIST_WRLOCK(headers); - if (replace) { + if (replace) { remove_header(headers, name); } if (to_add) { diff --git a/res/res_pjsip/pjsip_message_filter.c b/res/res_pjsip/pjsip_message_filter.c index 085d9787e..427aec740 100644 --- a/res/res_pjsip/pjsip_message_filter.c +++ b/res/res_pjsip/pjsip_message_filter.c @@ -429,15 +429,27 @@ static pj_bool_t on_rx_process_uris(pjsip_rx_data *rdata) return PJ_TRUE; } - while ((contact = - (pjsip_contact_hdr *) pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, - contact ? contact->next : NULL))) { + + contact = (pjsip_contact_hdr *) pjsip_msg_find_hdr( + rdata->msg_info.msg, PJSIP_H_CONTACT, NULL); + + if (!contact && pjsip_method_creates_dialog(&rdata->msg_info.msg->line.req.method)) { + /* A contact header is required for dialog creating methods */ + static const pj_str_t missing_contact = { "Missing Contact header", 22 }; + pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 400, + &missing_contact, NULL, NULL); + return PJ_TRUE; + } + + while (contact) { if (!contact->star && !is_sip_uri(contact->uri)) { print_uri_debug(URI_TYPE_CONTACT, rdata, (pjsip_hdr *)contact); pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL); return PJ_TRUE; } + contact = (pjsip_contact_hdr *) pjsip_msg_find_hdr( + rdata->msg_info.msg, PJSIP_H_CONTACT, contact->next); } return PJ_FALSE; diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c index d4ea911c9..a0352a6fb 100644 --- a/res/res_pjsip/pjsip_options.c +++ b/res/res_pjsip/pjsip_options.c @@ -1157,7 +1157,24 @@ static int qualify_and_schedule_cb_with_aor(void *obj, void *arg, int flags) static int qualify_and_schedule_cb_without_aor(void *obj, void *arg, int flags) { - qualify_and_schedule_contact((struct ast_sip_contact *) obj); + /* + * These are really dynamic contacts. We need to retrieve the aor associated + * with the contact since it's possible some of the aor's fields were updated + * since last load. + */ + struct ast_sip_contact *contact = obj; + struct ast_sip_aor *aor = ast_sip_location_retrieve_aor(contact->aor); + + if (aor) { + qualify_and_schedule_cb_with_aor(obj, aor, flags); + ao2_ref(aor, -1); + } else { + ast_log(LOG_WARNING, "Unable to locate AOR for contact '%s'. Keeping old " + "associated settings: frequency=%d, timeout=%f, authenticate=%s\n", + contact->uri, contact->qualify_frequency, contact->qualify_timeout, + contact->authenticate_qualify ? "yes" : "no"); + qualify_and_schedule_contact(contact); + } return 0; } @@ -1185,32 +1202,21 @@ static int qualify_and_schedule_all_cb(void *obj, void *arg, int flags) return 0; } -/*! - * \internal - * \brief Unschedule all existing contacts - */ -static int unschedule_all_cb(void *obj, void *arg, int flags) -{ - struct sched_data *data = obj; - - AST_SCHED_DEL_UNREF(sched, data->id, ao2_ref(data, -1)); - - return CMP_MATCH; -} - static void qualify_and_schedule_all(void) { - struct ast_variable *var = ast_variable_new("qualify_frequency >", "0", ""); struct ao2_container *aors; struct ao2_container *contacts; - if (!var) { - return; - } - aors = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), - "aor", AST_RETRIEVE_FLAG_MULTIPLE, var); + /* + * It's possible that the AOR had some of it's fields updated prior to a + * reload. For instance qualifying could have been turned on or off by + * setting the qualify_frequency. Due to this we have to iterate through + * all contacts (static and dynamic), and not just ones where the frequency + * is greater than zero, updating any contact fields with the AOR's values. + */ - ao2_callback(sched_qualifies, OBJ_NODATA | OBJ_MULTIPLE | OBJ_UNLINK, unschedule_all_cb, NULL); + aors = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), + "aor", AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL); if (aors) { ao2_callback(aors, OBJ_NODATA, qualify_and_schedule_all_cb, NULL); @@ -1218,14 +1224,11 @@ static void qualify_and_schedule_all(void) } contacts = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), - "contact", AST_RETRIEVE_FLAG_MULTIPLE, var); + "contact", AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL); if (contacts) { ao2_callback(contacts, OBJ_NODATA, qualify_and_schedule_cb_without_aor, NULL); ao2_ref(contacts, -1); } - - ast_variables_destroy(var); - } int ast_sip_format_contact_ami(void *obj, void *arg, int flags) @@ -1278,7 +1281,7 @@ int ast_sip_format_contact_ami(void *obj, void *arg, int flags) astman_append(ami->s, "%s\r\n", ast_str_buffer(buf)); ami->count++; - + ast_free(buf); ao2_cleanup(status); return 0; diff --git a/res/res_pjsip/pjsip_session.c b/res/res_pjsip/pjsip_session.c index 7460e0a2b..074ec4e0b 100644 --- a/res/res_pjsip/pjsip_session.c +++ b/res/res_pjsip/pjsip_session.c @@ -118,4 +118,3 @@ int ast_sip_session_add_supplements(struct ast_sip_session *session) return 0; } - |