Re: problem with maddr Via parameter
"M. (Neo-Ranga) Ranganathan" <[email protected]>
| Newsgroups | gmane.comp.voip.nist-sip |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the careful analysis. I will look into this problem ( seems like it ought to be easy to fix) and commit a fix soon. Ranga On 9/7/06, Barton, Jim <[email protected]> wrote: > I came across an apparent bug in the nist-sip stack dealing with the > maddr Via parameter. I encountered a exception when doing a > ServerTransaction.sendResponse() on a received response. The stack trace > (sorry -- didn't save) showed that the exception was caused by cast > problem in Via.getMaddr(). I verified that that request did indeed > contain a maddr Via parameter; although the maddr appeared to me to be a > valid IP address. > > After looking through gov/nist/javax/sip/header/Via.java I discovered > that that the Via class is somewhat schizophrenic about the type of > object stored within the parameters collection for the maddr. There is > method Via.getMaddr() that assumes the maddr in the parameters > collection is a Host object. It directly casts the object to Host with > no further checking. This was the direct cause of the exception. There > is also another method Via.getmaddr() that assumes that the maddr is > stored as a String within parameters. > > With some debugging I verified that the maddr is actually stored by the > parser as a String, which should cause any later call of Via.getMaddr() > to throw a cast exception. (setMaddr() will actually create and store an > maddr as a host -- but the parser does not call this method). > > I am able to readily reproduce this problem in the 'simplecallsetup' > example by simply adding: > > viaHeader.setMAddr("224.1.1.1"); > > following the creation of the ViaHeader for the INVITE. No changes are > needed to the 'shootme' application. The shootist has no problem sending > that INVITE. The shootme has no problem initially processing the INVITE; > but later gets the bad cast exception when doing a sendResponse() on > that INVITE. > > Jim Barton > > > _______________________________________________ > nist-sip mailing list > [email protected] > http://www-x.antd.nist.gov/mailman/listinfo/nist-sip > -- M. Ranganathan "There are two ways to write error-free programs; only the third one works." -- Alan Perlis