[svn-commits] oej: branch 1.4 r46398 - /branches/1.4/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Oct 29 01:45:05 MST 2006


Author: oej
Date: Sun Oct 29 02:45:05 2006
New Revision: 46398

URL: http://svn.digium.com/view/asterisk?rev=46398&view=rev
Log:
Restoring the old logic, since working around it and fixing it seemed too complicated.

- The SIP_OUTGOING flag indicates the direction of the last transaction in the dialog.
- The initreq stores the last request in the dialog, the request that opened the 
  latest transaction.

Please now retry all the 1.4 bug reports with mixed to/from headers, tags etc
in ACK, BYE, CANCEL. Thanks!

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?rev=46398&r1=46397&r2=46398&view=diff
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Sun Oct 29 02:45:05 2006
@@ -701,7 +701,7 @@
 #define SIP_USEREQPHONE		(1 << 10)	/*!< Add user=phone to numeric URI. Default off */
 #define SIP_REALTIME		(1 << 11)	/*!< Flag for realtime users */
 #define SIP_USECLIENTCODE	(1 << 12)	/*!< Trust X-ClientCode info message */
-#define SIP_OUTGOING		(1 << 13)	/*!< Is this an outgoing call? */
+#define SIP_OUTGOING		(1 << 13)	/*!< Direction of the last transaction in this dialog */
 #define SIP_CAN_BYE		(1 << 14)	/*!< Can we send BYE on this dialog? */
 #define SIP_DEFER_BYE_ON_TRANSFER	(1 << 15)	/*!< Do not hangup at first ast_hangup */
 #define SIP_DTMF		(3 << 16)	/*!< DTMF Support: four settings, uses two bits */
@@ -959,7 +959,8 @@
 	char lastmsg[256];			/*!< Last Message sent/received */
 	int amaflags;				/*!< AMA Flags */
 	int pendinginvite;			/*!< Any pending invite ? (seqno of this) */
-	struct sip_request initreq;		/*!< Initial request that opened the SIP dialog */
+	struct sip_request initreq;		/*!< Request that opened the latest transaction
+						     within this SIP dialog */
 	
 	int maxtime;				/*!< Max time for first response */
 	int initid;				/*!< Auto-congest ID if appropriate (scheduler) */
@@ -6339,6 +6340,7 @@
 	/* Use this as the basis */
 	initialize_initreq(p, &req);
 	p->lastinvite = p->ocseq;
+	ast_set_flag(&p->flags[0], SIP_OUTGOING);		/* Change direction of this dialog */
 	return send_request(p, &req, XMIT_CRITICAL, p->ocseq);
 }
 
@@ -10406,7 +10408,7 @@
 				ast_cli(fd, "  * Subscription (type: %s)\n", subscription_type2str(cur->subscribed));
 			else
 				ast_cli(fd, "  * SIP Call\n");
-			ast_cli(fd, "  Direction:              %s\n", ast_test_flag(&cur->flags[0], SIP_OUTGOING)?"Outgoing":"Incoming");
+			ast_cli(fd, "  Curr. trans. direction:  %s\n", ast_test_flag(&cur->flags[0], SIP_OUTGOING) ? "Outgoing" : "Incoming");
 			ast_cli(fd, "  Call-ID:                %s\n", cur->callid);
 			ast_cli(fd, "  Owner channel ID:       %s\n", cur->owner ? cur->owner->name : "<none>");
 			ast_cli(fd, "  Our Codec Capability:   %d\n", cur->capability);
@@ -12993,14 +12995,14 @@
 		p->pendinginvite = seqno;
 		check_via(p, req);
 
+		copy_request(&p->initreq, req);		/* Save this INVITE as the transaction basis */
 		if (!p->owner) {	/* Not a re-invite */
-			/* Use this as the basis */
-			copy_request(&p->initreq, req);
 			if (debug)
 				ast_verbose("Using INVITE request as basis request - %s\n", p->callid);
 			append_history(p, "Invite", "New call: %s", p->callid);
 			parse_ok_contact(p, req);
 		} else {	/* Re-invite on existing call */
+			ast_clear_flag(&p->flags[0], SIP_OUTGOING);	/* This is now an inbound dialog */
 			/* Handle SDP here if we already have an owner */
 			if (find_sdp(req)) {
 				if (process_sdp(p, req)) {



More information about the svn-commits mailing list