Skip to content

Commit

Permalink
fixes RestComm#112
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimecasero committed Sep 30, 2016
1 parent eb6b8cd commit 1f12e16
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/gov/nist/javax/sdp/SessionDescriptionImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ public SessionDescriptionImpl(SessionDescription otherSessionDescription)
URIField otherUriField = (URIField) otherSessionDescription.getURI();
if (otherUriField != null) {
URIField newUF = new URIField();
newUF.setURI(otherUriField.toString());
//fixes https://github.com/RestComm/jain-sip/issues/112
//URL is final, we can reuse object in this case
newUF.set(otherUriField.get());
this.setURI(newUF);
}

Expand Down
14 changes: 9 additions & 5 deletions src/test/gov/nist/javax/sdp/parser/SdpParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,28 @@ public class SdpParserTest extends TestCase {
"\r\n " + "v=0\r\n" + "o=4855 13760799956958020 13760799956958020" + " IN IP4 129.6.55.78\r\n" + "s=mysession session\r\n"
+ "p=+46 8 52018010\r\n" + "c=IN IP4 129.6.55.78\r\n" + "t=0 0\r\n" + "m=audio 6022 RTP/AVP 0 4 18\r\n"
+ "a=rtpmap:0 PCMU/8000\r\n" + "a=rtpmap:4 G723/8000\r\n" + "a=rtpmap:18 G729A/8000\r\n" +
"a=ptime:20\r\n",
"a=ptime:20\r\n" + "u=http://www.example.com/seminars/sdp.pdf\r\n",

"v=0\r\n" + "o=root 14539767 1208 IN IP4 66.237.65.67\r\n" + "s=session\r\n"
+ "t=0 0\r\n" + "m=audio 38658 RTP/AVP 3 110 97 0 8 101\r\n" + "c=IN IP4 66.237.65.67\r\n" +
"a=rtpmap:3 GSM/8000\r\n" + "a=rtpmap:110 speex/8000\r\n"
+ "a=rtpmap:97 iLBC/8000\r\n" +
"a=rtpmap:0 PCMU/8000\r\n" + "a=rtpmap:8 PCMA/8000\r\n"
+ "a=rtpmap:101 telephone-event/8000\r\n" + "a=fmtp:101 0-16\r\n" + "a=silenceSupp:off - - - -\r\n",
+ "a=rtpmap:101 telephone-event/8000\r\n" + "a=fmtp:101 0-16\r\n" + "a=silenceSupp:off - - - -\r\n"
+ "u=http://www.example.com/seminars/sdp.pdf\r\n",

"v=0\r\n" + "o=Cisco-SIPUA 10163 1 IN IP4 192.168.0.103\r\n" + "s=SIP Call\r\n"
+ "t=0 0\r\n" + "m=audio 27866 RTP/AVP 0 8 18 101\r\n" + "c=IN IP4 192.168.0.103\r\n" +
"a=rtpmap:0 PCMU/8000\r\n" + "a=rtpmap:8 PCMA/8000\r\n" + "a=rtpmap:18 G729/8000\r\n" +
"a=fmtp:18 annexb=no\r\n" + "a=rtpmap:101 telephone-event/8000\r\n"
+ "a=fmtp:101 0-15\r\n" + "a=sendonly\r\n" ,
+ "a=fmtp:101 0-15\r\n" + "a=sendonly\r\n"
+ "u=http://www.example.com/seminars/sdp.pdf\r\n",

"v=0\r\n" + "o=- 1167770389 1167770390 IN IP4 192.168.5.242\r\n"
+ "s=Polycom IP Phone\r\n" + "c=IN IP4 192.168.5.242\r\n" + "t=0 0\r\n"
+ "a=sendonly\r\n" + "m=audio 2222 RTP/AVP 0 101\r\n"
+ "a=rtpmap:0 PCMU/8000\r\n" + "a=rtpmap:101 telephone-event/8000\r\n"
+ "u=http://www.example.com/seminars/sdp.pdf\r\n"
};

String rtcSdp = "v=0\n" +
Expand Down Expand Up @@ -90,14 +93,15 @@ public void testWebRtcSdpParser() throws Exception {
public void testSdpParser() throws Exception {
for (String sdpdata : sdpData) {
SDPAnnounceParser parser = new SDPAnnounceParser(sdpdata);
SessionDescriptionImpl sessiondescription = parser.parse();

SessionDescriptionImpl parsedDescription = parser.parse();
SessionDescriptionImpl sessiondescription = new SessionDescriptionImpl(parsedDescription);
Vector attrs = sessiondescription.getAttributes(false);

if (attrs != null) {
Attribute attrib = (Attribute) attrs.get(0);
System.out.println("attrs = " + attrib.getName());
}
assertNotNull(sessiondescription.getURI().get());

MediaDescription md = (MediaDescription) sessiondescription.getMediaDescriptions(
false).get(0);
Expand Down

0 comments on commit 1f12e16

Please sign in to comment.