idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
37,500
public final boolean isViaHeaderExternal ( ViaHeader viaHeader ) { if ( viaHeader != null ) { return isExternal ( viaHeader . getHost ( ) , viaHeader . getPort ( ) , viaHeader . getTransport ( ) ) ; } return true ; }
Check if the via header is external
37,501
public final boolean isExternal ( String host , int port , String transport ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "isExternal - host=" + host + ", port=" + port + ", transport=" + transport ) ; } boolean isExternal = true ; MobicentsExtendedListeningPoint listeningPoint = sipNetworkInterfaceManager ...
Check whether or not the triplet host port and transport are corresponding to an interface
37,502
private void resetOutboundInterfaces ( ) { List < SipURI > outboundInterfaces = sipNetworkInterfaceManager . getOutboundInterfaces ( ) ; for ( SipContext sipContext : applicationDeployed . values ( ) ) { sipContext . getServletContext ( ) . setAttribute ( javax . servlet . sip . SipServlet . OUTBOUND_INTERFACES , outbo...
set the outbound interfaces on all servlet context of applications deployed
37,503
public void creditGranted ( long amount , boolean finalUnits ) throws Exception { if ( CURRENT_STATE == SENT_INITIAL_RESERVATION ) { CURRENT_STATE = GRANTED_INITIAL_RESERVATION ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "credit granted : " ) ; } doInviteChargingAllowed ( this . inviteRequest ) ; } }
Ro Client Listener Implementation
37,504
public void recycle ( ) { proxyConfig . isProxyConfigSet = false ; sessionConfig . isSessionConfigSet = false ; loginConfig . isLoginConfigSet = false ; servletSelection . isMainServlet = false ; servletSelection . isServletMapping = false ; }
Reset counter used for validating the web . xml file .
37,505
private JBossConvergedSipMetaData mergeSipMetaDataAndSipAnnMetaData ( final DeploymentUnit deploymentUnit ) { final WarMetaData warMetaData = deploymentUnit . getAttachment ( WarMetaData . ATTACHMENT_KEY ) ; SipMetaData sipMetaData = deploymentUnit . getAttachment ( SipMetaData . ATTACHMENT_KEY ) ; SipAnnotationMetaDat...
merge DD and annotation meta data and store in WarMetaData . mergedJBossWebMetaData based on SIPWebContext code
37,506
private final void forwardResponseStatefully ( final SipServletResponseImpl sipServletResponse ) { final Response response = sipServletResponse . getResponse ( ) ; final ListIterator < ViaHeader > viaHeadersLeft = response . getHeaders ( ViaHeader . NAME ) ; if ( viaHeadersLeft . hasNext ( ) ) { viaHeadersLeft . next (...
this method is called when a B2BUA got the response so we don t have anything to do here or an app that didn t do anything with it or when handling the request an app had to be called but wasn t deployed the topmost via header is stripped from the response and the response is forwarded statefully
37,507
public void startNextUntriedBranch ( ) { if ( this . parallel ) throw new IllegalStateException ( "This method is only for sequantial proxying" ) ; for ( final MobicentsProxyBranch pbi : this . proxyBranches . values ( ) ) { if ( ! pbi . isStarted ( ) && ! pbi . isCanceled ( ) ) { pbi . start ( ) ; return ; } } }
In sequential proxying get some untried branch and start it then wait for response and repeat
37,508
public static DeploymentUnit getSipContextAnchorDu ( final DeploymentUnit du ) { DeploymentUnit parentDu = du . getParent ( ) ; if ( parentDu == null ) { return du ; } else if ( DeploymentTypeMarker . isType ( DeploymentType . EAR , parentDu ) ) { return parentDu ; } else { logger . error ( "Can't find proper anchor de...
returns the anchor deployment unit that will have attached a SIPWebContext
37,509
private void pushRoute ( javax . sip . address . SipURI sipUri ) { if ( ! isInitial ( ) && getSipSession ( ) . getProxy ( ) == null ) { throw new IllegalStateException ( "Cannot push route on subsequent requests, only intial ones" ) ; } else { if ( logger . isDebugEnabled ( ) ) logger . debug ( "Pushing route into mess...
Pushes a route header on initial request based on the jain sip sipUri given on parameter
37,510
private javax . sip . address . URI resolveSipOutbound ( final javax . sip . address . URI uriToResolve ) { if ( ! uriToResolve . isSipURI ( ) ) { return uriToResolve ; } final javax . sip . address . SipURI sipURI = ( javax . sip . address . SipURI ) uriToResolve ; if ( sipURI . getParameter ( MessageDispatcher . SIP_...
Check to see if the uri to resolve contains a ob parameter and if so try and locate a flow for this uri .
37,511
private void updateLinkedRequestAppDataMapping ( final ClientTransaction ctx , Dialog dialog ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "updateLinkedRequestAppDataMapping" ) ; } final Transaction linkedTransaction = linkedRequest . getTransaction ( ) ; final Dialog linkedDialog = linkedRequest . getDialo...
Keeping the transactions mapping in application data for CANCEL handling
37,512
private void addInfoForRoutingBackToContainer ( SipApplicationRouterInfo routerInfo , String applicationSessionId , String applicationName ) throws ParseException , SipException { final Request request = ( Request ) super . message ; final javax . sip . address . SipURI sipURI = JainSipUtils . createRecordRouteURI ( si...
Add a route header to route back to the container
37,513
private static RoutingState checkRoutingState ( SipServletRequestImpl sipServletRequest , Dialog dialog ) { if ( dialog != null && DialogState . CONFIRMED . equals ( dialog . getState ( ) ) ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "checkRoutingState - dialog not null and dialog state is CONFIRMED" ) ; ...
Method checking whether or not the sip servlet request in parameter is initial according to algorithm defined in JSR289 Appendix B
37,514
public MobicentsExtendedListeningPoint findMatchingListeningPoint ( String transport , final boolean strict ) { String tmpTransport = transport ; if ( tmpTransport == null ) { tmpTransport = ListeningPoint . UDP ; } Set < MobicentsExtendedListeningPoint > extendedListeningPoints = transportMappingCacheMap . get ( tmpTr...
Retrieve the first matching listening point corresponding to the transport .
37,515
public MobicentsExtendedListeningPoint findMatchingListeningPoint ( final String ipAddress , int port , String transport ) { String tmpTransport = transport ; int portChecked = checkPortRange ( port , tmpTransport ) ; if ( tmpTransport == null ) { tmpTransport = ListeningPoint . UDP ; } MobicentsExtendedListeningPoint ...
Retrieve the first matching listening Point corresponding to the ipAddress port and transport given in parameter .
37,516
protected void computeOutboundInterfaces ( ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Outbound Interface List : " ) ; } List < SipURI > newlyComputedOutboundInterfaces = new CopyOnWriteArrayList < SipURI > ( ) ; Set < String > newlyComputedOutboundInterfacesIpAddresses = new CopyOnWriteArraySet < String...
Compute all the outbound interfaces for this manager
37,517
private DatagramSocket initRandomPortSocket ( ) { int bindRetries = 5 ; int currentlyTriedPort = getRandomPortNumber ( JainSipUtils . MIN_PORT_NUMBER , JainSipUtils . MAX_PORT_NUMBER ) ; DatagramSocket resultSocket = null ; for ( int i = 0 ; i < bindRetries ; i ++ ) { try { resultSocket = new DatagramSocket ( currently...
Initializes and binds a socket that on a random port number . The method would try to bind on a random port and retry 5 times until a free port is found .
37,518
public void setToTag ( String toTag , boolean recomputeSessionId ) { this . toTag = toTag ; if ( toTag != null && recomputeSessionId ) { computeToString ( ) ; } }
Sets the to tag on the key when we receive a response . We recompute the session id only for derived session otherwise the id will change when the a request is received or sent and the response is sent back or received which should not happen See TCK test SipSessionListenerTest . testSessionDestroyed001
37,519
public static void removeSipSubcontext ( Context envCtx ) { try { envCtx . destroySubcontext ( SIP_SUBCONTEXT ) ; } catch ( NamingException e ) { logger . error ( sm . getString ( "naming.unbindFailed" , e ) ) ; } }
Removes the sip subcontext from JNDI
37,520
public static void addSipSubcontext ( Context envCtx ) { try { envCtx . createSubcontext ( SIP_SUBCONTEXT ) ; } catch ( NamingException e ) { logger . error ( sm . getString ( "naming.bindFailed" , e ) ) ; } }
Add the sip subcontext to JNDI
37,521
public static void removeAppNameSubContext ( Context envCtx , String appName ) { if ( envCtx != null ) { try { javax . naming . Context sipContext = ( javax . naming . Context ) envCtx . lookup ( SIP_SUBCONTEXT ) ; sipContext . destroySubcontext ( appName ) ; } catch ( NamingException e ) { logger . error ( sm . getStr...
Removes the app name subcontext from the jndi mapping
37,522
public static void removeSipSessionsUtil ( Context envCtx , String appName , SipSessionsUtil sipSessionsUtil ) { if ( envCtx != null ) { try { javax . naming . Context sipContext = ( javax . naming . Context ) envCtx . lookup ( SIP_SUBCONTEXT + "/" + appName ) ; sipContext . unbind ( SIP_SESSIONS_UTIL_JNDI_NAME ) ; } c...
Removes the sip sessions util binding from the jndi mapping
37,523
public static void removeTimerService ( Context envCtx , String appName , TimerService timerService ) { if ( envCtx != null ) { try { javax . naming . Context sipContext = ( javax . naming . Context ) envCtx . lookup ( SIP_SUBCONTEXT + "/" + appName ) ; sipContext . unbind ( TIMER_SERVICE_JNDI_NAME ) ; } catch ( Naming...
Removes the Timer Service binding from the jndi mapping
37,524
public static void removeSipFactory ( Context envCtx , String appName , SipFactory sipFactory ) { if ( envCtx != null ) { try { javax . naming . Context sipContext = ( javax . naming . Context ) envCtx . lookup ( SIP_SUBCONTEXT + "/" + appName ) ; sipContext . unbind ( SIP_FACTORY_JNDI_NAME ) ; } catch ( NamingExceptio...
Removes the sip factory binding from the jndi mapping
37,525
protected void handleSipOutbound ( final SipServletRequestImpl sipServletRequest ) { if ( ! JainSipUtils . DIALOG_CREATING_METHODS . contains ( sipServletRequest . getMethod ( ) ) ) { return ; } final Request request = ( Request ) sipServletRequest . getMessage ( ) ; final ContactHeader contact = ( ContactHeader ) requ...
NOTE! This is only a partial implementation and will only work when we are acting as a UAS as per RFC 5626 Section 4 . 3 . Sending Non - REGISTER Requests . Need to add some more logic for proxy scenarios . See RFC 5626 for exact details .
37,526
protected void registerSipConnector ( Connector connector ) { try { ObjectName objectName = createSipConnectorObjectName ( connector , getName ( ) , "SipConnector" ) ; Registry . getRegistry ( null , null ) . registerComponent ( connector , objectName , null ) ; } catch ( Exception e ) { logger . error ( "Error registe...
Register the sip connector under a different name than HTTP Connector and we add the transport to avoid clashing with 2 connectors having the same port and address
37,527
public void initializeSystemPortProperties ( ) { for ( Connector connector : connectors ) { if ( connector . getProtocol ( ) . contains ( "HTTP" ) ) { if ( connector . getSecure ( ) ) { System . setProperty ( "org.mobicents.properties.sslPort" , Integer . toString ( connector . getPort ( ) ) ) ; } else { System . setPr...
This method simply makes the HTTP and SSL ports avaialble everywhere in the JVM in order jsip ha to read them for balancer description purposes . There is no other good way to communicate the properies to jsip ha without adding more dependencies .
37,528
public static String [ ] getMissingSipMethods ( Collection < String > sipMethods ) { String [ ] methods = { } ; if ( sipMethods . size ( ) > 0 && sipMethods . containsAll ( ALL_SIP_METHODS ) == false ) { HashSet < String > missingMethods = new HashSet < String > ( ALL_SIP_METHODS ) ; missingMethods . removeAll ( sipMet...
Get sip methods in ALL_SIP_METHODS not in the argument sipMethods .
37,529
private Set < String > getAllComponentClasses ( DeploymentUnit deploymentUnit , CompositeIndex index , SipMetaData sipMetaData , SipAnnotationMetaData sipAnnotationMetaData ) { final Set < String > classes = new HashSet < String > ( ) ; if ( sipAnnotationMetaData != null ) { for ( Map . Entry < String , SipMetaData > m...
Gets all classes that are eligible for injection etc
37,530
public void addSipServletResponse ( SipServletResponseImpl sipServletResponse ) { if ( sipServletResponses == null ) { sipServletResponses = new CopyOnWriteArraySet < SipServletResponseImpl > ( ) ; } sipServletResponses . add ( sipServletResponse ) ; }
used to get access from the B2BUA to pending messages on the transaction
37,531
public void setMaxActiveSipSessions ( int max ) { int oldMaxActiveSipSessions = this . sipManagerDelegate . getMaxActiveSipSessions ( ) ; this . sipManagerDelegate . setMaxActiveSipSessions ( max ) ; support . firePropertyChange ( "maxActiveSipSessions" , Integer . valueOf ( oldMaxActiveSipSessions ) , Integer . valueO...
Set the maximum number of actives Sip Sessions allowed or - 1 for no limit .
37,532
public void setMaxActiveSipApplicationSessions ( int max ) { int oldMaxActiveSipApplicationSessions = this . sipManagerDelegate . getMaxActiveSipApplicationSessions ( ) ; this . sipManagerDelegate . setMaxActiveSipApplicationSessions ( max ) ; support . firePropertyChange ( "maxActiveSipApplicationSessions" , Integer ....
Set the maximum number of actives Sip Application Sessions allowed or - 1 for no limit .
37,533
public static boolean findPackageInfoinDirectory ( File file ) { if ( file . getName ( ) . equals ( "package-info.class" ) ) { FileInputStream stream = null ; try { stream = new FileInputStream ( file ) ; if ( findSipApplicationAnnotation ( stream ) ) return true ; } catch ( Exception e ) { } finally { try { stream . c...
Determine if there is a sip application in this folder .
37,534
public static boolean findSipApplicationAnnotation ( InputStream stream ) { try { byte [ ] rawClassBytes ; rawClassBytes = new byte [ stream . available ( ) ] ; stream . read ( rawClassBytes ) ; boolean one = contains ( rawClassBytes , SIP_APPLICATION_BYTES ) ; boolean two = contains ( rawClassBytes , ANNOTATION_BYTES ...
Determine if this stream contains SipApplication annotations
37,535
public String auth_getSession ( String authToken ) throws FacebookException , IOException { if ( null != this . _sessionKey ) { return this . _sessionKey ; } Document d = this . callMethod ( FacebookMethod . AUTH_GET_SESSION , new Pair < String , CharSequence > ( "auth_token" , authToken . toString ( ) ) ) ; this . _se...
Call this function to retrieve the session information after your user has logged in .
37,536
protected URL extractURL ( Document doc ) throws IOException { String url = doc . getFirstChild ( ) . getTextContent ( ) ; return ( null == url || "" . equals ( url ) ) ? null : new URL ( url ) ; }
Extracts a URL from a document that consists of a URL only .
37,537
private static void stripEmptyTextNodes ( Node n ) { NodeList children = n . getChildNodes ( ) ; int length = children . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { Node c = children . item ( i ) ; if ( ! c . hasChildNodes ( ) && c . getNodeType ( ) == Node . TEXT_NODE && c . getTextContent ( ) . trim ( ) ....
Hack ... since DOM reads newlines as textnodes we want to strip out those nodes to make it easier to use the tree .
37,538
public static void printDom ( Node n , String prefix ) { String outString = prefix ; if ( n . getNodeType ( ) == Node . TEXT_NODE ) { outString += "'" + n . getTextContent ( ) . trim ( ) + "'" ; } else { outString += n . getNodeName ( ) ; } System . out . println ( outString ) ; NodeList children = n . getChildNodes ( ...
Prints out the DOM tree .
37,539
public void run ( ) { final MobicentsSipApplicationSession sipApplicationSession = getApplicationSession ( ) ; SipContext sipContext = sipApplicationSession . getSipContext ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "running Servlet Timer " + id + " for sip application session " + sipApplicationSession...
Method that actually
37,540
private void estimateNextExecution ( ) { synchronized ( TIMER_LOCK ) { if ( fixedDelay ) { scheduledExecutionTime = period + System . currentTimeMillis ( ) ; } else { if ( firstExecution == 0 ) { firstExecution = scheduledExecutionTime ; } long now = System . currentTimeMillis ( ) ; long executedTime = ( numInvocations...
Helper to calculate when next execution time is .
37,541
public void addPermission ( String path ) { if ( path == null ) { return ; } if ( securityManager != null ) { Permission permission = null ; if ( path . startsWith ( "jndi:" ) || path . startsWith ( "jar:jndi:" ) ) { if ( ! path . endsWith ( "/" ) ) { path = path + "/" ; } permission = new JndiPermission ( path + "*" )...
If there is a Java SecurityManager create a read FilePermission or JndiPermission for the file directory path .
37,542
public void addPermission ( Permission permission ) { if ( ( securityManager != null ) && ( permission != null ) ) { permissionList . add ( permission ) ; } }
If there is a Java SecurityManager create a Permission .
37,543
public void stop ( ) throws LifecycleException { clearReferences ( ) ; int length = files . length ; for ( int i = 0 ; i < length ; i ++ ) { files [ i ] = null ; } length = jarFiles . length ; for ( int i = 0 ; i < length ; i ++ ) { try { if ( jarFiles [ i ] != null ) { jarFiles [ i ] . close ( ) ; } } catch ( IOExcept...
Stop the class loader .
37,544
protected void clearReferences ( ) { Enumeration drivers = DriverManager . getDrivers ( ) ; while ( drivers . hasMoreElements ( ) ) { Driver driver = ( Driver ) drivers . nextElement ( ) ; if ( driver . getClass ( ) . getClassLoader ( ) == this ) { try { DriverManager . deregisterDriver ( driver ) ; } catch ( SQLExcept...
Clear references .
37,545
protected boolean loadedByThisOrChild ( Class clazz ) { boolean result = false ; for ( ClassLoader classLoader = clazz . getClassLoader ( ) ; null != classLoader ; classLoader = classLoader . getParent ( ) ) { if ( classLoader . equals ( this ) ) { result = true ; break ; } } return result ; }
Determine whether a class was loaded by this class loader or one of its child class loaders .
37,546
protected Class findClassInternal ( String name ) throws ClassNotFoundException { if ( ! validate ( name ) ) throw new ClassNotFoundException ( name ) ; String tempPath = name . replace ( '.' , '/' ) ; String classPath = tempPath + ".class" ; ResourceEntry entry = null ; entry = findResourceInternal ( name , classPath ...
Find specified class in local repositories .
37,547
protected ResourceEntry findResourceInternal ( File file , String path ) { ResourceEntry entry = new ResourceEntry ( ) ; try { entry . source = getURI ( new File ( file , path ) ) ; entry . codeBase = getURL ( new File ( file , path ) , false ) ; } catch ( MalformedURLException e ) { return null ; } return entry ; }
Find specified resource in local repositories . This block will execute under an AccessControl . doPrivilege block .
37,548
protected boolean filter ( String name ) { if ( name == null ) return false ; String packageName = null ; int pos = name . lastIndexOf ( '.' ) ; if ( pos != - 1 ) packageName = name . substring ( 0 , pos ) ; else return false ; for ( int i = 0 ; i < packageTriggers . length ; i ++ ) { if ( packageName . startsWith ( pa...
Filter classes .
37,549
protected static void deleteDir ( File dir ) { String files [ ] = dir . list ( ) ; if ( files == null ) { files = new String [ 0 ] ; } for ( int i = 0 ; i < files . length ; i ++ ) { File file = new File ( dir , files [ i ] ) ; if ( file . isDirectory ( ) ) { deleteDir ( file ) ; } else { try { file . delete ( ) ; } ca...
Delete the specified directory including all of its contents and subdirectories recursively .
37,550
private final static String basePhoneNumber ( String number ) throws ParseException { StringBuffer s = new StringBuffer ( ) ; Lexer lexer = new Lexer ( "sip_urlLexer" , number ) ; int lc = 0 ; while ( lexer . hasMoreChars ( ) ) { char w = lexer . lookAhead ( 0 ) ; if ( Lexer . isDigit ( w ) || w == '-' || w == '.' || w...
the part in comment
37,551
private static Properties loadProperties ( String defaultsName , String propertiesName ) throws IOException { Properties bundle = new Properties ( ) ; ClassLoader loader = SecurityActions . getContextClassLoader ( ) ; URL defaultUrl = null ; URL url = null ; if ( loader instanceof URLClassLoader ) { URLClassLoader ucl ...
helper method to load digest user property file . Copied from org . jboss . security . auth . spi . Util
37,552
protected static String removeQuotes ( String quotedString , boolean quotesRequired ) { if ( quotedString . length ( ) > 0 && quotedString . charAt ( 0 ) != '"' && ! quotesRequired ) { return quotedString ; } else if ( quotedString . length ( ) > 2 ) { return quotedString . substring ( 1 , quotedString . length ( ) - 1...
Removes the quotes on a string . RFC2617 states quotes are optional for all parameters except realm .
37,553
protected synchronized MessageDigest getDigest ( ) { if ( this . digest == null ) { try { this . digest = MessageDigest . getInstance ( algorithm ) ; } catch ( NoSuchAlgorithmException e ) { try { this . digest = MessageDigest . getInstance ( DEFAULT_ALGORITHM ) ; } catch ( NoSuchAlgorithmException f ) { this . digest ...
Return the MessageDigest object to be used for calculating session identifiers . If none has been created yet initialize one the first time this method is called .
37,554
protected synchronized Random getRandom ( ) { if ( this . random == null ) { try { Class clazz = Class . forName ( randomClass ) ; this . random = ( Random ) clazz . newInstance ( ) ; long seed = System . currentTimeMillis ( ) ; char [ ] entropy = getEntropy ( ) . toCharArray ( ) ; for ( int i = 0 ; i < entropy . lengt...
Return the random number generator instance we should use for generating session identifiers . If there is no such generator currently defined construct and seed a new one .
37,555
public static int getAddressOutboundness ( String address ) { if ( address . startsWith ( "127.0" ) ) return 0 ; if ( address . startsWith ( "192.168" ) ) return 1 ; if ( address . startsWith ( "10." ) ) return 2 ; if ( address . startsWith ( "172.16" ) || address . startsWith ( "172.17" ) || address . startsWith ( "17...
RFC 1918 address spaces
37,556
public ViaHeader createViaHeader ( String branch , boolean usePublicAddress ) { try { String host = getIpAddress ( usePublicAddress ) ; ViaHeader via = SipFactoryImpl . headerFactory . createViaHeader ( host , port , transport , branch ) ; return via ; } catch ( ParseException ex ) { logger . error ( "Unexpected error ...
Create a Via Header based on the host port and transport of this listening point
37,557
public javax . sip . address . SipURI createRecordRouteURI ( boolean usePublicAddress ) { try { String host = getIpAddress ( usePublicAddress ) ; SipURI sipUri = SipFactoryImpl . addressFactory . createSipURI ( null , host ) ; sipUri . setPort ( port ) ; sipUri . setTransportParam ( transport ) ; return sipUri ; } catc...
Create a Record Route URI based on the host port and transport of this listening point
37,558
public void removeCorrespondingSipApplicationSession ( MobicentsSipApplicationSessionKey sipApplicationSession ) { joinApplicationSession . remove ( sipApplicationSession ) ; replacesApplicationSession . remove ( sipApplicationSession ) ; Iterator < MobicentsSipApplicationSessionKey > it = joinApplicationSession . valu...
Add a mapping between a corresponding sipSession related to a headerName . See Also getCorrespondingSipSession method .
37,559
public void notifySipSessionListeners ( SipSessionEventType sipSessionEventType ) { MobicentsSipApplicationSession sipApplicationSession = getSipApplicationSession ( ) ; if ( sipApplicationSession != null ) { SipContext sipContext = sipApplicationSession . getSipContext ( ) ; List < SipSessionListener > sipSessionListe...
Notifies the listeners that a lifecycle event occured on that sip session
37,560
protected boolean hasOngoingTransaction ( ) { if ( ! isSupervisedMode ( ) ) { return false ; } else { if ( ongoingTransactions != null ) { for ( Transaction transaction : ongoingTransactions ) { if ( TransactionState . CALLING . equals ( transaction . getState ( ) ) || TransactionState . TRYING . equals ( transaction ....
Removed from the interface in PFD stage so making it protected
37,561
public void addOngoingTransaction ( Transaction transaction ) { if ( transaction != null && ongoingTransactions != null && ! isReadyToInvalidate ( ) ) { boolean added = this . ongoingTransactions . add ( transaction ) ; if ( added ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "transaction " + transaction + ...
Add an ongoing tx to the session .
37,562
public void removeOngoingTransaction ( Transaction transaction ) { boolean removed = false ; if ( this . ongoingTransactions != null ) { removed = this . ongoingTransactions . remove ( transaction ) ; } if ( proxy != null ) { proxy . removeTransaction ( transaction . getBranchId ( ) ) ; } if ( logger . isDebugEnabled (...
Remove an ongoing tx to the session .
37,563
public void onReadyToInvalidate ( ) { if ( isB2BUAOrphan ( ) ) { logger . debug ( "Session is B2BUA Orphaned, lets invalidate" ) ; setReadyToInvalidate ( true ) ; } if ( ! readyToInvalidate ) { logger . debug ( "Session not ready to invalidate, wait next chance." ) ; return ; } boolean allDerivedReady = true ; Iterator...
This method is called immediately when the conditions for read to invalidate session are met
37,564
public void setAckReceived ( long cSeq , boolean ackReceived ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "setting AckReceived to : " + ackReceived + " for CSeq " + cSeq ) ; } acksReceived . put ( cSeq , ackReceived ) ; if ( ackReceived ) { cleanupAcksReceived ( cSeq ) ; } }
Setting ackReceived for CSeq to specified value in second param . if the second param is true it will try to cleanup earlier cseq as well to save on memory
37,565
protected boolean isAckReceived ( long cSeq ) { if ( acksReceived == null ) { return true ; } Boolean ackReceived = acksReceived . get ( cSeq ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "isAckReceived for CSeq " + cSeq + " : " + ackReceived ) ; } if ( ackReceived == null ) { return true ; } return ackRece...
check if the ack has been received for the cseq in param it may happen that the ackReceived has been removed already if that s the case it will return true
37,566
protected void cleanupAcksReceived ( long remoteCSeq ) { List < Long > toBeRemoved = new ArrayList < Long > ( ) ; final Iterator < Entry < Long , Boolean > > cSeqs = acksReceived . entrySet ( ) . iterator ( ) ; while ( cSeqs . hasNext ( ) ) { final Entry < Long , Boolean > entry = cSeqs . next ( ) ; final long cSeq = e...
We clean up the stored acks received when the remoteCSeq in param is greater and that the ackReceived is true
37,567
public boolean validateCSeq ( MobicentsSipServletRequest sipServletRequest ) { final Request request = ( Request ) sipServletRequest . getMessage ( ) ; final long localCseq = cseq ; final long remoteCSeq = ( ( CSeqHeader ) request . getHeader ( CSeqHeader . NAME ) ) . getSeqNumber ( ) ; final String method = request . ...
CSeq validation should only be done for non proxy applications
37,568
protected void doMessage ( SipServletRequest request ) throws ServletException , IOException { request . createResponse ( SipServletResponse . SC_OK ) . send ( ) ; Object message = request . getContent ( ) ; String from = request . getFrom ( ) . getURI ( ) . toString ( ) ; logger . info ( "from is " + from ) ; if ( mes...
This is called by the container when a MESSAGE message arrives .
37,569
protected void doErrorResponse ( SipServletResponse response ) throws ServletException , IOException { String receiver = response . getTo ( ) . toString ( ) ; removeUser ( receiver ) ; }
This is called by the container when an error is received regarding a sent message including timeouts .
37,570
private static MimeMultipart getContentAsMimeMultipart ( ContentTypeHeader contentTypeHeader , byte [ ] rawContent ) { String delimiter = contentTypeHeader . getParameter ( MULTIPART_BOUNDARY ) ; String start = contentTypeHeader . getParameter ( MULTIPART_START ) ; MimeMultipart mimeMultipart = new MimeMultipart ( cont...
Return a mimemultipart from raw Content FIXME Doesn t support nested multipart in the body content
37,571
public final MobicentsSipSession getSipSession ( ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getSipSession" ) ; } if ( sipSession == null && sessionKey == null ) { sessionKey = getSipSessionKey ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "sessionKey is " + sessionKey ) ; } if ( sessionKey...
Retrieve the sip session implementation
37,572
protected ModifiableRule retrieveModifiableOverriden ( ) { ModifiableRule overridenRule = null ; SipSession session = getSession ( ) ; if ( session != null && session . getServletContext ( ) != null ) { String overridenRuleStr = session . getServletContext ( ) . getInitParameter ( SYS_HDR_MOD_OVERRIDE ) ; if ( override...
Allows to override the System header modifiable rule assignment .
37,573
protected static String getFullHeaderName ( String headerName ) { String fullName = null ; if ( JainSipUtils . HEADER_COMPACT_2_FULL_NAMES_MAPPINGS . containsKey ( headerName ) ) { fullName = JainSipUtils . HEADER_COMPACT_2_FULL_NAMES_MAPPINGS . get ( headerName ) ; } else { fullName = headerName ; } if ( logger . isDe...
This method tries to resolve header name - meaning if it is compact - it returns full name if its not it returns passed value .
37,574
public static String getCompactName ( String headerName ) { String compactName = null ; if ( JainSipUtils . HEADER_COMPACT_2_FULL_NAMES_MAPPINGS . containsKey ( headerName ) ) { compactName = JainSipUtils . HEADER_COMPACT_2_FULL_NAMES_MAPPINGS . get ( headerName ) ; } else { compactName = JainSipUtils . HEADER_FULL_TO_...
This method tries to determine compact header name - if passed value is compact form it is returned otherwise method tries to find compact name - if it is found string rpresenting compact name is returned otherwise null!!!
37,575
protected boolean containsRel100 ( Message message ) { ListIterator < SIPHeader > requireHeaders = message . getHeaders ( RequireHeader . NAME ) ; if ( requireHeaders != null ) { while ( requireHeaders . hasNext ( ) ) { if ( REL100_OPTION_TAG . equals ( requireHeaders . next ( ) . getValue ( ) ) ) { return true ; } } }...
we check all the values of Require and Supported headers to make sure the 100rel is present
37,576
protected void processConcurrencyAnnotation ( Class clazz ) { if ( sipContext . getConcurrencyControlMode ( ) == null ) { Package pack = clazz . getPackage ( ) ; if ( pack != null ) { ConcurrencyControl concurrencyControl = pack . getAnnotation ( ConcurrencyControl . class ) ; if ( concurrencyControl != null ) { if ( l...
Check if the
37,577
public void sendHeartBeat ( String ipAddress , int port ) throws Exception { MBeanServer mbeanServer = getMBeanServer ( ) ; Set < ObjectName > queryNames = mbeanServer . queryNames ( new ObjectName ( "*:type=Service,*" ) , null ) ; for ( ObjectName objectName : queryNames ) { mbeanServer . invoke ( objectName , "sendHe...
Send a heartbeat to the specified Ip address and port via this listening point . This method can be used to send out a period Double CR - LF for NAT keepalive as defined in RFC5626
37,578
protected void doRequest ( javax . servlet . sip . SipServletRequest req ) throws javax . servlet . ServletException , java . io . IOException { String m = req . getMethod ( ) ; if ( "INVITE" . equals ( m ) ) doInvite ( req ) ; else if ( "ACK" . equals ( m ) ) doAck ( req ) ; else if ( "OPTIONS" . equals ( m ) ) doOpti...
Invoked to handle incoming requests . This method dispatched requests to one of the doXxx methods where Xxx is the SIP method used in the request . Servlets will not usually need to override this method .
37,579
protected void doResponse ( javax . servlet . sip . SipServletResponse resp ) throws javax . servlet . ServletException , java . io . IOException { int status = resp . getStatus ( ) ; if ( status < 200 ) { doProvisionalResponse ( resp ) ; } else { if ( status < 300 ) { doSuccessResponse ( resp ) ; } else if ( status < ...
Invoked to handle incoming responses . This method dispatched responses to one of the . Servlets will not usually need to override this method .
37,580
public static String decode ( String uri ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "uri to decode " + uri ) ; } if ( uri == null ) { return null ; } if ( uri . indexOf ( UTF8_ESCAPE_CHAR ) < 0 ) { return uri ; } StringBuffer translatedUri = new StringBuffer ( uri . length ( ) ) ; byte [ ] encodedchars =...
Decode a path .
37,581
private void dispatchOutsideContainer ( SipServletRequestImpl sipServletRequest ) throws DispatcherException { final Request request = ( Request ) sipServletRequest . getMessage ( ) ; if ( logger . isInfoEnabled ( ) ) { logger . info ( "Dispatching the request event outside the container" ) ; } if ( request . getReques...
Dispatch a request outside the container
37,582
private final MobicentsSipApplicationSession retrieveTargetedApplication ( String targetedApplicationKey ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "retrieveTargetedApplication - targetedApplicationKey=" + targetedApplicationKey ) ; } if ( targetedApplicationKey != null && targetedApplicationKey . length...
Section 15 . 11 . 3 Encode URI Mechanism The container MUST use the encoded URI to locate the targeted SipApplicationSession object . If a valid SipApplicationSession is found the container must determine the name of the application that owns the SipApplicationSession object .
37,583
private MobicentsSipSession retrieveSipSession ( Dialog dialog ) { if ( dialog != null ) { Iterator < SipContext > iterator = sipApplicationDispatcher . findSipApplications ( ) ; while ( iterator . hasNext ( ) ) { SipContext sipContext = iterator . next ( ) ; SipManager sipManager = sipContext . getSipManager ( ) ; Ite...
Try to find a matching Sip Session to a given dialog
37,584
public String getBasePath ( ) { String docBase = null ; Container container = this ; while ( container != null ) { if ( container instanceof Host ) break ; container = container . getParent ( ) ; } File file = new File ( getDocBase ( ) ) ; if ( ! file . isAbsolute ( ) ) { if ( container == null ) { docBase = ( new File...
Get base path . Copy pasted from StandardContext Tomcat class
37,585
private String getNamingContextName ( ) { if ( namingContextName == null ) { Container parent = getParent ( ) ; if ( parent == null ) { namingContextName = getName ( ) ; } else { Stack < String > stk = new Stack < String > ( ) ; StringBuffer buff = new StringBuffer ( ) ; while ( parent != null ) { stk . push ( parent ....
Get naming context full name .
37,586
public JSONObject jsonify ( ) { JSONObject ret = new JSONObject ( ) ; if ( null != this . _attributesString ) { for ( Map . Entry < ApplicationProperty , CharSequence > entry : this . _attributesString . entrySet ( ) ) { ret . put ( entry . getKey ( ) . propertyName ( ) , entry . getValue ( ) . toString ( ) ) ; } } if ...
Return a JSON representation of this property set object
37,587
public MobicentsSipSession removeSipSession ( final MobicentsSipSessionKey key ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Removing a sip session with the key : " + key ) ; } return sipSessions . remove ( key ) ; }
Removes a sip session from the manager by its key
37,588
public MobicentsSipApplicationSession removeSipApplicationSession ( final MobicentsSipApplicationSessionKey key ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Removing a sip application session with the key : " + key ) ; } MobicentsSipApplicationSession sipApplicationSession = sipApplicationSessions . remov...
Removes a sip application session from the manager by its key
37,589
public MobicentsSipApplicationSession getSipApplicationSession ( final SipApplicationSessionKey key , final boolean create ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getSipApplicationSession with key=" + key ) ; } MobicentsSipApplicationSession sipApplicationSessionImpl = null ; final String appGenerate...
Retrieve a sip application session from its key . If none exists one can enforce the creation through the create parameter to true .
37,590
public MobicentsSipSession getSipSession ( final SipSessionKey key , final boolean create , final SipFactoryImpl sipFactoryImpl , final MobicentsSipApplicationSession sipApplicationSessionImpl ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "getSipSession - key=" + key + ", create=" + create + ", sipApplicati...
Retrieve a sip session from its key . If none exists one can enforce the creation through the create parameter to true . the sip factory cannot be null if create is set to true .
37,591
public MobicentsSipApplicationSession findSipApplicationSession ( HttpSession httpSession ) { for ( MobicentsSipApplicationSession sipApplicationSessionImpl : sipApplicationSessions . values ( ) ) { if ( sipApplicationSessionImpl . findHttpSession ( httpSession . getId ( ) ) != null ) { return sipApplicationSessionImpl...
Retrieves the sip application session holding the converged http session in parameter
37,592
public void removeAllSessions ( ) { List < SipSessionKey > sipSessionsToRemove = new ArrayList < SipSessionKey > ( ) ; for ( SipSessionKey sipSessionKey : sipSessions . keySet ( ) ) { sipSessionsToRemove . add ( sipSessionKey ) ; } for ( SipSessionKey sipSessionKey : sipSessionsToRemove ) { removeSipSession ( sipSessio...
Remove the sip sessions and sip application sessions
37,593
public MobicentsSipApplicationSession createApplicationSession ( SipContext sipContext ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Creating new application session for sip context " + sipContext . getApplicationName ( ) ) ; } SipApplicationSessionKey sipApplicationSessionKey = SessionManagerUtil . getSip...
Creates an application session associated with the context
37,594
private static void validateCreation ( String method , SipApplicationSession app ) { if ( method . equals ( Request . ACK ) ) { throw new IllegalArgumentException ( "Wrong method to create request with[" + Request . ACK + "]!" ) ; } if ( method . equals ( Request . PRACK ) ) { throw new IllegalArgumentException ( "Wron...
Does basic check for illegal methods wrong state if it finds it throws exception
37,595
public void init ( ) { defaultApplicationRouterParser . init ( ) ; try { defaultSipApplicationRouterInfos = defaultApplicationRouterParser . parse ( ) ; } catch ( ParseException e ) { log . fatal ( "Impossible to parse the default application router configuration file" , e ) ; throw new IllegalArgumentException ( "Impo...
load the configuration file as defined in appendix C of JSR289
37,596
public static void pushRunAsIdentity ( final RunAsIdentity principal ) { AccessController . doPrivileged ( new PrivilegedAction < Void > ( ) { public Void run ( ) { SecurityContext sc = getSecurityContext ( ) ; if ( sc == null ) throw MESSAGES . noSecurityContext ( ) ; sc . setOutgoingRunAs ( principal ) ; return null ...
Sets the run as identity
37,597
public static RunAs popRunAsIdentity ( ) { return AccessController . doPrivileged ( new PrivilegedAction < RunAs > ( ) { public RunAs run ( ) { SecurityContext sc = getSecurityContext ( ) ; if ( sc == null ) throw MESSAGES . noSecurityContext ( ) ; RunAs principal = sc . getOutgoingRunAs ( ) ; sc . setOutgoingRunAs ( n...
Removes the run as identity
37,598
public static String hashString ( String input , int length ) { MessageDigest md ; try { md = MessageDigest . getInstance ( "SHA" ) ; } catch ( NoSuchAlgorithmException e ) { throw new IllegalArgumentException ( "The SHA Algorithm could not be found" , e ) ; } byte [ ] bytes = input . getBytes ( ) ; md . update ( bytes...
Compute hash value of a string
37,599
public void deploy ( final DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; SipAnnotationMetaData sipAnnotationsMetaData = deploymentUnit . getAttachment ( SipAnnotationMetaData . ATTACHMENT_KEY ) ; if ( sipAnno...
Process web annotations .