[svn-commits] file: branch file/7567 r115849 - /team/file/7567/channels/chan_iax2.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue May 13 12:18:25 CDT 2008


Author: file
Date: Tue May 13 12:18:25 2008
New Revision: 115849

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115849
Log:
Various style changes.

Modified:
    team/file/7567/channels/chan_iax2.c

Modified: team/file/7567/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/file/7567/channels/chan_iax2.c?view=diff&rev=115849&r1=115848&r2=115849
==============================================================================
--- team/file/7567/channels/chan_iax2.c (original)
+++ team/file/7567/channels/chan_iax2.c Tue May 13 12:18:25 2008
@@ -902,7 +902,7 @@
 static int iax2_indicate(struct ast_channel *c, int condition, const void *data, size_t datalen);
 static int iax2_poke_peer(struct iax2_peer *peer, int heldcall);
 static int iax2_provision(struct sockaddr_in *end, int sockfd, char *dest, const char *template, int force);
-static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final,int media);
+static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final, int media);
 static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen);
 static int iax2_sendimage(struct ast_channel *c, struct ast_frame *img);
 static int iax2_sendtext(struct ast_channel *c, const char *text);
@@ -2151,6 +2151,7 @@
 {
 	int res;
 	int callno = f->callno;
+	struct sockaddr_in *addr;
 
 	/* Don't send if there was an error, but return error instead */
 	if (!callno || !iaxs[callno] || iaxs[callno]->error)
@@ -2159,29 +2160,28 @@
 	/* Called with iaxsl held */
 	if (iaxdebug)
 		ast_debug(3, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port));
-  	if (f->media) {
-		if (iaxdebug)
-			iax_showframe(f, NULL, 0, &iaxs[callno]->media, f->datalen - sizeof(struct ast_iax2_full_hdr));
-		res = sendto(iaxs[callno]->sockfd, f->data, f->datalen, 0,(struct sockaddr *)&iaxs[callno]->media, 
-			sizeof(iaxs[callno]->media));
+
+	if (f->media) {
+		addr = &iaxs[callno]->media;
 	} else if (f->transfer) {
-
-		if (iaxdebug)
-			iax_showframe(f, NULL, 0, &iaxs[callno]->transfer, f->datalen - sizeof(struct ast_iax2_full_hdr));
-		res = sendto(iaxs[callno]->sockfd, f->data, f->datalen, 0,(struct sockaddr *)&iaxs[callno]->transfer,
-					sizeof(iaxs[callno]->transfer));
+		addr = &iaxs[callno]->transfer;
 	} else {
-		if (iaxdebug)
-			iax_showframe(f, NULL, 0, &iaxs[callno]->addr, f->datalen - sizeof(struct ast_iax2_full_hdr));
-		res = sendto(iaxs[callno]->sockfd, f->data, f->datalen, 0,(struct sockaddr *)&iaxs[callno]->addr,
-					sizeof(iaxs[callno]->addr));
-	}
+		addr = &iaxs[callno]->addr;
+	}
+	
+	if (iaxdebug)
+		iax_showframe(f, NULL, 0, addr, f->datalen - sizeof(struct ast_iax2_full_hdr));
+
+	res = sendto(iaxs[callno]->sockfd, f->data, f->datalen, 0,(struct sockaddr *)addr, 
+		     sizeof(iaxs[callno]->media));
+
 	if (res < 0) {
 		if (iaxdebug)
 			ast_debug(1, "Received error: %s\n", strerror(errno));
 		handle_error();
 	} else
 		res = 0;
+
 	return res;
 }
 
@@ -2299,10 +2299,11 @@
 						struct iax_ie_data ied;
 						memset(&ied, 0, sizeof(ied));
 						iax_ie_append_int(&ied, IAX_IE_TRANSFERID, iaxs[callno]->transferid);
-						if (iaxs[callno]->mediareleased)
+						if (iaxs[callno]->mediareleased) {
 							send_command_media(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, ied.buf, ied.pos);
-						else
+						} else {
 							send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, ied.buf, ied.pos, -1);
+						}
 					} else if (f->final) {
 						if (f->final) 
 							iax2_destroy(callno);
@@ -3744,10 +3745,11 @@
 	iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[callno0]->peercallno);
 	iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, transferid);
 	
-	if (iaxs[callno0]->mediareleased)
+	if (iaxs[callno0]->mediareleased) {
 		res = send_command_media(iaxs[callno0], AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied0.buf, ied0.pos);
-	else
+	} else {
 		res = send_command(iaxs[callno0], AST_FRAME_IAX, IAX_COMMAND_TXREQ, 0, ied0.buf, ied0.pos, -1);
+	}
 
 	if (res)
 		return -1;
@@ -3855,8 +3857,9 @@
 			    (iaxs[callno1]->transferring == TRANSFER_NONE)) {
 				/* Try the transfer */
 				if (iax2_start_transfer(callno0, callno1, (flags & (AST_BRIDGE_DTMF_CHANNEL_0 | AST_BRIDGE_DTMF_CHANNEL_1)) ||
-						ast_test_flag(iaxs[callno0], IAX_TRANSFERMEDIA) | ast_test_flag(iaxs[callno1], IAX_TRANSFERMEDIA)))
+							ast_test_flag(iaxs[callno0], IAX_TRANSFERMEDIA) | ast_test_flag(iaxs[callno1], IAX_TRANSFERMEDIA))) {
 					ast_log(LOG_WARNING, "Unable to start the transfer\n");
+				}
 			}
 		}
 		if ((iaxs[callno0]->transferring == TRANSFER_RELEASED) && (iaxs[callno1]->transferring == TRANSFER_RELEASED)) {
@@ -4604,7 +4607,7 @@
 	return res;
 }
 
-static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final,int media)
+static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final, int media)
 {
 	/* Queue a packet for delivery on a given private structure.  Use "ts" for
 	   timestamp, or calculate if ts is 0.  Send immediately without retransmission
@@ -4767,8 +4770,9 @@
 			fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_video_hdr);
 			fr->data = vh;
 			fr->retries = -1;
-			if(pvt->mediareleased)
+			if (pvt->mediareleased) {
 				fr->media = 1;
+			}
 			res = send_packet(fr);			
 		} else {
 			/* Mini-frames have no sequence number */
@@ -4781,8 +4785,9 @@
 			fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_mini_hdr);
 			fr->data = mh;
 			fr->retries = -1;
-			if (pvt->mediareleased)
+			if (pvt->mediareleased) {
 				fr->media = 1;
+			}
 			if (ast_test_flag(pvt, IAX_ENCRYPTED)) {
 				if (ast_test_flag(pvt, IAX_KEYPOPULATED)) {
 					encrypt_frame(&pvt->ecx, (struct ast_iax2_full_hdr *)mh, pvt->semirand, &fr->datalen);
@@ -8393,10 +8398,11 @@
 					memset(&ied1, 0, sizeof(ied1));
 					iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr->callno]->callno);
 					iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, iaxs[fr->callno]->transferid);
-					if (iaxs[fr->callno]->mediareleased)
+					if (iaxs[fr->callno]->mediareleased) {
 						send_command_media(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREADY, 0, ied1.buf, ied1.pos);
-					else
+					} else {
 						send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREADY, 0, ied1.buf, ied1.pos, -1);
+					}
 					iaxs[fr->callno]->transferring = TRANSFER_READY;
 				}
 				break;
@@ -9215,10 +9221,11 @@
 						iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_NONE;
 						memset(&ied0, 0, sizeof(ied0));
 						iax_ie_append_int(&ied0, IAX_IE_TRANSFERID, iaxs[iaxs[fr->callno]->bridgecallno]->transferid);
-						if (iaxs[iaxs[fr->callno]->bridgecallno]->mediareleased)
+						if (iaxs[iaxs[fr->callno]->bridgecallno]->mediareleased) {
 							send_command_media(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, ied0.buf, ied0.pos);
-						else
+						} else {
 							send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, ied0.buf, ied0.pos, -1);
+						}
 					}
 				}
 				break;
@@ -9252,15 +9259,16 @@
 								iax_ie_append_int(&ied0, IAX_IE_TRANSFERID, iaxs[iaxs[fr->callno]->bridgecallno]->transferid);
 								iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr->callno]->peercallno);
 								iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, iaxs[fr->callno]->transferid);
-								if (iaxs[fr->callno]->mediareleased)
+								if (iaxs[fr->callno]->mediareleased) {
 									send_command_media(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied0.buf, ied0.pos);
-								else
+								} else {
 									send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied0.buf, ied0.pos, -1);
-								if (iaxs[iaxs[fr->callno]->bridgecallno]->mediareleased)
+								}
+								if (iaxs[iaxs[fr->callno]->bridgecallno]->mediareleased) {
 									send_command_media(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied1.buf, ied1.pos);
-								else
+								} else {
 									send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied1.buf, ied1.pos, -1);
-
+								}
 							} else {
 								ast_verb(3, "Releasing %s and %s\n", iaxs[fr->callno]->owner ? iaxs[fr->callno]->owner->name : "<Unknown>",
 										iaxs[iaxs[fr->callno]->bridgecallno]->owner ? iaxs[iaxs[fr->callno]->bridgecallno]->owner->name : "<Unknown>");
@@ -9280,15 +9288,16 @@
 								iax_ie_append_int(&ied0, IAX_IE_TRANSFERID, iaxs[iaxs[fr->callno]->bridgecallno]->transferid);
 								iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr->callno]->peercallno);
 								iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, iaxs[fr->callno]->transferid);
-								if (iaxs[fr->callno]->mediareleased)
+								if (iaxs[fr->callno]->mediareleased) {
 									send_command_media(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied0.buf, ied0.pos);
-								else
+								} else {
 									send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied0.buf, ied0.pos, -1);
-								if (iaxs[iaxs[fr->callno]->bridgecallno]->mediareleased)
+								}
+								if (iaxs[iaxs[fr->callno]->bridgecallno]->mediareleased) {
 									send_command_media(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied1.buf, ied1.pos);
-								else
+								} else {
 									send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied1.buf, ied1.pos, -1);
-
+								}
 							}
 
 						}
@@ -9305,10 +9314,11 @@
 						iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_NONE;
 						memset(&ied0, 0, sizeof(ied0));
 						iax_ie_append_int(&ied0, IAX_IE_TRANSFERID, iaxs[iaxs[fr->callno]->bridgecallno]->transferid);
-						if (iaxs[iaxs[fr->callno]->bridgecallno]->mediareleased)
+						if (iaxs[iaxs[fr->callno]->bridgecallno]->mediareleased) {
 							send_command_media(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, ied0.buf, ied0.pos);
-						else
+						} else {
 							send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, ied0.buf, ied0.pos, -1);
+						}
 						/* Start our transfer again later */
 						iaxs[fr->callno]->triedtransfer = 0;
 						iaxs[iaxs[fr->callno]->bridgecallno]->triedtransfer = 0;




More information about the svn-commits mailing list