summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--include/asterisk/res_pjsip.h1
-rw-r--r--res/res_pjsip/pjsip_options.c15
3 files changed, 17 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 8d527d11f..ca216ec4f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -14,6 +14,8 @@
res_pjsip
------------------
+ * Added new status Updated to AMI event ContactStatus on update registration
+
* Added "reg_server" to contacts.
If the Asterisk system name is set in asterisk.conf, it will be stored
into the "reg_server" field in the ps_contacts table to facilitate
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h
index f284702df..f985e3254 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -263,6 +263,7 @@ enum ast_sip_contact_status_type {
UNKNOWN,
CREATED,
REMOVED,
+ UPDATED,
};
/*!
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)