H.323,如何制作一个没有媒体的简单环。该脚本遵循 Q.931 设置,但仍然无法正常工作

发布于 2024-11-30 09:04:51 字数 2919 浏览 1 评论 0原文

谁能帮我解决这个问题吗?当我发送此请求时,我在wireshark中看到数据包将发送到1720 tcp端口中的SJPhone。但 SJPhone 仍然没有响铃。我想让它响起(无论媒体)。

我非常感谢您的支持。我一定缺少消息协议细节来实现这个。请给我一些积极的指示。

仅供参考:我使用了此跟踪: http://www.vconsole.com/usermanuals/sample_isdn_trace.pdf

import java.io.*;
import java.net.*;
public class test 
{
    public static void main(String[] args) throws UnknownHostException, IOException 
    { 
        /* Step 1: simulate the Q.931 packets exchange */
        byte st[]=new byte[256];
        st[0]=0x08;    // protocol discriminator
        st[1]=0x02;    // length (bytes) of call reference
        st[2]=0x02;    // call reference (1-15 bytes)        
        // message type
        st[3]=0x05;            
        // information Elements
        st[4]=0x6C;     // calling party number
            st[5]=0;    // unknown
            st[6]=0;    // unknown
            st[7]=1;    // "1"
        // information elements
        st[8]=0x70;     // called party number 
            st[9]=0;    // unknown
            st[10]=0;   // unknown  
            st[11]=5;   // "5"
        System.out.println(st);

        /* Step 2: by-pass it for testing with tcpdump */
        Socket clientSocket           = new Socket("localhost", 1720);
        DataInputStream input         = new DataInputStream(clientSocket.getInputStream());          
        DataOutputStream outToServer  = new DataOutputStream(clientSocket.getOutputStream());
        BufferedReader inFromServer   = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
        outToServer.write(st);
        String get;
        get = inFromServer.readLine();
        System.out.println("FROM SERVER: " + get);
        clientSocket.close();        
    }
}

--更多信息: -当 SJPhone 与 SJPhone 通信时,我看到此日志:

0000  00 00 03 04 00 06 00 00 00 00 00 00 00 00 08 00   ................
0010  45 00 00 3c 88 6c 40 00 40 06 b4 4d 7f 00 00 01   E..<.l@[email protected]....
0020  7f 00 00 01 b4 a8 06 b8 56 f6 c4 b3 00 00 00 00   ........V.......
0030  a0 02 80 18 fe 30 00 00 02 04 40 0c 04 02 08 0a   .....0....@.....
0040  02 a1 4c df 00 00 00 00 01 03 03 06               ..L.........

-当此 test.java 与 SJPhone 通信时,我看到此日志:

0000  00 00 03 04 00 06 00 00  00 00 00 00 00 00 08 00   ........ ........
0010  45 00 00 3c 1f ba 40 00  40 06 1d 00 7f 00 00 01   E..<..@. @.......
0020  7f 00 00 01 d6 ca 06 b8  8c e7 41 15 00 00 00 00   ........ ..A.....
0030  a0 02 80 18 fe 30 00 00  02 04 40 0c 04 02 08 0a   .....0.. ..@.....
0040  02 a6 5e af 00 00 00 00  01 03 03 06               ..^..... ....    

注意:

可以使用此命令完成友好转储,以查看实时 + 保存您所看到的内容: tcpdump -XX - s 0 -i 洛 |三通/tmp/log.log

Can anyone please help me to solve this? When i send this request i have seen in wireshark that packets are going to SJPhone in 1720 tcp port. But still SJPhone does not ring. I want to make it ring (no matter for media).

I would really appreciate your support. I must be missing the message protocol details to implement this. Please show me some positive pointers.

FYI: i have used this trace: http://www.vconsole.com/usermanuals/sample_isdn_trace.pdf

import java.io.*;
import java.net.*;
public class test 
{
    public static void main(String[] args) throws UnknownHostException, IOException 
    { 
        /* Step 1: simulate the Q.931 packets exchange */
        byte st[]=new byte[256];
        st[0]=0x08;    // protocol discriminator
        st[1]=0x02;    // length (bytes) of call reference
        st[2]=0x02;    // call reference (1-15 bytes)        
        // message type
        st[3]=0x05;            
        // information Elements
        st[4]=0x6C;     // calling party number
            st[5]=0;    // unknown
            st[6]=0;    // unknown
            st[7]=1;    // "1"
        // information elements
        st[8]=0x70;     // called party number 
            st[9]=0;    // unknown
            st[10]=0;   // unknown  
            st[11]=5;   // "5"
        System.out.println(st);

        /* Step 2: by-pass it for testing with tcpdump */
        Socket clientSocket           = new Socket("localhost", 1720);
        DataInputStream input         = new DataInputStream(clientSocket.getInputStream());          
        DataOutputStream outToServer  = new DataOutputStream(clientSocket.getOutputStream());
        BufferedReader inFromServer   = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
        outToServer.write(st);
        String get;
        get = inFromServer.readLine();
        System.out.println("FROM SERVER: " + get);
        clientSocket.close();        
    }
}

--More info:
-When SJPhone to SJPhone communicate i see this logs:

0000  00 00 03 04 00 06 00 00 00 00 00 00 00 00 08 00   ................
0010  45 00 00 3c 88 6c 40 00 40 06 b4 4d 7f 00 00 01   E..<.l@[email protected]....
0020  7f 00 00 01 b4 a8 06 b8 56 f6 c4 b3 00 00 00 00   ........V.......
0030  a0 02 80 18 fe 30 00 00 02 04 40 0c 04 02 08 0a   .....0....@.....
0040  02 a1 4c df 00 00 00 00 01 03 03 06               ..L.........

-When this test.java communicate to SJPhone i see this logs:

0000  00 00 03 04 00 06 00 00  00 00 00 00 00 00 08 00   ........ ........
0010  45 00 00 3c 1f ba 40 00  40 06 1d 00 7f 00 00 01   E..<..@. @.......
0020  7f 00 00 01 d6 ca 06 b8  8c e7 41 15 00 00 00 00   ........ ..A.....
0030  a0 02 80 18 fe 30 00 00  02 04 40 0c 04 02 08 0a   .....0.. ..@.....
0040  02 a6 5e af 00 00 00 00  01 03 03 06               ..^..... ....    

Note:

Friendly dump can be done using this command, to see realtime + save what you have seen: tcpdump -XX -s 0 -i lo | tee /tmp/log.log

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何时共饮酒 2024-12-07 09:04:51

所以,问题只是发送一个铃声,而不是实际的呼叫。

这是一些完成这项工作的代码。当它开始工作时,看到它很有趣:

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 *
 * @author martijncourteaux
 */
public class SJPhoneRinger
{

    private static String setupOpenLogicChannel = "03|00|02|32|08|02|10|00|05|04|03|88|c0|a5|28|07|75|6e|6b|6e|6f|77|6e|6c|05|81|32|30|30|35|7e|02|11|05|20|88|06|00|08|91|4a|00|04|22|c0|00|00|00|00|0f|53|4a|20|4c|61|62|73|ae|20|53|4a|70|68|6f|6e|65|08|31|2e|36|30|2e|32|39|39|61|00|7f|00|00|01|06|b8|00|c4|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|00|c1|1d|80|04|11|00|f6|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|81|3a|0a|21|40|00|00|06|04|01|00|4e|0c|03|00|20|00|80|12|1e|00|01|00|7f|00|00|01|c0|04|00|7f|00|00|01|c0|05|00|2b|40|00|00|06|04|01|00|4c|10|00|00|00|00|09|69|4c|42|43|2d|31|33|6b|33|80|12|1e|40|01|00|7f|00|00|01|c0|04|00|7f|00|00|01|c0|05|04|2b|40|00|00|06|04|01|00|4c|10|00|00|00|00|09|69|4c|42|43|2d|31|35|6b|32|80|12|1e|40|01|00|7f|00|00|01|c0|04|00|7f|00|00|01|c0|05|08|1e|40|00|00|06|04|01|00|4c|20|13|80|12|1e|00|01|00|7f|00|00|01|c0|04|00|7f|00|00|01|c0|05|00|1e|40|00|00|06|04|01|00|4c|60|13|80|12|1e|00|01|00|7f|00|00|01|c0|04|00|7f|00|00|01|c0|05|00|16|00|00|0d|0e|0c|03|00|20|00|80|0b|06|00|01|00|7f|00|00|01|c0|05|00|20|00|00|0e|0c|10|00|00|00|00|09|69|4c|42|43|2d|31|33|6b|33|80|0b|06|40|01|00|7f|00|00|01|c0|05|04|20|00|00|0f|0c|10|00|00|00|00|09|69|4c|42|43|2d|31|35|6b|32|80|0b|06|40|01|00|7f|00|00|01|c0|05|08|13|00|00|10|0c|20|13|80|0b|06|00|01|00|7f|00|00|01|c0|05|00|13|00|00|11|0c|60|13|80|0b|06|00|01|00|7f|00|00|01|c0|05|00|01|00|01|00|01|00|01|00|6e|02|64|02|70|01|06|00|08|81|75|00|08|80|0d|00|00|3c|00|01|00|00|01|00|00|01|00|00|04|80|00|00|24|18|03|00|20|00|80|00|01|20|20|00|00|00|00|09|69|4c|42|43|2d|31|33|6b|33|80|00|02|20|20|00|00|00|00|09|69|4c|42|43|2d|31|35|6b|32|80|00|03|20|40|13|80|00|04|20|c0|13|00|80|06|00|04|00|00|00|01|00|02|00|03|00|04|07|01|00|32|80|d8|50|5f|02|80|01|80";
    private static String alertingTSCA = "03|00|00|d8|08|02|90|00|01|28|07|75|6e|6b|6e|6f|77|6e|7e|00|c3|05|23|c0|06|00|08|91|4a|00|04|22|c0|00|00|00|00|0f|53|4a|20|4c|61|62|73|ae|20|53|4a|70|68|6f|6e|65|08|31|2e|36|30|2e|32|38|39|61|00|5e|e0|cc|44|98|ff|0d|0c|11|00|f6|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|01|00|01|00|04|c0|01|80|74|04|03|21|80|01|64|02|70|01|06|00|08|81|75|00|08|80|0d|00|00|3c|00|01|00|00|01|00|00|01|00|00|04|80|00|00|24|18|03|00|20|00|80|00|01|20|20|00|00|00|00|09|69|4c|42|43|2d|31|33|6b|33|80|00|02|20|20|00|00|00|00|09|69|4c|42|43|2d|31|35|6b|32|80|00|03|20|40|13|80|00|04|20|c0|13|00|80|06|00|04|00|00|00|01|00|02|00|03|00|04|06|01|00|32|40|1b|33|02|20|80";
    private static String facilityTSCA = "03|00|00|62|08|02|10|00|62|1c|00|28|07|75|6e|6b|6e|6f|77|6e|7e|00|4b|05|26|90|06|00|08|91|4a|00|04|c4|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|86|01|00|13|05|80|11|00|f6|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|07|00|5e|e0|cc|44|ab|62|01|00|01|00|04|c0|01|80|08|02|03|21|80|01|02|20|a0";
    private static String connectOpenLogicChannel = "03|00|00|b6|08|02|90|00|07|28|07|75|6e|6b|6e|6f|77|6e|7e|00|a1|05|22|c0|06|00|08|91|4a|00|04|00|5e|e0|cc|44|98|ff|22|c0|00|00|00|00|0f|53|4a|20|4c|61|62|73|ae|20|53|4a|70|68|6f|6e|65|08|31|2e|36|30|2e|32|38|39|61|00|c4|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|0d|1c|11|00|f6|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|41|02|21|40|00|03|06|04|01|00|4e|0c|03|00|20|00|80|12|1e|00|01|00|7f|00|00|01|c0|04|00|5e|e0|cc|44|c0|07|00|1d|00|00|0d|0e|0c|03|00|20|00|80|12|1e|00|01|00|5e|e0|cc|44|c0|06|00|5e|e0|cc|44|c0|07|00|01|00|01|00|02|80|01|80";

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException
    {
        Socket socket = new Socket("localhost", 1720);
        System.out.println("Connected to SJPhone!");

        DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
        DataInputStream dis = new DataInputStream(socket.getInputStream());

        sendBytes(dos, setupOpenLogicChannel);

        /* Following three packages were not needed. It worked without them.
         * Of course, because it is only a sample ring request, SJPhone will tell you
         * That the call is corrupted */
//        sendBytes(dos, alertingTSCA);
//        sendBytes(dos, facilityTSCA);
//        sendBytes(dos, connectOpenLogicChannel);

        try
        {
            Thread.sleep(10000); // Let it ring for ten seconds.
        } catch (Exception e)
        {
        }
    }

    public static void sendBytes(OutputStream os, String bytes) throws IOException
    {
        String byteArrayStr[] = bytes.split("\\|");
        byte bytesArray[] = new byte[byteArrayStr.length];
        for (int i = 0; i < byteArrayStr.length; ++i)
        {
            bytesArray[i] = (byte) (Integer.parseInt(byteArrayStr[i],16));
        }
        os.write(bytesArray);
        os.flush();
    }


}

So, the question was only to send a ring, without an actual call.

Here is some code that does the job. It was a lot of fun to see when it started working:

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

/**
 *
 * @author martijncourteaux
 */
public class SJPhoneRinger
{

    private static String setupOpenLogicChannel = "03|00|02|32|08|02|10|00|05|04|03|88|c0|a5|28|07|75|6e|6b|6e|6f|77|6e|6c|05|81|32|30|30|35|7e|02|11|05|20|88|06|00|08|91|4a|00|04|22|c0|00|00|00|00|0f|53|4a|20|4c|61|62|73|ae|20|53|4a|70|68|6f|6e|65|08|31|2e|36|30|2e|32|39|39|61|00|7f|00|00|01|06|b8|00|c4|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|00|c1|1d|80|04|11|00|f6|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|81|3a|0a|21|40|00|00|06|04|01|00|4e|0c|03|00|20|00|80|12|1e|00|01|00|7f|00|00|01|c0|04|00|7f|00|00|01|c0|05|00|2b|40|00|00|06|04|01|00|4c|10|00|00|00|00|09|69|4c|42|43|2d|31|33|6b|33|80|12|1e|40|01|00|7f|00|00|01|c0|04|00|7f|00|00|01|c0|05|04|2b|40|00|00|06|04|01|00|4c|10|00|00|00|00|09|69|4c|42|43|2d|31|35|6b|32|80|12|1e|40|01|00|7f|00|00|01|c0|04|00|7f|00|00|01|c0|05|08|1e|40|00|00|06|04|01|00|4c|20|13|80|12|1e|00|01|00|7f|00|00|01|c0|04|00|7f|00|00|01|c0|05|00|1e|40|00|00|06|04|01|00|4c|60|13|80|12|1e|00|01|00|7f|00|00|01|c0|04|00|7f|00|00|01|c0|05|00|16|00|00|0d|0e|0c|03|00|20|00|80|0b|06|00|01|00|7f|00|00|01|c0|05|00|20|00|00|0e|0c|10|00|00|00|00|09|69|4c|42|43|2d|31|33|6b|33|80|0b|06|40|01|00|7f|00|00|01|c0|05|04|20|00|00|0f|0c|10|00|00|00|00|09|69|4c|42|43|2d|31|35|6b|32|80|0b|06|40|01|00|7f|00|00|01|c0|05|08|13|00|00|10|0c|20|13|80|0b|06|00|01|00|7f|00|00|01|c0|05|00|13|00|00|11|0c|60|13|80|0b|06|00|01|00|7f|00|00|01|c0|05|00|01|00|01|00|01|00|01|00|6e|02|64|02|70|01|06|00|08|81|75|00|08|80|0d|00|00|3c|00|01|00|00|01|00|00|01|00|00|04|80|00|00|24|18|03|00|20|00|80|00|01|20|20|00|00|00|00|09|69|4c|42|43|2d|31|33|6b|33|80|00|02|20|20|00|00|00|00|09|69|4c|42|43|2d|31|35|6b|32|80|00|03|20|40|13|80|00|04|20|c0|13|00|80|06|00|04|00|00|00|01|00|02|00|03|00|04|07|01|00|32|80|d8|50|5f|02|80|01|80";
    private static String alertingTSCA = "03|00|00|d8|08|02|90|00|01|28|07|75|6e|6b|6e|6f|77|6e|7e|00|c3|05|23|c0|06|00|08|91|4a|00|04|22|c0|00|00|00|00|0f|53|4a|20|4c|61|62|73|ae|20|53|4a|70|68|6f|6e|65|08|31|2e|36|30|2e|32|38|39|61|00|5e|e0|cc|44|98|ff|0d|0c|11|00|f6|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|01|00|01|00|04|c0|01|80|74|04|03|21|80|01|64|02|70|01|06|00|08|81|75|00|08|80|0d|00|00|3c|00|01|00|00|01|00|00|01|00|00|04|80|00|00|24|18|03|00|20|00|80|00|01|20|20|00|00|00|00|09|69|4c|42|43|2d|31|33|6b|33|80|00|02|20|20|00|00|00|00|09|69|4c|42|43|2d|31|35|6b|32|80|00|03|20|40|13|80|00|04|20|c0|13|00|80|06|00|04|00|00|00|01|00|02|00|03|00|04|06|01|00|32|40|1b|33|02|20|80";
    private static String facilityTSCA = "03|00|00|62|08|02|10|00|62|1c|00|28|07|75|6e|6b|6e|6f|77|6e|7e|00|4b|05|26|90|06|00|08|91|4a|00|04|c4|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|86|01|00|13|05|80|11|00|f6|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|07|00|5e|e0|cc|44|ab|62|01|00|01|00|04|c0|01|80|08|02|03|21|80|01|02|20|a0";
    private static String connectOpenLogicChannel = "03|00|00|b6|08|02|90|00|07|28|07|75|6e|6b|6e|6f|77|6e|7e|00|a1|05|22|c0|06|00|08|91|4a|00|04|00|5e|e0|cc|44|98|ff|22|c0|00|00|00|00|0f|53|4a|20|4c|61|62|73|ae|20|53|4a|70|68|6f|6e|65|08|31|2e|36|30|2e|32|38|39|61|00|c4|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|0d|1c|11|00|f6|a1|56|3c|d2|1d|b2|11|a8|ed|b7|8a|c2|c1|98|8f|41|02|21|40|00|03|06|04|01|00|4e|0c|03|00|20|00|80|12|1e|00|01|00|7f|00|00|01|c0|04|00|5e|e0|cc|44|c0|07|00|1d|00|00|0d|0e|0c|03|00|20|00|80|12|1e|00|01|00|5e|e0|cc|44|c0|06|00|5e|e0|cc|44|c0|07|00|01|00|01|00|02|80|01|80";

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException
    {
        Socket socket = new Socket("localhost", 1720);
        System.out.println("Connected to SJPhone!");

        DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
        DataInputStream dis = new DataInputStream(socket.getInputStream());

        sendBytes(dos, setupOpenLogicChannel);

        /* Following three packages were not needed. It worked without them.
         * Of course, because it is only a sample ring request, SJPhone will tell you
         * That the call is corrupted */
//        sendBytes(dos, alertingTSCA);
//        sendBytes(dos, facilityTSCA);
//        sendBytes(dos, connectOpenLogicChannel);

        try
        {
            Thread.sleep(10000); // Let it ring for ten seconds.
        } catch (Exception e)
        {
        }
    }

    public static void sendBytes(OutputStream os, String bytes) throws IOException
    {
        String byteArrayStr[] = bytes.split("\\|");
        byte bytesArray[] = new byte[byteArrayStr.length];
        for (int i = 0; i < byteArrayStr.length; ++i)
        {
            bytesArray[i] = (byte) (Integer.parseInt(byteArrayStr[i],16));
        }
        os.write(bytesArray);
        os.flush();
    }


}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文