[svn-commits] trunk r18058 - /trunk/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Apr 6 14:29:56 MST 2006


Author: oej
Date: Thu Apr  6 16:29:54 2006
New Revision: 18058

URL: http://svn.digium.com/view/asterisk?rev=18058&view=rev
Log:
Improved handling of 491 responses

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=18058&r1=18057&r2=18058&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Apr  6 16:29:54 2006
@@ -1418,7 +1418,7 @@
 }
 
 /*! \brief Acknowledges receipt of a packet and stops retransmission */
-static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
+static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod, int reset)
 {
 	struct sip_pkt *cur, *prev = NULL;
 	int res = -1;
@@ -1447,7 +1447,8 @@
 					ast_log(LOG_DEBUG, "** SIP TIMER: Cancelling retransmit of packet (reply received) Retransid #%d\n", cur->retransid);
 				ast_sched_del(sched, cur->retransid);
 			}
-			free(cur);
+			if (!reset)
+				free(cur);
 			res = 0;
 			break;
 		}
@@ -1470,7 +1471,7 @@
 		}
 		cur = p->packets;
 		if (cur->method)
-			__sip_ack(p, p->packets->seqno, (ast_test_flag(p->packets, FLAG_RESPONSE)), cur->method);
+			__sip_ack(p, p->packets->seqno, (ast_test_flag(p->packets, FLAG_RESPONSE)), cur->method, FALSE);
 		else {	/* Unknown packet type */
 			char *c;
 			char method[128];
@@ -1478,7 +1479,7 @@
 			ast_copy_string(method, p->packets->data, sizeof(method));
 			c = ast_skip_blanks(method); /* XXX what ? */
 			*c = '\0';
-			__sip_ack(p, p->packets->seqno, (ast_test_flag(p->packets, FLAG_RESPONSE)), find_sip_method(method));
+			__sip_ack(p, p->packets->seqno, (ast_test_flag(p->packets, FLAG_RESPONSE)), find_sip_method(method), FALSE);
 		}
 	}
 	return 0;
@@ -10059,7 +10060,7 @@
 	if ((resp >= 100) && (resp <= 199))
 		__sip_semi_ack(p, seqno, 0, sipmethod);
 	else
-		__sip_ack(p, seqno, 0, sipmethod);
+		__sip_ack(p, seqno, 0, sipmethod, resp == 491 ? TRUE : FALSE);
 
 	/* Get their tag if we haven't already */
 	if (ast_strlen_zero(p->theirtag) || (resp >= 200)) {
@@ -10171,6 +10172,8 @@
 		case 491: /* Pending */
 			if (sipmethod == SIP_INVITE) {
 				handle_response_invite(p, resp, rest, req, ignore, seqno);
+			} else {
+				ast_log(LOG_DEBUG, "Got 491 on %s, unspported. Call ID %s\n", sip_methods[sipmethod].text, p->callid);
 			}
 		case 501: /* Not Implemented */
 			if (sipmethod == SIP_INVITE) {
@@ -11575,7 +11578,7 @@
 		/* Make sure we don't ignore this */
 		if (seqno == p->pendinginvite) {
 			p->pendinginvite = 0;
-			__sip_ack(p, seqno, FLAG_RESPONSE, 0);
+			__sip_ack(p, seqno, FLAG_RESPONSE, 0, FALSE);
 			if (!ast_strlen_zero(get_header(req, "Content-Type"))) {
 				if (process_sdp(p, req))
 					return -1;



More information about the svn-commits mailing list