summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMatthew Nicholson <mnicholson@digium.com>2009-09-15 16:15:02 +0000
committerMatthew Nicholson <mnicholson@digium.com>2009-09-15 16:15:02 +0000
commit6f6998fef7758de434b639009be4ddcc2f53a405 (patch)
tree5a77643697983a770d4ec4d8b6f9d731a2aa033e /channels
parent0d5e318cb2fc3d8dbc6547f2d30a6f7f5ea90a60 (diff)
Merged revisions 218578 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r218578 | mnicholson | 2009-09-15 11:03:54 -0500 (Tue, 15 Sep 2009) | 8 lines Send request contact header field with response to registrer queries instead of the address of record. (closes issue #14438) Reported by: ravindrad Patches: regquerypatch uploaded by ravindrad (license 684) Tested by: ravindrad ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@218586 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index fff09c614..d9175a808 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -9354,7 +9354,7 @@ static int respprep(struct sip_request *resp, struct sip_pvt *p, const char *msg
add_header(resp, "Expires", tmp);
if (p->expiry) { /* Only add contact if we have an expiry time */
char contact[SIPBUFSIZE];
- snprintf(contact, sizeof(contact), "%s;expires=%d", p->our_contact, p->expiry);
+ snprintf(contact, sizeof(contact), "%s;expires=%d", (p->method == SIP_SUBSCRIBE ? p->our_contact : p->fullcontact), p->expiry);
add_header(resp, "Contact", contact); /* Not when we unregister */
}
} else if (!ast_strlen_zero(p->our_contact) && resp_needs_contact(msg, p->method)) {
@@ -13180,11 +13180,13 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct sockaddr
res = 0;
break;
case PARSE_REGISTER_QUERY:
+ ast_string_field_set(p, fullcontact, peer->fullcontact);
transmit_response_with_date(p, "200 OK", req);
peer->lastmsgssent = -1;
res = 0;
break;
case PARSE_REGISTER_UPDATE:
+ ast_string_field_set(p, fullcontact, peer->fullcontact);
update_peer(peer, p->expiry);
/* Say OK and ask subsystem to retransmit msg counter */
transmit_response_with_date(p, "200 OK", req);
@@ -13218,11 +13220,13 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct sockaddr
res = 0;
break;
case PARSE_REGISTER_QUERY:
+ ast_string_field_set(p, fullcontact, peer->fullcontact);
transmit_response_with_date(p, "200 OK", req);
peer->lastmsgssent = -1;
res = 0;
break;
case PARSE_REGISTER_UPDATE:
+ ast_string_field_set(p, fullcontact, peer->fullcontact);
/* Say OK and ask subsystem to retransmit msg counter */
transmit_response_with_date(p, "200 OK", req);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Registered\r\nAddress: %s\r\nPort: %d\r\n", peer->name, ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));