Skip to content

Make timer B configurable #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/gov/nist/javax/sip/TransactionExt.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ public interface TransactionExt extends Transaction {
public void setTimerT4(int interval);

/**
* Sets the value of Timer D (in ms)
* @param interval value of Timer D (in ms)
* Retrieve the value of Timer D (in ms)
* @return value of Timer D (in ms)
*
* @since 2.0
*/
Expand All @@ -137,4 +137,17 @@ public interface TransactionExt extends Transaction {
* @since 2.0
*/
public void setTimerD(int interval);

/**
* Retrieve the value of Timer B (in ms)
* @return value of Timer B (in ms)
*
*/
public int getTimerB();
/**
* Sets the value of Timer B (in ms)
* @param interval value of Timer B (in ms)
*
*/
public void setTimerB(int interval);
}
2 changes: 1 addition & 1 deletion src/gov/nist/javax/sip/stack/SIPClientTransactionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public void sendMessage(SIPMessage messageToSend) throws IOException {
enableRetransmissionTimer();
}
if (isInviteTransaction()) {
enableTimeoutTimer(TIMER_B);
enableTimeoutTimer(getTimerB());
} else {
enableTimeoutTimer(TIMER_F);
}
Expand Down
5 changes: 0 additions & 5 deletions src/gov/nist/javax/sip/stack/SIPTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ public interface SIPTransaction extends TransactionExt {
*/
public static final int TIMER_A = 1;

/**
* INVITE transaction timeout timer
*/
public static final int TIMER_B = 64;

public static final int TIMER_J = 64;

public static final int TIMER_F = 64;
Expand Down
21 changes: 21 additions & 0 deletions src/gov/nist/javax/sip/stack/SIPTransactionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public abstract class SIPTransactionImpl implements SIPTransaction {

protected int timerD = 32000 / baseTimerInterval;

protected int timerB = 32000 / baseTimerInterval;

// Proposed feature for next release.
protected transient Object applicationData;

Expand Down Expand Up @@ -1537,6 +1539,14 @@ public int getTimerT4() {
return T4;
}

/**
* @see gov.nist.javax.sip.stack.SIPTransaction#getTimerB()
*/
@Override
public int getTimerB() {
return timerB;
}

/**
* @see gov.nist.javax.sip.stack.SIPTransaction#setTimerD(int)
*/
Expand Down Expand Up @@ -1568,6 +1578,17 @@ public void setTimerT4(int interval) {
timerK = T4;
}

/**
* @see gov.nist.javax.sip.stack.SIPTransaction#setTimerB(int)
*/
@Override
public void setTimerB(int interval) {
if(interval <= 0) {
throw new IllegalArgumentException("Timer B value must be positive!");
}
timerB = interval / baseTimerInterval;
}

/**
* @see gov.nist.javax.sip.stack.SIPTransaction#getBaseTimerInterval()
*/
Expand Down