[asterisk-commits] trunk - r8654 /trunk/channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 25 07:52:44 MST 2006


Author: kpfleming
Date: Wed Jan 25 08:52:43 2006
New Revision: 8654

URL: http://svn.digium.com/view/asterisk?rev=8654&view=rev
Log:
don't queue a congestion frame on a channel that will be immediately hung up anyway
clean up/organize code block

Modified:
    trunk/channels/chan_iax2.c

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?rev=8654&r1=8653&r2=8654&view=diff
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed Jan 25 08:52:43 2006
@@ -6940,29 +6940,23 @@
 				iax2_destroy_nolock(fr.callno);
 				break;
 			case IAX_COMMAND_REJECT:
-				memset(&f, 0, sizeof(f));
-				f.frametype = AST_FRAME_CONTROL;
-				f.subclass = AST_CONTROL_CONGESTION;
-
 				/* Set hangup cause according to remote */
 				if (ies.causecode && iaxs[fr.callno]->owner)
 					iaxs[fr.callno]->owner->hangupcause = ies.causecode;
 
-				iax2_queue_frame(fr.callno, &f);
-				if (ast_test_flag(iaxs[fr.callno], IAX_PROVISION)) {
-					/* Send ack immediately, before we destroy */
-					send_command_immediate(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr.ts, NULL, 0,fr.iseqno);
-					iax2_destroy_nolock(fr.callno);
-					break;
+				if (!ast_test_flag(iaxs[fr.callno], IAX_PROVISION)) {
+					if (iaxs[fr.callno]->owner && authdebug)
+						ast_log(LOG_WARNING, "Call rejected by %s: %s\n",
+							ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[fr.callno]->addr.sin_addr),
+							ies.cause ? ies.cause : "<Unknown>");
+					ast_log(LOG_DEBUG, "Immediately destroying %d, having received reject\n",
+						fr.callno);
 				}
-				if (iaxs[fr.callno]->owner) {
-					if (authdebug)
-						ast_log(LOG_WARNING, "Call rejected by %s: %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[fr.callno]->addr.sin_addr), ies.cause ? ies.cause : "<Unknown>");
-				}
-				ast_log(LOG_DEBUG, "Immediately destroying %d, having received reject\n", fr.callno);
 				/* Send ack immediately, before we destroy */
-				send_command_immediate(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr.ts, NULL, 0,fr.iseqno);
-				iaxs[fr.callno]->error = EPERM;
+				send_command_immediate(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_ACK,
+						       fr.ts, NULL, 0, fr.iseqno);
+				if (!ast_test_flag(iaxs[fr.callno], IAX_PROVISION))
+					iaxs[fr.callno]->error = EPERM;
 				iax2_destroy_nolock(fr.callno);
 				break;
 			case IAX_COMMAND_TRANSFER:



More information about the asterisk-commits mailing list