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.

 

Diff revision 1

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

1 2 3
1 2 3

  1. branches/11/channels/chan_iax2.c: Loading...
branches/11/channels/chan_iax2.c
Revision 391036 New Change
[20] 11517 lines
[+20] [+] immediatedial:
11518
						send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, NULL, 0, -1);
11518
						send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, NULL, 0, -1);
11519
					}
11519
					}
11520
				}
11520
				}
11521
				break;
11521
				break;
11522
			case IAX_COMMAND_TXREADY:
11522
			case IAX_COMMAND_TXREADY:
11523
				if ((iaxs[fr->callno]->transferring == TRANSFER_BEGIN) ||
11523
				if (iaxs[fr->callno]->transferring == TRANSFER_BEGIN) {
11524
				    (iaxs[fr->callno]->transferring == TRANSFER_MBEGIN)) {

   
11525
					if (iaxs[fr->callno]->transferring == TRANSFER_MBEGIN)

   
11526
						iaxs[fr->callno]->transferring = TRANSFER_MREADY;

   
11527
					else

   
11528
						iaxs[fr->callno]->transferring = TRANSFER_READY;
11524
					iaxs[fr->callno]->transferring = TRANSFER_READY;

    
   
11525
				} else if (iaxs[fr->callno]->transferring == TRANSFER_MBEGIN) {

    
   
11526
					iaxs[fr->callno]->transferring = TRANSFER_MREADY;

    
   
11527
				} else {

    
   
11528
					break;

    
   
11529
				}
11529
					ast_verb(3, "Channel '%s' ready to transfer\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>");
11530
				ast_verb(3, "Channel '%s' ready to transfer\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>");
11530
					if (iaxs[fr->callno]->bridgecallno) {
11531

   

    
   
11532
				if (!iaxs[fr->callno]->bridgecallno) {

    
   
11533
					break;

    
   
11534
				}

    
   
11535

   
11531
						if ((iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_READY) ||
11536
				if ((iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_READY) ||
11532
						    (iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_MREADY)) {
11537
				    (iaxs[iaxs[fr->callno]->bridgecallno]->transferring == TRANSFER_MREADY)) {
11533
							/* They're both ready, now release them. */
11538
					/* They're both ready, now release them. */
11534
							if (iaxs[fr->callno]->transferring == TRANSFER_MREADY) {
11539
					if (iaxs[fr->callno]->transferring == TRANSFER_MREADY) {
11535
								ast_verb(3, "Attempting media bridge of %s and %s\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>",
11540
						ast_verb(3, "Attempting media bridge of %s and %s\n", iaxs[fr->callno]->owner ? ast_channel_name(iaxs[fr->callno]->owner) : "<Unknown>",
[+20] [20] 25 lines
[+20] immediatedial:
11561
								memset(&ied1, 0, sizeof(ied1));
11566
						memset(&ied1, 0, sizeof(ied1));
11562
								iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[iaxs[fr->callno]->bridgecallno]->peercallno);
11567
						iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[iaxs[fr->callno]->bridgecallno]->peercallno);
11563
								iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr->callno]->peercallno);
11568
						iax_ie_append_short(&ied1, IAX_IE_CALLNO, iaxs[fr->callno]->peercallno);
11564
								send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied0.buf, ied0.pos, -1);
11569
						send_command(iaxs[fr->callno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied0.buf, ied0.pos, -1);
11565
								send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied1.buf, ied1.pos, -1);
11570
						send_command(iaxs[iaxs[fr->callno]->bridgecallno], AST_FRAME_IAX, IAX_COMMAND_TXREL, 0, ied1.buf, ied1.pos, -1);
11566
							}

   
11567

    
   
11571

   
11568
						}
11572
					}
11569
					}
11573
				}
11570
				}

   
11571
				break;
11574
				break;
11572
			case IAX_COMMAND_TXREQ:
11575
			case IAX_COMMAND_TXREQ:
11573
				try_transfer(iaxs[fr->callno], &ies);
11576
				try_transfer(iaxs[fr->callno], &ies);
11574
				break;
11577
				break;
11575
			case IAX_COMMAND_TXCNT:
11578
			case IAX_COMMAND_TXCNT:
[+20] [20] 3489 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.