Menu

#1 SDP parser i bad !!!!!

open
nobody
None
5
2001-12-26
2001-12-26
No

The jsip stack doesnt inter operate. Or i dont know
how you got it working with regards to SDP parsing
try this change in SdpMessage.java
public void parseInput(String parseinput)
{
String input = parseinput;
String curline;
String portstr;
String codecstr;
valid = false;

port = 0;
ipaddress = null;

// Guarentee termination
input += '\n';
// System.out.println("The sdp body is\n" +
input);
StringTokenizer strToken = new StringTokenizer
(input,"\n",false);
if(!strToken.hasMoreElements())
return ;
curline = strToken.nextToken();
System.out.println("NextLine"+curline);
if(!curline.equals("v=0") ) {

System.out.println("What is this?");
System.out.println("\""+input.substring(
0, input.indexOf( '\n' ) )+"\"");
return;
}

while(strToken.hasMoreElements()) {
curline = strToken.nextToken();
System.out.println("NextLine"+curline);
int index = curline.indexOf( '=' );
if(index == -1)
continue;
String equals = curline.substring
(0,curline.indexOf( '=' )).trim();
if(equals == null)
continue;
if(equals.equals("c")){
ipaddress = curline.substring(
curline.indexOf( "IP4" ) + 3 ).trim();
continue;
}
if(equals.equals("m")){
portstr = curline.substring(
curline.indexOf( "audio" ) + 5 );
portstr = portstr.substring( 0,
portstr.indexOf( "RTP" ) ).trim();

// fix for ericsson
if( portstr.indexOf( '/' ) >= 0 ) {
if (SipClient.DEBUG)
System.out.println( "SdpMessage: Uh-oh, ericsson is
calling again" );
portstr = portstr.substring( 0,
portstr.indexOf( '/' ) - 1 ).trim();
}

codecstr = curline.substring(
curline.indexOf( "AVP" ) + 4 ).trim();

codecstr = " " + codecstr
+ " "; // ????
if( codecstr.indexOf( " 0 " ) >= 0 ) {
try {
port = Integer.parseInt
(portstr);
if (SipClient.DEBUG)
System.out.println( "SdpMessage: We found a match!
(port " + port + ")" );
} catch (NumberFormatException
nfe) {
System.err.println("couldn't
parse port string. Setting to default");
port = 5060;
}
}
}
}

valid = true;
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.