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

@@ -425,6 +425,20 @@ struct ast_sip_outbound_publish_client *ast_sip_publish_client_get(const char *n
return state->client;
}
const char *ast_sip_publish_client_get_from_uri(struct ast_sip_outbound_publish_client *client)
{
struct ast_sip_outbound_publish *publish = client->publish;
return S_OR(publish->from_uri, S_OR(publish->server_uri, ""));
}
const char *ast_sip_publish_client_get_to_uri(struct ast_sip_outbound_publish_client *client)
{
struct ast_sip_outbound_publish *publish = client->publish;
return S_OR(publish->to_uri, S_OR(publish->server_uri, ""));
}
int ast_sip_register_event_publisher_handler(struct ast_sip_event_publisher_handler *handler)
{
struct ast_sip_event_publisher_handler *existing;