[asterisk-commits] mmichelson: branch mmichelson/caller_id r384589 - in /team/mmichelson/caller_...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Apr 2 14:22:24 CDT 2013
Author: mmichelson
Date: Tue Apr 2 14:22:21 2013
New Revision: 384589
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384589
Log:
Add a trust_external_id option for endpoints.
This controls whether we trust identities received in P-Asserted-Identity
headers or not.
Modified:
team/mmichelson/caller_id/include/asterisk/res_sip.h
team/mmichelson/caller_id/res/res_sip/sip_configuration.c
team/mmichelson/caller_id/res/res_sip_caller_id.c
Modified: team/mmichelson/caller_id/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/caller_id/include/asterisk/res_sip.h?view=diff&rev=384589&r1=384588&r2=384589
==============================================================================
--- team/mmichelson/caller_id/include/asterisk/res_sip.h (original)
+++ team/mmichelson/caller_id/include/asterisk/res_sip.h Tue Apr 2 14:22:21 2013
@@ -316,6 +316,8 @@
enum ast_sip_direct_media_glare_mitigation direct_media_glare_mitigation;
/*! Do not attempt direct media session refreshes if a media NAT is detected */
unsigned int disable_direct_media_on_nat;
+ /*! Do we trust identity information that originates externally (e.g. P-Asserted-Identity header)? */
+ unsigned int trust_external_id;
};
/*!
Modified: team/mmichelson/caller_id/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/caller_id/res/res_sip/sip_configuration.c?view=diff&rev=384589&r1=384588&r2=384589
==============================================================================
--- team/mmichelson/caller_id/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/caller_id/res/res_sip/sip_configuration.c Tue Apr 2 14:22:21 2013
@@ -302,6 +302,7 @@
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_glare_mitigation", "none", direct_media_glare_mitigation_handler, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disable_direct_media_on_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, disable_direct_media_on_nat));
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid", "", caller_id_handler, NULL, 0, 0);
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_external_id", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, trust_external_id));
if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
Modified: team/mmichelson/caller_id/res/res_sip_caller_id.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/caller_id/res/res_sip_caller_id.c?view=diff&rev=384589&r1=384588&r2=384589
==============================================================================
--- team/mmichelson/caller_id/res/res_sip_caller_id.c (original)
+++ team/mmichelson/caller_id/res/res_sip_caller_id.c Tue Apr 2 14:22:21 2013
@@ -107,7 +107,12 @@
{
struct ast_party_connected_line connected;
+ if (!session->endpoint->trust_external_id) {
+ return;
+ }
+
ast_party_connected_line_init(&connected);
+
if (get_id_from_pai(rdata, &connected.id)) {
return;
}
@@ -135,13 +140,15 @@
{
if (session->inv_session->state < PJSIP_INV_STATE_CONFIRMED) {
/* Initial inbound INVITE. Set the session ID directly */
- if (get_id_from_pai(rdata, &session->id)) {
- if (session->endpoint->id.number.valid) {
- /* Prefer configured caller-ID over From header. */
- ast_party_id_copy(&session->id, &session->endpoint->id);
- } else {
- get_id_from_from(rdata, &session->id);
- }
+ if (session->endpoint->trust_external_id &&
+ !get_id_from_pai(rdata, &session->id)) {
+ return 0;
+ }
+ if (session->endpoint->id.number.valid) {
+ /* Prefer configured caller-ID over From header. */
+ ast_party_id_copy(&session->id, &session->endpoint->id);
+ } else {
+ get_id_from_from(rdata, &session->id);
}
} else {
/* Reinvite. Check for changes to the ID and queue a connected line
More information about the asterisk-commits
mailing list