mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	res_pjsip: Updates and adds more PJSIP CLI commands.
* Adds identify, transport, and registration support to the PJSIP CLI. * Creates three additional callbacks, one for an iterator, one for a comparator, and one for a container. This eliminates the link dependency from higher level modules to lower level ones. * Eliminates duplicate sorting in PJSIP CLI commands. * Cleans up PJSIP CLI output formatting. * Pushes CLI command registration down to the implementing source file. * Adds several ast_sip_destroy_sorcery functions to complement existing ast_sip_sorcery_initialize functions. The destroy functions unregister PJSIP CLI commands and PJSIP CLI formatters. Reported by: George Joseph Review: https://reviewboard.asterisk.org/r/3104/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@407568 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -218,17 +218,6 @@ struct ast_sip_aor { | ||||
| 	unsigned int support_path; | ||||
| }; | ||||
|  | ||||
| /*! | ||||
|  * \brief Aor/Contact pair used for ast_sip_for_each_contact callback. | ||||
|  */ | ||||
| struct ast_sip_aor_contact_pair { | ||||
| 	SORCERY_OBJECT(details); | ||||
| 	/*! Aor */ | ||||
| 	struct ast_sip_aor *aor; | ||||
| 	/*! Contact */ | ||||
| 	struct ast_sip_contact *contact; | ||||
| }; | ||||
|  | ||||
| /*! | ||||
|  * \brief DTMF modes for SIP endpoints | ||||
|  */ | ||||
| @@ -827,32 +816,42 @@ struct ast_sorcery *ast_sip_get_sorcery(void); | ||||
| /*! | ||||
|  * \brief Initialize transport support on a sorcery instance | ||||
|  * | ||||
|  * \param sorcery The sorcery instance | ||||
|  * \retval -1 failure | ||||
|  * \retval 0 success | ||||
|  */ | ||||
| int ast_sip_initialize_sorcery_transport(void); | ||||
|  | ||||
| /*! | ||||
|  * \brief Destroy transport support on a sorcery instance | ||||
|  * | ||||
|  * \retval -1 failure | ||||
|  * \retval 0 success | ||||
|  */ | ||||
| int ast_sip_initialize_sorcery_transport(struct ast_sorcery *sorcery); | ||||
| int ast_sip_destroy_sorcery_transport(void); | ||||
|  | ||||
| /*! | ||||
|  * \brief Initialize qualify support on a sorcery instance | ||||
|  * | ||||
|  * \param sorcery The sorcery instance | ||||
|  * | ||||
|  * \retval -1 failure | ||||
|  * \retval 0 success | ||||
|  */ | ||||
| int ast_sip_initialize_sorcery_qualify(struct ast_sorcery *sorcery); | ||||
| int ast_sip_initialize_sorcery_qualify(void); | ||||
|  | ||||
| /*! | ||||
|  * \brief Initialize location support on a sorcery instance | ||||
|  * | ||||
|  * \param sorcery The sorcery instance | ||||
|  * \retval -1 failure | ||||
|  * \retval 0 success | ||||
|  */ | ||||
| int ast_sip_initialize_sorcery_location(void); | ||||
|  | ||||
| /*! | ||||
|  * \brief Destroy location support on a sorcery instance | ||||
|  * | ||||
|  * \retval -1 failure | ||||
|  * \retval 0 success | ||||
|  */ | ||||
| int ast_sip_initialize_sorcery_location(struct ast_sorcery *sorcery); | ||||
| int ast_sip_destroy_sorcery_location(void); | ||||
|  | ||||
| /*! | ||||
|  * \brief Retrieve a named AOR | ||||
| @@ -939,22 +938,26 @@ int ast_sip_location_delete_contact(struct ast_sip_contact *contact); | ||||
| /*! | ||||
|  * \brief Initialize domain aliases support on a sorcery instance | ||||
|  * | ||||
|  * \param sorcery The sorcery instance | ||||
|  * | ||||
|  * \retval -1 failure | ||||
|  * \retval 0 success | ||||
|  */ | ||||
| int ast_sip_initialize_sorcery_domain_alias(struct ast_sorcery *sorcery); | ||||
| int ast_sip_initialize_sorcery_domain_alias(void); | ||||
|  | ||||
| /*! | ||||
|  * \brief Initialize authentication support on a sorcery instance | ||||
|  * | ||||
|  * \param sorcery The sorcery instance | ||||
|  * \retval -1 failure | ||||
|  * \retval 0 success | ||||
|  */ | ||||
| int ast_sip_initialize_sorcery_auth(void); | ||||
|  | ||||
| /*! | ||||
|  * \brief Destroy authentication support on a sorcery instance | ||||
|  * | ||||
|  * \retval -1 failure | ||||
|  * \retval 0 success | ||||
|  */ | ||||
| int ast_sip_initialize_sorcery_auth(struct ast_sorcery *sorcery); | ||||
| int ast_sip_destroy_sorcery_auth(void); | ||||
|  | ||||
| /*! | ||||
|  * \brief Callback called when an outbound request with authentication credentials is to be sent in dialog | ||||
| @@ -1556,7 +1559,7 @@ void ast_sip_destroy_global_headers(void); | ||||
| int ast_sip_add_global_request_header(const char *name, const char *value, int replace); | ||||
| int ast_sip_add_global_response_header(const char *name, const char *value, int replace); | ||||
|  | ||||
| int ast_sip_initialize_sorcery_global(struct ast_sorcery *sorcery); | ||||
| int ast_sip_initialize_sorcery_global(void); | ||||
|  | ||||
| /*! | ||||
|  * \brief Retrieves the value associated with the given key. | ||||
| @@ -1621,7 +1624,7 @@ void *ast_sip_dict_set(pj_pool_t* pool, void *ht, | ||||
|  * \param arg user data passed to handler | ||||
|  * \retval 0 Success, non-zero on failure | ||||
|  */ | ||||
| int ast_sip_for_each_contact(struct ast_sip_aor *aor, | ||||
| int ast_sip_for_each_contact(const struct ast_sip_aor *aor, | ||||
| 		ao2_callback_fn on_contact, void *arg); | ||||
|  | ||||
| /*! | ||||
|   | ||||
| @@ -19,6 +19,8 @@ | ||||
| #ifndef RES_PJSIP_CLI_H_ | ||||
| #define RES_PJSIP_CLI_H_ | ||||
|  | ||||
| #include "asterisk/cli.h" | ||||
|  | ||||
| #define CLI_HEADER_FILLER ".........................................................................................." | ||||
| #define CLI_DETAIL_FILLER "                                                                                          " | ||||
| #define CLI_MAX_WIDTH 90 | ||||
| @@ -54,7 +56,9 @@ struct ast_sip_cli_formatter_entry { | ||||
| 	const char *name; | ||||
| 	ao2_callback_fn *print_header; | ||||
| 	ao2_callback_fn *print_body; | ||||
| 	struct ao2_container *(* get_container)(struct ast_sorcery *); | ||||
| 	struct ao2_container *(* get_container)(void); | ||||
| 	int (* iterator)(const void *container, ao2_callback_fn callback, void *args); | ||||
| 	ao2_sort_fn *comparator; | ||||
| }; | ||||
|  | ||||
| /*! | ||||
| @@ -91,5 +95,7 @@ struct ast_sip_cli_formatter_entry *ast_sip_lookup_cli_formatter(const char *nam | ||||
|  */ | ||||
| int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags); | ||||
|  | ||||
| char *ast_sip_cli_traverse_objects(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); | ||||
|  | ||||
|  | ||||
| #endif /* RES_PJSIP_CLI_H_ */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user