summaryrefslogtreecommitdiff
path: root/res/res_pjsip
diff options
context:
space:
mode:
authorAlexei Gradinari <alex2grad@gmail.com>2016-04-07 17:33:49 -0400
committerAlexei Gradinari <alex2grad@gmail.com>2016-05-03 17:35:27 -0400
commit7a14e669f073d6845ce4c13e8537b87fa4f3b042 (patch)
tree4a120824bf64d9bcba43598c543914948725ac07 /res/res_pjsip
parent3677409116d0ad2e638fcc2cdcf5134a2850d8ae (diff)
res_pjsip/AMI: add contact.updated event
With the old SIP module AMI sends PeerStatus event on every successfully REGISTER requests, ie, on start registration, update registration and stop registration. With PJSIP AMI sends ContactStatus only when status is changed. Regarding registration: on start registration - Created on stop registration - Removed but on update registration nothing This patch added contact.updated event. ASTERISK-25904 Change-Id: I8fad8aae9305481469c38d2146e1ba3a56d3108f
Diffstat (limited to 'res/res_pjsip')
-rw-r--r--res/res_pjsip/pjsip_options.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c
index b8d38ed42..f832e6f78 100644
--- a/res/res_pjsip/pjsip_options.c
+++ b/res/res_pjsip/pjsip_options.c
@@ -42,6 +42,7 @@ static const char *status_map [] = {
[UNKNOWN] = "Unknown",
[CREATED] = "Created",
[REMOVED] = "Removed",
+ [UPDATED] = "Updated",
};
static const char *short_status_map [] = {
@@ -50,6 +51,7 @@ static const char *short_status_map [] = {
[UNKNOWN] = "Unknown",
[CREATED] = "Created",
[REMOVED] = "Removed",
+ [UPDATED] = "Updated",
};
const char *ast_sip_get_contact_status_label(const enum ast_sip_contact_status_type status)
@@ -543,6 +545,16 @@ static void contact_created(const void *obj)
/*!
* \internal
+ * \brief A contact has been updated.
+ */
+static void contact_updated(const void *obj)
+{
+ update_contact_status((struct ast_sip_contact *) obj, UPDATED);
+ qualify_and_schedule((struct ast_sip_contact *) obj);
+}
+
+/*!
+ * \internal
* \brief A contact has been deleted remove status tracking.
*/
static void contact_deleted(const void *obj)
@@ -567,7 +579,8 @@ static void contact_deleted(const void *obj)
static const struct ast_sorcery_observer contact_observer = {
.created = contact_created,
- .deleted = contact_deleted
+ .deleted = contact_deleted,
+ .updated = contact_updated
};
static pj_bool_t options_start(void)