res_pjsip_exten_state: Create PUBLISH messages.

Create PUBLISH messages to update a third party when an extension state
changes because of either a device or presence state change.

A configuration example:

[exten-state-publisher]
type=outbound-publish
server_uri=sip:instance1@172.16.10.2
event=presence
; Optional regex for context filtering, if specified only extension state
; for contexts matching the regex will cause a PUBLISH to be sent.
@context=^users
; Optional regex for extension filtering, if specified only extension
; state for extensions matching the regex will cause a PUBLISH to be sent.
@exten=^[0-9]*
; Required body type for the PUBLISH message.
;
; Supported values are:
; application/pidf+xml
; application/xpidf+xml
; application/cpim-pidf+xml
; application/dialog-info+xml (Planned support but not yet)
@body=application/pidf+xml

The '@' extended variables are used because the implementation can't
extend the outbound publish type as it is provided by the outbound publish
module.  That means you either have to use extended variables, or
implement some sort of custom extended variable thing in the outbound
publish module.  Another option would be to refactor that stuff to have an
option which specifies the use of an alternate implementation's
configuration and then have that passed to the implementation.  JColp
opted for the extended variables method originally.

ASTERISK-25972 #close

Change-Id: Ic0dab4022f5cf59302129483ed38398764ee3cca
This commit is contained in:
Richard Mudgett
2016-04-27 17:19:53 -05:00
parent bc19d9a2b0
commit 2c46063d54
3 changed files with 215 additions and 1 deletions

View File

@@ -92,6 +92,28 @@ void ast_sip_unregister_event_publisher_handler(struct ast_sip_event_publisher_h
*/
struct ast_sip_outbound_publish_client *ast_sip_publish_client_get(const char *name);
/*!
* \brief Get the From URI the client will use.
* \since 14.0.0
*
* \param client The publication client to get the From URI
*
* \retval From-uri on success
* \retval Empty-string on failure
*/
const char *ast_sip_publish_client_get_from_uri(struct ast_sip_outbound_publish_client *client);
/*!
* \brief Get the To URI the client will use.
* \since 14.0.0
*
* \param client The publication client to get the To URI
*
* \retval From-uri on success
* \retval Empty-string on failure
*/
const char *ast_sip_publish_client_get_to_uri(struct ast_sip_outbound_publish_client *client);
/*!
* \brief Alternative for ast_datastore_alloc()
*