AsteriskChannelImpl getChannelImplByNameAndActive ( String name ) { // In non bristuffed AST 1.2, we don't have uniqueid header to match the // channel // So we must use the channel name // Channel name is unique at any give moment in the * server // But asterisk-java keeps Hungup channels for a while. // We don't want to retrieve hungup channels. AsteriskChannelImpl channel = null ; if ( name == null ) { return null ; } synchronized ( channels ) { for ( AsteriskChannelImpl tmp : channels . values ( ) ) { if ( name . equals ( tmp . getName ( ) ) && tmp . getState ( ) != ChannelState . HUNGUP ) { channel = tmp ; } } } return channel ; }
Returns a NON - HUNGUP channel from the ChannelManager s cache with the given name .