Review Board 1.7.16


IAX2: refactor nativebridge transfer.

Review Request #2602 - Created June 8, 2013 and submitted

Alec Davis
1.8 to trunk
Reviewers
asterisk-dev
Asterisk
remove triple checking of iaxs[fr->callno]->transferring

reduce indentation.

I've done this as 2 step, so that reviewers are confident nothing breaks.

 

Changes between revision 1 and 2

1 2 3
1 2 3

  1. branches/11/channels/chan_iax2.c: Loading...
branches/11/channels/chan_iax2.c
Diff Revision 1 Diff Revision 2
[20] 11530 lines
[+20] [+] immediatedial:
11531

    
   
11531

   
11532
				if (!iaxs[fr->callno]->bridgecallno) {
11532
				if (!iaxs[fr->callno]->bridgecallno) {
11533
					break;
11533
					break;
11534
				}
11534
				}
11535

    
   
11535

   
11536
				if ((iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_READY) ||
11536
				/* If the otherside is ready, either transfer media only, or signalling */
11537
				    (iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_MREADY)) {
11537
			    	if ((iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_MREADY) && (iaxs[fr->callno]->transferring == TRANSFER_MREADY)) {
11538
					/* They're both ready, now release them. */
11538
					/* Both sides are ready for MEDIA only transfer */
11539
					if (iaxs[fr->callno]->transferring == TRANSFER_MREADY) {

   
11540
						ast_verb(3, "Attempting media bridge of %s and %s\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>",
11539
					ast_verb(3, "Attempting media bridge of %s and %s\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>",
11541
								iaxs[iaxs[fr->callno]->bridgecallno]->owner ? ast_channel_name(iaxs[iaxs[fr->callno]->bridgecallno]->owner) : "<Unknown>");
11540
							iaxs[iaxs[fr->callno]->bridgecallno]->owner ? ast_channel_name(iaxs[iaxs[fr->callno]->bridgecallno]->owner) : "<Unknown>");
11542

    
   
11541

   
11543
						iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_MEDIA;
11542
					iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_MEDIA;
11544
						iaxs[fr->callno]->transferring = TRANSFER_MEDIA;
11543
					iaxs[fr->callno]->transferring = TRANSFER_MEDIA;
11545

    
   
11544

   
11546
						memset(&ied0, 0, sizeof(ied0));
11545
					memset(&ied0, 0, sizeof(ied0));
11547
						memset(&ied1, 0, sizeof(ied1));
11546
					memset(&ied1, 0, sizeof(ied1));
11548
						iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[iaxs[fr->callno]->bridgecallno]->peercallno);
11547
					iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[iaxs[fr->callno]->bridgecallno]->peercallno);
11549
						iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr->callno]->peercallno);
11548
					iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr->callno]->peercallno);
11550
						send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied0.buf, ied0.pos, -1);
11549
					send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied0.buf, ied0.pos, -1);
11551
						send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied1.buf, ied1.pos, -1);
11550
					send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXMEDIA, 0, ied1.buf, ied1.pos, -1);
11552
					} else {
11551

   

    
   
11552
				} else if (iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_READY) {

    
   
11553
					/* Both sides are ready. Both would normally be at TRANSFER_READY, but also cover mismatched sides */
11553
						ast_verb(3, "Releasing %s and %s\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>",
11554
					ast_verb(3, "Releasing %s and %s\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>",
11554
								iaxs[iaxs[fr->callno]->bridgecallno]->owner ? ast_channel_name(iaxs[iaxs[fr->callno]->bridgecallno]->owner) : "<Unknown>");
11555
							iaxs[iaxs[fr->callno]->bridgecallno]->owner ? ast_channel_name(iaxs[iaxs[fr->callno]->bridgecallno]->owner) : "<Unknown>");
11555

    
   
11556

   
11556
						iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_RELEASED;
11557
					iaxs[iaxs[fr->callno]->bridgecallno]->transferring = TRANSFER_RELEASED;
11557
						iaxs[fr->callno]->transferring = TRANSFER_RELEASED;
11558
					iaxs[fr->callno]->transferring = TRANSFER_RELEASED;
[+20] [20] 8 lines
[+20] immediatedial:
11566
						memset(&ied1, 0, sizeof(ied1));
11567
					memset(&ied1, 0, sizeof(ied1));
11567
						iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[iaxs[fr->callno]->bridgecallno]->peercallno);
11568
					iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[iaxs[fr->callno]->bridgecallno]->peercallno);
11568
						iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr->callno]->peercallno);
11569
					iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr->callno]->peercallno);
11569
						send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied0.buf, ied0.pos, -1);
11570
					send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied0.buf, ied0.pos, -1);
11570
						send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied1.buf, ied1.pos, -1);
11571
					send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied1.buf, ied1.pos, -1);
11571

    
   

   
11572
					}

   
11573
				}
11572
				}
11574
				break;
11573
				break;
11575
			case IAX_COMMAND_TXREQ:
11574
			case IAX_COMMAND_TXREQ:
11576
				try_transfer(iaxs[fr->callno], &ies);
11575
				try_transfer(iaxs[fr->callno], &ies);
11577
				break;
11576
				break;
[+20] [20] 3490 lines
  1. branches/11/channels/chan_iax2.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.