SIP标头字段是请求和响应消息的标头部分的组成部分。 赞来自服务器,内容长度。
在IP(66.194.127.175)上通过https://www.shodan.io发送请求时,服务器使用字段进行了响应,我需要“服务器”字段
图片说明:
我在PHP,JAVA中尝试了很多次,但是失败了。
例如JAVA,当从客户端发送请求时,服务器未给出响应。
import java.io.IOException;
import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;
public class Client
{
public static void main(String args[]) throws IOException
{
Socket socket = new Socket("104.207.221.19", 5060);
Scanner userInput = new Scanner(System.in);
Scanner socketInput = new Scanner(socket.getInputStream());
PrintStream socketOutput = new PrintStream(socket.getOutputStream());
String Request = "";
Request = "INVITE sip:bob@domain.com SIP/2.0 \r\n";
Request += "Via: SIP/2.0/UDP nm;received=51.40.80.23 \r\n";
Request += "From: <sip:nm@nm>;tag=root \r\n";
Request += "To: <sip:nm2@nm2>;tag=dff4305d81b6facb \r\n";
Request += "Call-ID: 50000 \r\n";
Request += "CSeq: 42 OPTIONS \r\n";
Request += "Content-Type: application/sdp \r\n";
Request += "\r\n\r\n";
socketOutput.print(Request);
while(socketInput.hasNextLine())
System.out.println(socketInput.nextLine());
}
}