org.mobicents.servlet.sip.proxy
Class ProxyBranchImpl

java.lang.Object
  extended by org.mobicents.servlet.sip.proxy.ProxyBranchImpl
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, ProxyBranch, ProxyBranchExt

public class ProxyBranchImpl
extends java.lang.Object
implements ProxyBranch, ProxyBranchExt, java.io.Externalizable

Author:
root
See Also:
Serialized Form

Field Summary
 javax.sip.header.ViaHeader viaHeader
           
 
Constructor Summary
ProxyBranchImpl()
           
ProxyBranchImpl(URI uri, ProxyImpl proxy)
           
 
Method Summary
 void addRecursedBranch(ProxyBranchImpl branch)
           
 void cancel()
           
 void cancel(java.lang.String[] protocol, int[] reasonCode, java.lang.String[] reasonText)
           
 void cancel1xxTimer()
          Stop the Extension Timer for 1xx.
 void cancelTimer()
          Stop the C Timer.
 boolean getAddToPath()
          
 SipURI getPathURI()
          
 SipServletRequestImpl getPrackOriginalRequest()
           
 Proxy getProxy()
           
 int getProxyBranch1xxTimeout()
           
 int getProxyBranchTimeout()
           
 boolean getRecordRoute()
          
 SipURI getRecordRouteURI()
           
 boolean getRecurse()
          
 java.util.List<ProxyBranch> getRecursedProxyBranches()
           
 SipServletRequest getRequest()
           
 SipServletResponse getResponse()
           
 boolean isCanceled()
           
 boolean isStarted()
           
 boolean isTimedOut()
          Has the branch timed out?
 boolean isWaitingForPrack()
           
 void onBranchTerminated()
           
 void onResponse(SipServletResponseImpl response, int status)
          A callback.
 void onTimeout(ResponseType responseType)
          This callback is called when the remote side has been idle too long while establishing the dialog.
 void proxyDialogStateless(SipServletRequestImpl request)
          This method proxies requests without updating JSIP dialog state.
 void proxySubsequentRequest(SipServletRequestImpl request)
          Call this method when a subsequent request must be proxied through the branch.
 void readExternal(java.io.ObjectInput in)
           
 void setAddToPath(boolean isAddToPath)
          
 void setOutboundInterface(java.net.InetAddress inetAddress)
          
 void setOutboundInterface(java.net.InetSocketAddress inetSocketAddress)
          
 void setOutboundInterface(SipURI outboundInterface)
           
 void setPrackOriginalRequest(SipServletRequestImpl prackOriginalRequest)
           
 void setProxy(ProxyImpl proxy)
           
 void setProxyBranch1xxTimeout(int timeout)
           
 void setProxyBranchTimeout(int seconds)
           
 void setRecordRoute(boolean isRecordRoute)
          
 void setRecurse(boolean isRecurse)
          
 void setResponse(SipServletResponseImpl response)
           
 void setWaitingForPrack(boolean waitingForPrack)
           
 void start()
          After the branch is initialized, this method proxies the initial request to the specified destination.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

viaHeader

public transient javax.sip.header.ViaHeader viaHeader
Constructor Detail

ProxyBranchImpl

public ProxyBranchImpl()

ProxyBranchImpl

public ProxyBranchImpl(URI uri,
                       ProxyImpl proxy)
Method Detail

cancel

public void cancel()
Specified by:
cancel in interface ProxyBranch

cancel

public void cancel(java.lang.String[] protocol,
                   int[] reasonCode,
                   java.lang.String[] reasonText)
Specified by:
cancel in interface ProxyBranch

onBranchTerminated

public void onBranchTerminated()

getProxy

public Proxy getProxy()
Specified by:
getProxy in interface ProxyBranch

getProxyBranchTimeout

public int getProxyBranchTimeout()
Specified by:
getProxyBranchTimeout in interface ProxyBranch

getRecordRouteURI

public SipURI getRecordRouteURI()
Specified by:
getRecordRouteURI in interface ProxyBranch

getRecursedProxyBranches

public java.util.List<ProxyBranch> getRecursedProxyBranches()
Specified by:
getRecursedProxyBranches in interface ProxyBranch

addRecursedBranch

public void addRecursedBranch(ProxyBranchImpl branch)

getRequest

public SipServletRequest getRequest()
Specified by:
getRequest in interface ProxyBranch

getResponse

public SipServletResponse getResponse()
Specified by:
getResponse in interface ProxyBranch

setResponse

public void setResponse(SipServletResponseImpl response)

isStarted

public boolean isStarted()
Specified by:
isStarted in interface ProxyBranch

setProxyBranchTimeout

public void setProxyBranchTimeout(int seconds)
Specified by:
setProxyBranchTimeout in interface ProxyBranch

start

public void start()
After the branch is initialized, this method proxies the initial request to the specified destination. Subsequent requests are proxied through proxySubsequentRequest


onResponse

public void onResponse(SipServletResponseImpl response,
                       int status)
A callback. Here we receive all responses from the proxied requests we have sent.

Parameters:
response -

isTimedOut

public boolean isTimedOut()
Has the branch timed out?

Returns:

proxySubsequentRequest

public void proxySubsequentRequest(SipServletRequestImpl request)
Call this method when a subsequent request must be proxied through the branch.

Parameters:
request -

proxyDialogStateless

public void proxyDialogStateless(SipServletRequestImpl request)
This method proxies requests without updating JSIP dialog state. PRACK and re-INVITE requests require this kind of handling because: 1. PRACK occurs before a dialog has been established (and also produces OKs before the final response) 2. re-INVITE when sent with the dialog method resets the internal JSIP CSeq counter to 1 every time you need it, which causes issues like http://groups.google.com/group/mobicents-public/browse_thread/thread/1a22ccdc4c481f47

Parameters:
request -

onTimeout

public void onTimeout(ResponseType responseType)
This callback is called when the remote side has been idle too long while establishing the dialog.


cancelTimer

public void cancelTimer()
Stop the C Timer.


cancel1xxTimer

public void cancel1xxTimer()
Stop the Extension Timer for 1xx.


isCanceled

public boolean isCanceled()

getAddToPath

public boolean getAddToPath()

Specified by:
getAddToPath in interface ProxyBranch

getPathURI

public SipURI getPathURI()

Specified by:
getPathURI in interface ProxyBranch

getRecordRoute

public boolean getRecordRoute()

Specified by:
getRecordRoute in interface ProxyBranch

getRecurse

public boolean getRecurse()

Specified by:
getRecurse in interface ProxyBranch

setAddToPath

public void setAddToPath(boolean isAddToPath)

Specified by:
setAddToPath in interface ProxyBranch

setOutboundInterface

public void setOutboundInterface(java.net.InetAddress inetAddress)

Specified by:
setOutboundInterface in interface ProxyBranch

setOutboundInterface

public void setOutboundInterface(java.net.InetSocketAddress inetSocketAddress)

Specified by:
setOutboundInterface in interface ProxyBranch

setOutboundInterface

public void setOutboundInterface(SipURI outboundInterface)
Specified by:
setOutboundInterface in interface ProxyBranchExt

setRecordRoute

public void setRecordRoute(boolean isRecordRoute)

Specified by:
setRecordRoute in interface ProxyBranch

setRecurse

public void setRecurse(boolean isRecurse)

Specified by:
setRecurse in interface ProxyBranch

setPrackOriginalRequest

public void setPrackOriginalRequest(SipServletRequestImpl prackOriginalRequest)
Parameters:
prackOriginalRequest - the prackOriginalRequest to set

getPrackOriginalRequest

public SipServletRequestImpl getPrackOriginalRequest()
Returns:
the prackOriginalRequest

isWaitingForPrack

public boolean isWaitingForPrack()

setWaitingForPrack

public void setWaitingForPrack(boolean waitingForPrack)

setProxy

public void setProxy(ProxyImpl proxy)
Parameters:
proxy - the proxy to set

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

getProxyBranch1xxTimeout

public int getProxyBranch1xxTimeout()
Specified by:
getProxyBranch1xxTimeout in interface ProxyBranchExt

setProxyBranch1xxTimeout

public void setProxyBranch1xxTimeout(int timeout)
Specified by:
setProxyBranch1xxTimeout in interface ProxyBranchExt


Copyright © 2010. All Rights Reserved.