[asterisk-commits] oej: branch oej/cancel_answer_elsewhere r67640 - /team/oej/cancel_answer_else...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jun 6 06:22:19 MST 2007


Author: oej
Date: Wed Jun  6 08:22:19 2007
New Revision: 67640

URL: http://svn.digium.com/view/asterisk?view=rev&rev=67640
Log:
Testing a flag on p->owner is quite stupid, since p->owner was already set to NULL.
Time to add another flag field, this time only for DIALOGS. We need to reorganize
the flags at this point.

Modified:
    team/oej/cancel_answer_elsewhere/channels/chan_sip.c

Modified: team/oej/cancel_answer_elsewhere/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/cancel_answer_elsewhere/channels/chan_sip.c?view=diff&rev=67640&r1=67639&r2=67640
==============================================================================
--- team/oej/cancel_answer_elsewhere/channels/chan_sip.c (original)
+++ team/oej/cancel_answer_elsewhere/channels/chan_sip.c Wed Jun  6 08:22:19 2007
@@ -745,6 +745,13 @@
 	struct sip_auth *next;          /*!< Next auth structure in list */
 };
 
+/* New set of flags for DIALOG ONLY, not for peers/users etc 
+	\todo - move dialog only flags here to release bits for peer/user to dialog copying 
+	This goes into flags[2] in the dialog - page 3
+*/
+
+#define SIP_DIALOG_ANSWEREDELSEWHERE (1 << 0)
+
 /*--- Various flags for the flags field in the pvt structure */
 #define SIP_ALREADYGONE		(1 << 0)	/*!< Whether or not we've already been destroyed by our peer */
 #define SIP_NEEDDESTROY		(1 << 1)	/*!< if we need to be destroyed by the monitor thread */
@@ -990,7 +997,7 @@
 	ast_group_t callgroup;			/*!< Call group */
 	ast_group_t pickupgroup;		/*!< Pickup group */
 	int lastinvite;				/*!< Last Cseq of invite */
-	struct ast_flags flags[2];		/*!< SIP_ flags */
+	struct ast_flags flags[3];		/*!< SIP_ flags */
 	int timer_t1;				/*!< SIP timer T1, ms rtt */
 	unsigned int sipoptions;		/*!< Supported SIP options on the other end */
 	struct ast_codec_pref prefs;		/*!< codec prefs */
@@ -3715,6 +3722,7 @@
 		if (option_debug)
 			ast_log(LOG_DEBUG, "This call was answered elsewhere");
 		append_history(p, "Cancel", "Call answered elsewhere");
+		ast_set_flag(&p->flags[2], SIP_DIALOG_ANSWEREDELSEWHERE);
 	}
 
 	if (ast_test_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER)) {
@@ -8231,7 +8239,7 @@
 		p->invitestate = INV_CONFIRMED;
 
 	reqprep(&resp, p, sipmethod, seqno, newbranch);
-	if (sipmethod == SIP_CANCEL && p->owner && ast_test_flag(p->owner, AST_FLAG_ANSWERED_ELSEWHERE)) 
+	if (sipmethod == SIP_CANCEL && p->owner && ast_test_flag(&p->flags[2], SIP_DIALOG_ANSWEREDELSEWHERE)) 
 		add_header(&resp, "Reason:", "SIP;cause=200;text=\"Call completed elsewhere\"");
 
 	add_header_contentLength(&resp, 0);



More information about the asterisk-commits mailing list