diff -ru asterisk-1.6.1.10.orig/channels/chan_sip.c asterisk-1.6.1.10/channels/chan_sip.c --- asterisk-1.6.1.10.orig/channels/chan_sip.c 2009-11-13 16:57:13.000000000 +0100 +++ asterisk-1.6.1.10/channels/chan_sip.c 2009-11-20 21:38:39.000000000 +0100 @@ -20564,8 +20564,7 @@ (could be new request in existing SIP dialog as well...) */ - p->method = req->method; /* Find out which SIP method they are using */ - ast_debug(4, "**** Received %s (%d) - Command in SIP %s\n", sip_methods[p->method].text, sip_methods[p->method].id, cmd); + ast_debug(4, "**** Received %s (%d) - Command in SIP %s\n", sip_methods[req->method].text, sip_methods[req->method].id, cmd); if (p->icseq && (p->icseq > seqno) ) { if (p->pendinginvite && seqno == p->pendinginvite && (req->method == SIP_ACK || req->method == SIP_CANCEL)) { @@ -20579,12 +20578,12 @@ } else if (p->icseq && p->icseq == seqno && req->method != SIP_ACK && - (p->method != SIP_CANCEL || p->alreadygone)) { + (req->method != SIP_CANCEL || p->alreadygone)) { /* ignore means "don't do anything with it" but still have to respond appropriately. We do this if we receive a repeat of the last sequence number */ req->ignore = 1; - ast_debug(3, "Ignoring SIP message because of retransmit (%s Seqno %d, ours %d)\n", sip_methods[p->method].text, p->icseq, seqno); + ast_debug(3, "Ignoring SIP message because of retransmit (%s Seqno %d, ours %d)\n", sip_methods[req->method].text, p->icseq, seqno); } if (seqno >= p->icseq) @@ -20622,14 +20621,18 @@ } } - if (!e && (p->method == SIP_INVITE || p->method == SIP_SUBSCRIBE || p->method == SIP_REGISTER || p->method == SIP_NOTIFY)) { + if (req->method != SIP_ACK) { + p->method = req->method; + } + + if (!e && (req->method == SIP_INVITE || req->method == SIP_SUBSCRIBE || req->method == SIP_REGISTER || req->method == SIP_NOTIFY)) { transmit_response(p, "400 Bad request", req); sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); return -1; } /* Handle various incoming SIP methods in requests */ - switch (p->method) { + switch (req->method) { case SIP_OPTIONS: res = handle_request_options(p, req); break;