[asterisk-commits] mnicholson: branch 1.4 r218578 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 15 11:04:00 CDT 2009


Author: mnicholson
Date: Tue Sep 15 11:03:54 2009
New Revision: 218578

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=218578
Log:
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

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=218578&r1=218577&r2=218578
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Tue Sep 15 11:03:54 2009
@@ -6287,7 +6287,7 @@
 		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)) {
@@ -9255,11 +9255,13 @@
 					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);
@@ -9286,11 +9288,13 @@
 				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", "Peer: SIP/%s\r\nPeerStatus: Registered\r\n", peer->name);




More information about the asterisk-commits mailing list