Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (revision 177660) +++ channels/chan_sip.c (working copy) @@ -8544,7 +8544,6 @@ add_header(resp, "Require", "timer"); add_header(resp, "Session-Expires", se_hdr); } - if (msg[0] == '2' && (p->method == SIP_SUBSCRIBE || p->method == SIP_REGISTER)) { /* For registration responses, we also need expiry and contact info */ @@ -8554,9 +8553,12 @@ 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)) { add_header(resp, "Contact", p->our_contact); } @@ -12015,12 +12017,14 @@ 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: update_peer(peer, p->expiry); + 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); if (!ast_test_flag((&peer->flags[1]), SIP_PAGE2_SUBSCRIBEMWIONLY))