[asterisk-commits] jbigelow: trunk r396552 - /trunk/res/res_pjsip_registrar.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Aug 12 17:05:22 CDT 2013
Author: jbigelow
Date: Mon Aug 12 17:05:18 2013
New Revision: 396552
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396552
Log:
Add test suite events for when contacts are added or removed from an AOR
These are needed by the pjsip inbound registration test suite tests.
(issue ASTERISK-21833)
(issue ASTERISK-21834)
(issue ASTERISK-21835)
(issue ASTERISK-21837)
Review: https://reviewboard.asterisk.org/r/2700/
Review: https://reviewboard.asterisk.org/r/2739/
Modified:
trunk/res/res_pjsip_registrar.c
Modified: trunk/res/res_pjsip_registrar.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_registrar.c?view=diff&rev=396552&r1=396551&r2=396552
==============================================================================
--- trunk/res/res_pjsip_registrar.c (original)
+++ trunk/res/res_pjsip_registrar.c Mon Aug 12 17:05:18 2013
@@ -29,6 +29,7 @@
#include "asterisk/res_pjsip.h"
#include "asterisk/module.h"
+#include "asterisk/test.h"
/*! \brief Internal function which returns the expiration time for a contact */
static int registrar_get_expiration(const struct ast_sip_aor *aor, const pjsip_contact_hdr *contact, const pjsip_rx_data *rdata)
@@ -142,8 +143,17 @@
static int registrar_delete_contact(void *obj, void *arg, int flags)
{
struct ast_sip_contact *contact = obj;
+ const char *aor_name = arg;
ast_sip_location_delete_contact(contact);
+ if (!ast_strlen_zero(aor_name)) {
+ ast_verb(3, "Removed contact '%s' from AOR '%s' due to request\n", contact->uri, aor_name);
+ ast_test_suite_event_notify("AOR_CONTACT_REMOVED",
+ "Contact: %s\r\n"
+ "AOR: %s",
+ contact->uri,
+ aor_name);
+ }
return 0;
}
@@ -284,7 +294,7 @@
if (contact_hdr->star) {
/* A star means to unregister everything, so do so for the possible contacts */
- ao2_callback(contacts, OBJ_NODATA | OBJ_MULTIPLE, registrar_delete_contact, NULL);
+ ao2_callback(contacts, OBJ_NODATA | OBJ_MULTIPLE, registrar_delete_contact, aor_name);
break;
}
@@ -308,6 +318,13 @@
ast_sip_location_add_contact(aor, contact_uri, ast_tvadd(ast_tvnow(), ast_samp2tv(expiration, 1)));
ast_verb(3, "Added contact '%s' to AOR '%s' with expiration of %d seconds\n",
contact_uri, aor_name, expiration);
+ ast_test_suite_event_notify("AOR_CONTACT_ADDED",
+ "Contact: %s\r\n"
+ "AOR: %s\r\n"
+ "Expiration: %d",
+ contact_uri,
+ aor_name,
+ expiration);
} else if (expiration) {
RAII_VAR(struct ast_sip_contact *, updated, ast_sorcery_copy(ast_sip_get_sorcery(), contact), ao2_cleanup);
updated->expiration_time = ast_tvadd(ast_tvnow(), ast_samp2tv(expiration, 1));
@@ -317,9 +334,21 @@
ast_sip_location_update_contact(updated);
ast_debug(3, "Refreshed contact '%s' on AOR '%s' with new expiration of %d seconds\n",
contact_uri, aor_name, expiration);
+ ast_test_suite_event_notify("AOR_CONTACT_REFRESHED",
+ "Contact: %s\r\n"
+ "AOR: %s\r\n"
+ "Expiration: %d",
+ contact_uri,
+ aor_name,
+ expiration);
} else {
ast_sip_location_delete_contact(contact);
ast_verb(3, "Removed contact '%s' from AOR '%s' due to request\n", contact_uri, aor_name);
+ ast_test_suite_event_notify("AOR_CONTACT_REMOVED",
+ "Contact: %s\r\n"
+ "AOR: %s",
+ contact_uri,
+ aor_name);
}
}
More information about the asterisk-commits
mailing list