diff options
author | Richard Mudgett <rmudgett@digium.com> | 2016-04-26 16:10:26 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-04-28 17:14:44 -0500 |
commit | 0b5292525cce32e9944b02b17748c4c7ec89ede3 (patch) | |
tree | 8023167a88d5b5159ba7c05a497d0c07b20f989c /res | |
parent | 057ed94048b591a74322bbdb152e65f567091518 (diff) |
res_pjsip_exten_state: Check if body generator is available.
When starting the extension state publishers, check if the requested
message body generator is available. If not available give error message
and skip starting that publisher.
* res_pjsip_pubsub.c: Create new API if type/subtype generator
registered.
* res_pjsip_exten_state.c: Use new body generator API for validation.
ASTERISK-25922
Change-Id: I4ad69200666e3cc909d4619e3c81042d7f9db25c
Diffstat (limited to 'res')
-rw-r--r-- | res/res_pjsip_exten_state.c | 6 | ||||
-rw-r--r-- | res/res_pjsip_pubsub.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/res/res_pjsip_exten_state.c b/res/res_pjsip_exten_state.c index 1f8b121e8..e84a25c6a 100644 --- a/res/res_pjsip_exten_state.c +++ b/res/res_pjsip_exten_state.c @@ -680,6 +680,12 @@ static int publisher_start(struct ast_sip_outbound_publish *configuration, struc return -1; } + if (!ast_sip_pubsub_is_body_generator_registered(body_type, body_subtype)) { + ast_log(LOG_ERROR, "Outbound extension state publisher '%s': '%s' body generator not registered\n", + name, body_full); + return -1; + } + name_size = strlen(name) + 1; body_type_size = strlen(body_type) + 1; body_subtype_size = strlen(body_subtype) + 1; diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index 141c2fcf4..dca2e3109 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -3086,6 +3086,11 @@ const char *ast_sip_publication_get_event_configuration(const struct ast_sip_pub return pub->event_configuration_name; } +int ast_sip_pubsub_is_body_generator_registered(const char *type, const char *subtype) +{ + return !!find_body_generator_type_subtype(type, subtype); +} + int ast_sip_pubsub_register_body_generator(struct ast_sip_pubsub_body_generator *generator) { struct ast_sip_pubsub_body_generator *existing; |