How to test pjturn client which send data from peer to client?

XC
Xiemin Chen
Mon, Mar 28, 2016 7:37 AM

I start the pjturn server by the following command:

[cxm@cxm-Lenovo-Product: pjnath]$ ./bin/pjturn-srv-x86_64-unknown-linux-gnu
20:30:45.612 os_core_unix.c !pjlib 2.4.5 for POSIX initialized
20:30:45.612          pjlib  select() I/O Queue created (0xe88f88)
20:30:45.612    srv0xe88b50  TURN server v2.4.5 is running
20:30:45.612    udp0xe93e20  Listener UDP:0.0.0.0:34780 created
20:30:45.612  tcpl0xe955f0  Listener TCP:0.0.0.0:34780 created
20:30:45.612    srv0xe88b50  Listener tcpl0xe955f0/TCP:0.0.0.0:34780 added
at index 0
Server is running

Then I start the client to test:
[cxm@cxm-Lenovo-Product: pjnath]$
./bin/pjturn-client-x86_64-unknown-linux-gnu -u 100 -p 100 127.0.0.1:34780
20:31:33.261 os_core_unix.c !pjlib 2.4.5 for POSIX initialized
20:31:33.261          pjlib  select() I/O Queue created (0x6c1648)
20:31:33.261          peer0  .TX 36 bytes STUN message to 127.0.0.1:34780:
--- begin STUN message ---
STUN Binding request
Hdr: length=16, magic=2112a442, tsx_id=7ccd1f29d7ab58ba000141f2
Attributes:
SOFTWARE: length=12, value="pjnath-2.4.5"
--- end of STUN message ---

I allocate a relay:
+

---===+
|            CLIENT                |            PEER-0            |
|                                    |                                |
| State    : NULL                  | Address: 127.0.0.1:49526      |
| Relay addr: 0.0.0.0:0              |                                |
|                                    | 0  Send data to relay address  |
| a      Allocate relay              |                                |
| p,pp  Set permission for peer 0/1 +--------------------------------+
| s,ss  Send data to peer 0/1      |            PEER-1            |
| b,bb  BindChannel to peer 0/1    |                                |
| x      Delete allocation          | Address: 127.0.0.1:38504      |
+------------------------------------+                                |
| q  Quit                  d  Dump  | 1  Send data to relay adderss  |
+------------------------------------+--------------------------------+

a

20:32:12.187 udprel0x6c8b30 !TURN client session created
20:32:12.187 udprel0x6c8b30  Resolving 127.0.0.1 with DNS A
20:32:12.187 udprel0x6c8b30  State changed Null --> Resolving
20:32:12.187  client_main.c  State Null --> Resolving
20:32:12.187 udprel0x6c8b30  State changed Resolving --> Resolved
20:32:12.187  client_main.c  State Resolving --> Resolved
20:32:12.187 udprel0x6c8b30  Connecting to 127.0.0.1:34780
20:32:12.187 udprel0x6c8b30  State changed Resolved --> Allocating
20:32:12.187  client_main.c  State Resolved --> Allocating
20:32:12.187 udprel0x6c8b30  .TX 44 bytes STUN message to 127.0.0.1:34780:

And send data from client to peer 0 and it works well:
+

---===+
|            CLIENT                |            PEER-0            |
|                                    |                                |
| State    : Ready                  | Address: 127.0.0.1:34053      |
| Relay addr: 10.224.71.126:49153    |                                |
|                                    | 0  Send data to relay address  |
| a      Allocate relay              |                                |
| p,pp  Set permission for peer 0/1 +--------------------------------+
| s,ss  Send data to peer 0/1      |            PEER-1            |
| b,bb  BindChannel to peer 0/1    |                                |
| x      Delete allocation          | Address: 127.0.0.1:54794      |
+------------------------------------+                                |
| q  Quit                  d  Dump  | 1  Send data to relay adderss  |
+------------------------------------+--------------------------------+

s

...

20:33:50.314  client_main.c !peer0: received 18 bytes data from

127.0.0.1:49153: Hello from client
20:33:50.314 udprel0x23adb3  .RX 56 bytes STUN message from 127.0.0.1:34780:

But how to send data from peer to client? I test the command '0' but seems
nothing happen:

+

---===+
|            CLIENT                |            PEER-0            |
|                                    |                                |
| State    : Ready                  | Address: 127.0.0.1:34053      |
| Relay addr: 10.224.71.126:49153    |                                |
|                                    | 0  Send data to relay address  |
| a      Allocate relay              |                                |
| p,pp  Set permission for peer 0/1 +--------------------------------+
| s,ss  Send data to peer 0/1      |            PEER-1            |
| b,bb  BindChannel to peer 0/1    |                                |
| x      Delete allocation          | Address: 127.0.0.1:54794      |
+------------------------------------+                                |
| q  Quit                  d  Dump  | 1  Send data to relay adderss  |
+------------------------------------+--------------------------------+

0

*I start the pjturn server by the following command:* [cxm@cxm-Lenovo-Product: pjnath]$ ./bin/pjturn-srv-x86_64-unknown-linux-gnu 20:30:45.612 os_core_unix.c !pjlib 2.4.5 for POSIX initialized 20:30:45.612 pjlib select() I/O Queue created (0xe88f88) 20:30:45.612 srv0xe88b50 TURN server v2.4.5 is running 20:30:45.612 udp0xe93e20 Listener UDP:0.0.0.0:34780 created 20:30:45.612 tcpl0xe955f0 Listener TCP:0.0.0.0:34780 created 20:30:45.612 srv0xe88b50 Listener tcpl0xe955f0/TCP:0.0.0.0:34780 added at index 0 Server is running *Then I start the client to test:* [cxm@cxm-Lenovo-Product: pjnath]$ ./bin/pjturn-client-x86_64-unknown-linux-gnu -u 100 -p 100 127.0.0.1:34780 20:31:33.261 os_core_unix.c !pjlib 2.4.5 for POSIX initialized 20:31:33.261 pjlib select() I/O Queue created (0x6c1648) 20:31:33.261 peer0 .TX 36 bytes STUN message to 127.0.0.1:34780: --- begin STUN message --- STUN Binding request Hdr: length=16, magic=2112a442, tsx_id=7ccd1f29d7ab58ba000141f2 Attributes: SOFTWARE: length=12, value="pjnath-2.4.5" --- end of STUN message --- *I allocate a relay:* +=====================================================================+ | CLIENT | PEER-0 | | | | | State : NULL | Address: 127.0.0.1:49526 | | Relay addr: 0.0.0.0:0 | | | | 0 Send data to relay address | | a Allocate relay | | | p,pp Set permission for peer 0/1 +--------------------------------+ | s,ss Send data to peer 0/1 | PEER-1 | | b,bb BindChannel to peer 0/1 | | | x Delete allocation | Address: 127.0.0.1:38504 | +------------------------------------+ | | q Quit d Dump | 1 Send data to relay adderss | +------------------------------------+--------------------------------+ >>> a 20:32:12.187 udprel0x6c8b30 !TURN client session created 20:32:12.187 udprel0x6c8b30 Resolving 127.0.0.1 with DNS A 20:32:12.187 udprel0x6c8b30 State changed Null --> Resolving 20:32:12.187 client_main.c State Null --> Resolving 20:32:12.187 udprel0x6c8b30 State changed Resolving --> Resolved 20:32:12.187 client_main.c State Resolving --> Resolved 20:32:12.187 udprel0x6c8b30 Connecting to 127.0.0.1:34780 20:32:12.187 udprel0x6c8b30 State changed Resolved --> Allocating 20:32:12.187 client_main.c State Resolved --> Allocating 20:32:12.187 udprel0x6c8b30 .TX 44 bytes STUN message to 127.0.0.1:34780: *And send data from client to peer 0 and it works well:* +=====================================================================+ | CLIENT | PEER-0 | | | | | State : Ready | Address: 127.0.0.1:34053 | | Relay addr: 10.224.71.126:49153 | | | | 0 Send data to relay address | | a Allocate relay | | | p,pp Set permission for peer 0/1 +--------------------------------+ | s,ss Send data to peer 0/1 | PEER-1 | | b,bb BindChannel to peer 0/1 | | | x Delete allocation | Address: 127.0.0.1:54794 | +------------------------------------+ | | q Quit d Dump | 1 Send data to relay adderss | +------------------------------------+--------------------------------+ >>> s ... >>> 20:33:50.314 client_main.c !peer0: received 18 bytes data from 127.0.0.1:49153: Hello from client 20:33:50.314 udprel0x23adb3 .RX 56 bytes STUN message from 127.0.0.1:34780: *But how to send data from peer to client? I test the command '0' but seems nothing happen:* +=====================================================================+ | CLIENT | PEER-0 | | | | | State : Ready | Address: 127.0.0.1:34053 | | Relay addr: 10.224.71.126:49153 | | | | 0 Send data to relay address | | a Allocate relay | | | p,pp Set permission for peer 0/1 +--------------------------------+ | s,ss Send data to peer 0/1 | PEER-1 | | b,bb BindChannel to peer 0/1 | | | x Delete allocation | Address: 127.0.0.1:54794 | +------------------------------------+ | | q Quit d Dump | 1 Send data to relay adderss | +------------------------------------+--------------------------------+ >>> 0
XC
Xiemin Chen
Tue, Mar 29, 2016 8:59 AM

It's caused by the pjturn_srv ignore the turn set permission message.
After I use the coturn server then everything works fine.

2016-03-28 15:37 GMT+08:00 Xiemin Chen chenxiemin@gmail.com:

I start the pjturn server by the following command:

[cxm@cxm-Lenovo-Product: pjnath]$
./bin/pjturn-srv-x86_64-unknown-linux-gnu
20:30:45.612 os_core_unix.c !pjlib 2.4.5 for POSIX initialized
20:30:45.612          pjlib  select() I/O Queue created (0xe88f88)
20:30:45.612    srv0xe88b50  TURN server v2.4.5 is running
20:30:45.612    udp0xe93e20  Listener UDP:0.0.0.0:34780 created
20:30:45.612  tcpl0xe955f0  Listener TCP:0.0.0.0:34780 created
20:30:45.612    srv0xe88b50  Listener tcpl0xe955f0/TCP:0.0.0.0:34780
added at index 0
Server is running

Then I start the client to test:
[cxm@cxm-Lenovo-Product: pjnath]$
./bin/pjturn-client-x86_64-unknown-linux-gnu -u 100 -p 100 127.0.0.1:34780
20:31:33.261 os_core_unix.c !pjlib 2.4.5 for POSIX initialized
20:31:33.261          pjlib  select() I/O Queue created (0x6c1648)
20:31:33.261          peer0  .TX 36 bytes STUN message to 127.0.0.1:34780:
--- begin STUN message ---
STUN Binding request
Hdr: length=16, magic=2112a442, tsx_id=7ccd1f29d7ab58ba000141f2
Attributes:
SOFTWARE: length=12, value="pjnath-2.4.5"
--- end of STUN message ---

I allocate a relay:
+

---===+
|            CLIENT                |            PEER-0            |
|                                    |                                |
| State    : NULL                  | Address: 127.0.0.1:49526      |
| Relay addr: 0.0.0.0:0              |                                |
|                                    | 0  Send data to relay address  |
| a      Allocate relay              |                                |
| p,pp  Set permission for peer 0/1 +--------------------------------+
| s,ss  Send data to peer 0/1      |            PEER-1            |
| b,bb  BindChannel to peer 0/1    |                                |
| x      Delete allocation          | Address: 127.0.0.1:38504      |
+------------------------------------+                                |
| q  Quit                  d  Dump  | 1  Send data to relay adderss  |
+------------------------------------+--------------------------------+

a

20:32:12.187 udprel0x6c8b30 !TURN client session created
20:32:12.187 udprel0x6c8b30  Resolving 127.0.0.1 with DNS A
20:32:12.187 udprel0x6c8b30  State changed Null --> Resolving
20:32:12.187  client_main.c  State Null --> Resolving
20:32:12.187 udprel0x6c8b30  State changed Resolving --> Resolved
20:32:12.187  client_main.c  State Resolving --> Resolved
20:32:12.187 udprel0x6c8b30  Connecting to 127.0.0.1:34780
20:32:12.187 udprel0x6c8b30  State changed Resolved --> Allocating
20:32:12.187  client_main.c  State Resolved --> Allocating
20:32:12.187 udprel0x6c8b30  .TX 44 bytes STUN message to 127.0.0.1:34780:

And send data from client to peer 0 and it works well:
+

---===+
|            CLIENT                |            PEER-0            |
|                                    |                                |
| State    : Ready                  | Address: 127.0.0.1:34053      |
| Relay addr: 10.224.71.126:49153    |                                |
|                                    | 0  Send data to relay address  |
| a      Allocate relay              |                                |
| p,pp  Set permission for peer 0/1 +--------------------------------+
| s,ss  Send data to peer 0/1      |            PEER-1            |
| b,bb  BindChannel to peer 0/1    |                                |
| x      Delete allocation          | Address: 127.0.0.1:54794      |
+------------------------------------+                                |
| q  Quit                  d  Dump  | 1  Send data to relay adderss  |
+------------------------------------+--------------------------------+

s

...

20:33:50.314  client_main.c !peer0: received 18 bytes data from

127.0.0.1:49153: Hello from client
20:33:50.314 udprel0x23adb3  .RX 56 bytes STUN message from
127.0.0.1:34780:

But how to send data from peer to client? I test the command '0' but
seems nothing happen:

+

---===+
|            CLIENT                |            PEER-0            |
|                                    |                                |
| State    : Ready                  | Address: 127.0.0.1:34053      |
| Relay addr: 10.224.71.126:49153    |                                |
|                                    | 0  Send data to relay address  |
| a      Allocate relay              |                                |
| p,pp  Set permission for peer 0/1 +--------------------------------+
| s,ss  Send data to peer 0/1      |            PEER-1            |
| b,bb  BindChannel to peer 0/1    |                                |
| x      Delete allocation          | Address: 127.0.0.1:54794      |
+------------------------------------+                                |
| q  Quit                  d  Dump  | 1  Send data to relay adderss  |
+------------------------------------+--------------------------------+

0

It's caused by the pjturn_srv ignore the turn set permission message. After I use the coturn server then everything works fine. 2016-03-28 15:37 GMT+08:00 Xiemin Chen <chenxiemin@gmail.com>: > *I start the pjturn server by the following command:* > > [cxm@cxm-Lenovo-Product: pjnath]$ > ./bin/pjturn-srv-x86_64-unknown-linux-gnu > 20:30:45.612 os_core_unix.c !pjlib 2.4.5 for POSIX initialized > 20:30:45.612 pjlib select() I/O Queue created (0xe88f88) > 20:30:45.612 srv0xe88b50 TURN server v2.4.5 is running > 20:30:45.612 udp0xe93e20 Listener UDP:0.0.0.0:34780 created > 20:30:45.612 tcpl0xe955f0 Listener TCP:0.0.0.0:34780 created > 20:30:45.612 srv0xe88b50 Listener tcpl0xe955f0/TCP:0.0.0.0:34780 > added at index 0 > Server is running > > *Then I start the client to test:* > [cxm@cxm-Lenovo-Product: pjnath]$ > ./bin/pjturn-client-x86_64-unknown-linux-gnu -u 100 -p 100 127.0.0.1:34780 > 20:31:33.261 os_core_unix.c !pjlib 2.4.5 for POSIX initialized > 20:31:33.261 pjlib select() I/O Queue created (0x6c1648) > 20:31:33.261 peer0 .TX 36 bytes STUN message to 127.0.0.1:34780: > --- begin STUN message --- > STUN Binding request > Hdr: length=16, magic=2112a442, tsx_id=7ccd1f29d7ab58ba000141f2 > Attributes: > SOFTWARE: length=12, value="pjnath-2.4.5" > --- end of STUN message --- > > *I allocate a relay:* > +=====================================================================+ > | CLIENT | PEER-0 | > | | | > | State : NULL | Address: 127.0.0.1:49526 | > | Relay addr: 0.0.0.0:0 | | > | | 0 Send data to relay address | > | a Allocate relay | | > | p,pp Set permission for peer 0/1 +--------------------------------+ > | s,ss Send data to peer 0/1 | PEER-1 | > | b,bb BindChannel to peer 0/1 | | > | x Delete allocation | Address: 127.0.0.1:38504 | > +------------------------------------+ | > | q Quit d Dump | 1 Send data to relay adderss | > +------------------------------------+--------------------------------+ > >>> a > 20:32:12.187 udprel0x6c8b30 !TURN client session created > 20:32:12.187 udprel0x6c8b30 Resolving 127.0.0.1 with DNS A > 20:32:12.187 udprel0x6c8b30 State changed Null --> Resolving > 20:32:12.187 client_main.c State Null --> Resolving > 20:32:12.187 udprel0x6c8b30 State changed Resolving --> Resolved > 20:32:12.187 client_main.c State Resolving --> Resolved > 20:32:12.187 udprel0x6c8b30 Connecting to 127.0.0.1:34780 > 20:32:12.187 udprel0x6c8b30 State changed Resolved --> Allocating > 20:32:12.187 client_main.c State Resolved --> Allocating > 20:32:12.187 udprel0x6c8b30 .TX 44 bytes STUN message to 127.0.0.1:34780: > > *And send data from client to peer 0 and it works well:* > +=====================================================================+ > | CLIENT | PEER-0 | > | | | > | State : Ready | Address: 127.0.0.1:34053 | > | Relay addr: 10.224.71.126:49153 | | > | | 0 Send data to relay address | > | a Allocate relay | | > | p,pp Set permission for peer 0/1 +--------------------------------+ > | s,ss Send data to peer 0/1 | PEER-1 | > | b,bb BindChannel to peer 0/1 | | > | x Delete allocation | Address: 127.0.0.1:54794 | > +------------------------------------+ | > | q Quit d Dump | 1 Send data to relay adderss | > +------------------------------------+--------------------------------+ > >>> s > ... > >>> 20:33:50.314 client_main.c !peer0: received 18 bytes data from > 127.0.0.1:49153: Hello from client > 20:33:50.314 udprel0x23adb3 .RX 56 bytes STUN message from > 127.0.0.1:34780: > > > *But how to send data from peer to client? I test the command '0' but > seems nothing happen:* > +=====================================================================+ > | CLIENT | PEER-0 | > | | | > | State : Ready | Address: 127.0.0.1:34053 | > | Relay addr: 10.224.71.126:49153 | | > | | 0 Send data to relay address | > | a Allocate relay | | > | p,pp Set permission for peer 0/1 +--------------------------------+ > | s,ss Send data to peer 0/1 | PEER-1 | > | b,bb BindChannel to peer 0/1 | | > | x Delete allocation | Address: 127.0.0.1:54794 | > +------------------------------------+ | > | q Quit d Dump | 1 Send data to relay adderss | > +------------------------------------+--------------------------------+ > >>> 0 > > >