Re: Multiple stack instances works in version 1.2
"M. Ranganathan" <[email protected]>
| Newsgroups | gmane.comp.voip.nist-sip |
|---|---|
| Message-ID | <[email protected]> |
Thanks. One correction -- All deprecated features except for
RETRANSMISSION_FILTER (which nobody was using anyway) will be
implemented by the RI but not tested for in the TCK.
Regards,
Ranga
Becky McElroy wrote:
> Thanks for the insight, Ranga.
> And especially, thanks for all your and others' efforts on this project.
> Regards,
> Becky
>
> M. Ranganathan wrote:
>
>> Becky,
>>
>> This is a backwards compatibility (deprecated) feature that may or
>> may not work with other JAIN-SIP implementations. Implementations
>> SHOULD (it is strongly recommeded that they do) support multiple
>> stacks if the javax.sip.IP_ADDRESS property is specified -- each call
>> to careate a new stack gets its own instance. The RI will support it
>> and complaint implemetations *SHOULD* support it if they care about
>> backwards compatibility. The TCK will not test for deprecated
>> features but the RI will implement all deprecated features.
>>
>> The current best practice would be to have a single stack and
>> multiple Listening points, each with its own IP address and port.
>> Note that each vendor (i.e. specified by path) gets its own stack
>> instance however, so you can still have multiple stacks -- just not
>> multiple stacks per vendor in a given jvm.
>>
>> Ranga
>>
>> Becky McElroy wrote:
>>
>>> Hi,
>>>
>>> I certainly don't want to complain about this... just want to
>>> understand it. I thought I saw someone say that in the new 1.2 stack
>>> version, multiple SipStack's on one box wouldn't work. However, it
>>> seems to work fine (I updated from CVS this past weekend).
>>>
>>> From my test program I can create two SipStacks, just like before,
>>> using two different sets of properties with different IP addresses
>>> and ports (same SipFactory used to create both stacks, a different
>>> listening point per stack, same SipListener listening to both).
>>> Everything gets created fine and messaging between two test phones
>>> (1 per stack) works fine, with or without a proxy inbetween.
>>>
>>> Again, not to complain (this is great) but just want to know if this
>>> setup will continue to work as is, or can we expect it to break at
>>> some point.
>>>
>>> Thanks,
>>> Becky
>>>
>>> ______________________________________
>>>
>>> public class TestTwoSipStacksNoProxy extends SipTestCase
>>> {
>>> private static String IP_ADDRESS_1 = "127.0.0.1";
>>> private static String IP_ADDRESS_2 = "192.168.1.102";
>>> private SipStack sipStack1;
>>> private SipStack sipStack2;
>>>
>>> private SipPhone ua;
>>>
>>> private Properties properties1 = new Properties();
>>> private Properties properties2 = new Properties();
>>>
>>> public TestTwoSipStacksNoProxy(String arg0)
>>> {
>>> super(arg0);
>>> // when both stacks use same IP addr, get
>>> TooManyListenersException
>>> properties1.setProperty("javax.sip.IP_ADDRESS", IP_ADDRESS_1);
>>> properties1.setProperty("javax.sip.RETRANSMISSION_FILTER",
>>> "true");
>>> properties1.setProperty("javax.sip.STACK_NAME", "testAgent");
>>> properties1.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
>>> properties1.setProperty("gov.nist.javax.sip.DEBUG_LOG",
>>> "testAgent_debug.txt");
>>> properties1.setProperty("gov.nist.javax.sip.SERVER_LOG",
>>> "testAgent_log.txt");
>>> properties1.setProperty("gov.nist.javax.sip.READ_TIMEOUT",
>>> "1000");
>>>
>>> properties2.setProperty("javax.sip.IP_ADDRESS", IP_ADDRESS_2);
>>> properties2.setProperty("javax.sip.RETRANSMISSION_FILTER",
>>> "true");
>>> properties2.setProperty("javax.sip.STACK_NAME", "testAgent2");
>>> properties2.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
>>> properties2.setProperty("gov.nist.javax.sip.DEBUG_LOG",
>>> "testAgent2_debug.txt");
>>> properties2.setProperty("gov.nist.javax.sip.SERVER_LOG",
>>> "testAgent2_log.txt");
>>> properties2.setProperty("gov.nist.javax.sip.READ_TIMEOUT",
>>> "1000");
>>> }
>>>
>>> /*
>>> * @see SipTestCase#setUp()
>>> */
>>> public void setUp() throws Exception
>>> {
>>> try
>>> {
>>> sipStack1 = new SipStack(null, 5060, properties1); //
>>> this would be org.cafesip.sipunit.SipStack
>>> sipStack2 = new SipStack(null, 5090, properties2); // ditto
>>> }
>>> catch (Exception ex)
>>> {
>>> fail("Exception: " + ex.getClass().getName() + ": "
>>> + ex.getMessage());
>>> throw ex;
>>> }
>>>
>>> try
>>> {
>>> ua = sipStack1.createSipPhone("sip:[email protected]");
>>> }
>>> catch (Exception ex)
>>> {
>>> fail("Exception creating SipPhone: " +
>>> ex.getClass().getName()
>>> + ": " + ex.getMessage());
>>> throw ex;
>>> }
>>> }
>>>
>>> etc.
>>> }
>>>
>>>
>>> org.cafesip.sipunit.SipStack:
>>>
>>> /**
>>> * A constructor for this class. Before establishing any SIP
>>> sessions,
>>> * instantiate this class. You may provide the parameters for SIP
>>> protocol
>>> * binding on a specific TCP/UDP port, which will be used to
>>> communicate
>>> * with external SIP agents (a SIP proxy server, for example). A
>>> test
>>> * program may contain one or more SipStack objects, each of
>>> which may have
>>> * one or more SipPhones.
>>> *
>>> * @param proto
>>> * SIP transport protocol, "tcp" or "udp" (default is
>>> "udp").
>>> * @param port
>>> * port on which this stack listens for messages
>>> (default is
>>> * 5060).
>>> * @param props
>>> * properties of the SIP stack. These properties are
>>> the same as
>>> * that defined for JAIN-SIP SipStack. If this
>>> parameter has a
>>> * null value, we pick default values for you.
>>> * @throws Exception
>>> */
>>> public SipStack(String proto, int port, Properties props) throws
>>> Exception
>>> {
>>> if (sipFactory == null)
>>> {
>>> sipFactory = SipFactory.getInstance();
>>> sipFactory.setPathName("gov.nist");
>>> }
>>>
>>> if (props == null)
>>> {
>>> props = defaultProperties;
>>> }
>>>
>>> if (props.getProperty("javax.sip.STACK_NAME") == null)
>>> {
>>> props.setProperty("javax.sip.STACK_NAME",
>>> "SipUnitTestAgent");
>>> }
>>>
>>> sipStack = sipFactory.createSipStack(props);
>>>
>>> headerFactory = sipFactory.createHeaderFactory();
>>> addressFactory = sipFactory.createAddressFactory();
>>> messageFactory = sipFactory.createMessageFactory();
>>>
>>> if (proto == null)
>>> {
>>> proto = DEFAULT_PROTOCOL;
>>> }
>>>
>>> if (port < 0)
>>> {
>>> port = DEFAULT_PORT;
>>> }
>>>
>>> ListeningPoint lp = sipStack.createListeningPoint(port, proto);
>>>
>>> sipProvider = sipStack.createSipProvider(lp);
>>> sipProvider.addSipListener(this);
>>> }
>>>
>>> etc.
>>>
>>>
>>> _______________________________________________
>>> nist-sip mailing list
>>> [email protected]
>>> http://www-x.antd.nist.gov/mailman/listinfo/nist-sip
>>>
>>
>>
>
>
--
M. Ranganathan
Advanced Networking Technologies Division,
National Institute of Standards and Technology (NIST),
100 Bureau Drive, Stop 8920, Gaithersburg, MD 20899.
tel:301 975 3664 , fax:301 590 0932 http://w3.antd.nist.gov/
Advanced Networking Technologies For the People!