[asterisk-commits] mmichelson: branch mmichelson/caller_id r384829 - /team/mmichelson/caller_id/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Apr 5 15:55:35 CDT 2013
Author: mmichelson
Date: Fri Apr 5 15:55:31 2013
New Revision: 384829
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384829
Log:
Fix up a couple of bugs.
* Make sure to honor privacy settings in all cases, especially when modifying From headers.
* Fix potential memory leak when setting IDs.
Modified:
team/mmichelson/caller_id/res/res_sip_caller_id.c
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=384829&r1=384828&r2=384829
==============================================================================
--- team/mmichelson/caller_id/res/res_sip_caller_id.c (original)
+++ team/mmichelson/caller_id/res/res_sip_caller_id.c Fri Apr 5 15:55:31 2013
@@ -49,10 +49,12 @@
ast_copy_pj_str(cid_name, &id_name_addr->display, sizeof(cid_name));
ast_copy_pj_str(cid_num, &uri->user, sizeof(cid_num));
+ ast_free(id->name.str);
id->name.str = ast_strdup(cid_name);
if (!ast_strlen_zero(cid_name)) {
id->name.valid = 1;
}
+ ast_free(id->number.str);
id->number.str = ast_strdup(cid_num);
if (!ast_strlen_zero(cid_num)) {
id->number.valid = 1;
@@ -340,10 +342,8 @@
(!set_id_from_pai(rdata, &session->id) || !set_id_from_rpid(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 {
+ ast_party_id_copy(&session->id, &session->endpoint->id);
+ if (!session->endpoint->id.number.valid) {
set_id_from_from(rdata, &session->id);
}
} else {
@@ -638,7 +638,10 @@
}
connected_id = ast_channel_connected_effective_id(session->channel);
- if (session->inv_session->state < PJSIP_INV_STATE_CONFIRMED) {
+ if (session->inv_session->state < PJSIP_INV_STATE_CONFIRMED &&
+ session->endpoint->trust_id_outbound &&
+ (connected_id.name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED &&
+ (connected_id.name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED) {
/* Only change the From header on the initial outbound INVITE. Switching it
* mid-call might confuse some UAs.
*/
More information about the asterisk-commits
mailing list