How exactly are calls established?

I’m trying to figure out why exactly jami on Android can’t be reached with calls in one specific network. I’ve found the documentation at Calls — Jami documentation which links to Contact management — Jami documentation - so far I can jump from

http dhtproxy.jami.net:80/$contactID

then in ipython

import msgpack
import base64
msgpack.unpackb(base64.b64decode("<data part>"))['dev'].hex()

which then gives me the device ID, which I can plug back in via

http dhtproxy.jami.net:80/$deviceID

But I’m not sure where to go from here to continue the discovery. How would I assemble the next messages?

The android device mentioned above is using unifiedpush with ntfy, I can see that ntfy subscription works (I see it crash when I send invalid json), but no call notification ever arrives.

1 Like

It will be ice messages to request a sip connection sent to the.hash of each devices. There is a page in the doc (and it’s encrypted)

1 Like

The first part is well documented in Contact management — Jami documentation which was easy to follow, see my above post. From then on, the description is very short as in

Once the contact is found, send a call request, announcing the known candidates (the IP address of each network interface + relay addresses (TURN) + reflexive addresses (UPnP, public ones).
Calls — Jami documentation

I’m trying to figure out how that call request is being sent, as it doesn’t arrive at the destination device. I suspect push notifications are somehow involved?

1 Like

Ah neat, found the docs at The connection manager — Jami documentation and jami reacts to calling ./client <deviceId> (naturally complains about the connection not being encrypted Received request from untrusted peer, but that’s to be expected).

1 Like

Ok, I discovered dsh as a simple test from dhtnet, I loaded in my local jami certificate. (If Connected shows up, it’s successful). I can establish a connection about 10% of the time, otherwise it fails. Local call via dsh seems not to use the TURN server, do I need to pass a specific flag here?

The line that stands out is:

Missing local address, generic srflx candidates unable to be generated!

The one time it succeeded, it got the public address of the dsh computer.

The other question - is this test reflective of how jami establishes a connection?

Full logs, I replaced short IDs with UUIDX, longer ones with IDX etc.

$ ./dsh -p 52aaee/ring_device.key -c 52aaee/ring_device.crt UUID0 -b bootstrap.jami.net -t turn.jami.net -u ring -w ring -r ring
dsh 1.0
Loaded identity: UUID1
[054298.278107] CertificateStore: loading certificates from /home/reactormonk/.cache/dhtnet/certstore/certificates
[054298.279913] CertificateStore: loaded 18 local certificates.
[054298.290176] Creating UPnPContext instance [0x5f2de2936170]
[054298.300317] PUPnP: Creating instance [0x5f2de2939ab0]…
[054298.300349] Successfully registered controller 0x5f2de292e770
[054298.300361] Starting UPnP context
[054298.300461] [ice:0x7d3dd80096c0] Creating IceTransport session for ""
[054298.300506] [ice:0x7d3dd80096c0] Initializing the session - comp count 1 - as a slave
[054298.300549] Desired port is not set, will provide the first available port for [TCP]
[054298.300573] PUPnP: Start search for IGD. Attempt 1
[054298.301784] PUPnP: Web server is enabled. Disabling…
[054298.301802] PUPnP: Successfully disabled Web server
[054298.301833] PUPnP: Initialized on 192.168.32.121:49152 | fe80::
[054298.301851] PUPnP: Successfully registered client
[054298.301864] PUPnP: Send IGD search request
[054298.302159] IGD Discovery started
[054298.302222] IGD Discovery started
[054298.302415] NAT-PMP: Attempting to initialize IGD
[054298.302531] NAT-PMP: Initialized on gateway 192.168.32.1
[054298.320168] Mapping JAMI-TCP:11049 will be requested when an IGD becomes available
[054302.320321] [ice:0x7d3dd80096c0] UPnP mapping failed: expected 1 mapping(s), got 0
[054302.320339] [ice:0x7d3dd80096c0] Missing local address, generic srflx candidates unable to be generated!
[054302.320352] [ice:0x7d3dd80096c0] No server reflexive candidates added
[054302.321370] [ice:0x7d3dd80096c0] TCP initialization success
[054302.321392] [ice:0x7d3dd80096c0] as slave
[054302.321734] [ice:0x7d3dd80096c0] (local) ufrag=0c43615d, pwd=2c471d754b722c932f8540da
[054302.321875] [device ID0] Added local ICE candidate Hc0a82058 1 TCP 2130706431 192.168.32.88 42209 typ host tcptype passive
[054302.321901] [device ID0] Added local ICE candidate Hc0a82058 1 TCP 2130706175 192.168.32.88 9 typ host tcptype active
[054302.321916] [device ID0] Added local ICE candidate Ha2a2b02 1 TCP 2130705919 10.42.43.2 42209 typ host tcptype passive
[054302.321935] [device ID0] Added local ICE candidate Ha2a2b02 1 TCP 2130705663 10.42.43.2 9 typ host tcptype active
[054302.321950] [device ID0] Added local ICE candidate Ha2d0002 1 TCP 2130705407 10.45.0.2 42209 typ host tcptype passive
[054302.321969] [device ID0] Added local ICE candidate Ha2d0002 1 TCP 2130705151 10.45.0.2 9 typ host tcptype active
[054302.321986] [device ID0] Added local ICE candidate Hc0a82079 1 TCP 2130704895 192.168.32.121 42209 typ host tcptype passive
[054302.322001] [device ID0] Added local ICE candidate Hc0a82079 1 TCP 2130704639 192.168.32.121 9 typ host tcptype active
[054302.322016] [device ID0] Added local ICE candidate H6aed2453 1 TCP 2130706431 fe80::6c3a:3a5c:5df6:184e 55595 typ host tcptype passive
[054302.322032] [device ID0] Added local ICE candidate H6aed2453 1 TCP 2130706175 fe80::6c3a:3a5c:5df6:184e 9 typ host tcptype active
[054302.322078] [device ID0] Sending connection request
[054307.103507] [device ID0] Sent connection request. Put encrypted OK
[054307.420216] [device ID1] Received request answer
[054307.420249] [device ID1] Response received, but unable to find request
[054307.420344] [device ID0] Received request answer
[054307.420356] [device ID0] New response received
[054307.830066] Identity announced true

Remote logs:

[1739908498.915|4220] [device ID2] Received request
[1739908498.919|4220] Found peer device: ID2 account:UUID3 CA:UUID4
[1739908498.920|4220] [device ID2] New connection request
[1739908498.923|4220|account_manager.cpp     :441 ] Found peer device: ID2 account:UUID3 CA:UUID4
[1739908498.928|4220|jamiaccount.cpp         :2011] Accepting ICE request from ID2
[1739908498.928|4220] Store DHT public IPv4 address: IP0
[1739908498.929|4220] [device ID2] Accepting connection
[1739908498.930|4220] [ice:0xe916b2b0] Creating IceTransport session for ""
[1739908498.930|4220] [ice:0xe916b2b0] Initializing the session - comp count 1 - as a master
[1739908498.930|4220] Desired port is not set, will provide the first available port for [TCP]
[1739908498.930|4159] Successfully registered controller 0xf566345c
[1739908498.930|4220] Request for mapping JAMI-TCP:14194 failed, no IGD available
[1739908498.930|4220] UPNP mapping failed: JAMI-TCP:14194 (state=FAILED, auto-update=NO)
[1739908498.931|4220] Unregistered mapping JAMI-TCP:14194
[1739908498.931|4220] [ice:0xe916b2b0] UPNP mapping failed: expected 1 mappings, got 0
[1739908498.931|4220] [ice:0xe916b2b0] Add srflx reflexive candidates [10.197.29.210:9 : IP0:9] for comp 1
[1739908498.931|4220] added turn server '51.254.39.157', port 3478
[1739908499.540|4509] [ice:0xe916b2b0] TCP initialization success
[1739908499.550|4509] [ice:0xe916b2b0] as master
[1739908499.580|4509] [ice:0xe916b2b0] (local) ufrag=5f954809, pwd=5e6cb74678b04b714590fe1a
[1739908499.590|4198] [ice:0xe916b2b0] Add remote candidate: Hc0a82058 1 TCP 2130706431 192.168.32.88 42209 typ host tcptype passive
[1739908499.590|4198] [ice:0xe916b2b0] Add remote candidate: Hc0a82058 1 TCP 2130706175 192.168.32.88 9 typ host tcptype active
[1739908499.600|4198] [ice:0xe916b2b0] Add remote candidate: Ha2a2b02 1 TCP 2130705919 10.42.43.2 42209 typ host tcptype passive
[1739908499.600|4198] [ice:0xe916b2b0] Add remote candidate: Ha2a2b02 1 TCP 2130705663 10.42.43.2 9 typ host tcptype active
[1739908499.610|4198] [ice:0xe916b2b0] Add remote candidate: Ha2d0002 1 TCP 2130705407 10.45.0.2 42209 typ host tcptype passive
[1739908499.610|4198] [ice:0xe916b2b0] Add remote candidate: Ha2d0002 1 TCP 2130705151 10.45.0.2 9 typ host tcptype active
[1739908499.620|4198] [ice:0xe916b2b0] Add remote candidate: Hc0a82079 1 TCP 2130704895 192.168.32.121 42209 typ host tcptype passive
[1739908499.620|4198] [ice:0xe916b2b0] Add remote candidate: Hc0a82079 1 TCP 2130704639 192.168.32.121 9 typ host tcptype active
[1739908499.630|4198] [ice:0xe916b2b0] Add remote candidate: H6aed2453 1 TCP 2130706431 fe80::e 55595 typ host tcptype passive
[1739908499.630|4198] [ice:0xe916b2b0] Add remote candidate: H6aed2453 1 TCP 2130706175 fe80:: 9 typ host tcptype active
[1739908499.640|4198] [device ID2] Connection accepted, DHT reply
[1739908499.650|4198] [ice:0xe916b2b0] negotiation starting (10 remote candidates)
[1739908500.493|4220] [device ID2] Answer to connection request: put encrypted ok
[1739908539.317|4509] [ice:0xe916b2b0] TCP negotiation failed: All ICE checklists failed (PJNATH_EICEFAILED)
[1739908539.318|4509] [device ID2] ICE negotiation failed.
[1739908539.329|4189] [ice:0xe916b2b0] Destroying ice_strans 0xde530044
[1739908539.831|4159] Successfully unregistered controller 0xf566345c

Well, I set up my own TURN server, and I’m getting these logs:

Feb 19 16:46:38 turn turnserver[2112]: 8: : IPv4. tcp or tls connected to: MY_IP:55267
Feb 19 16:46:38 turn turnserver[2112]: 8: : IPv4. Local relay addr: TURN_IP:64611
Feb 19 16:46:38 turn turnserver[2112]: 8: : session 001000000000000002: new, realm=<>, username=<>, lifetime=600
Feb 19 16:46:38 turn turnserver[2112]: 8: : session 001000000000000002: realm <> user <>: incoming packet ALLOCATE processed, success
Feb 19 16:46:42 turn turnserver[2112]: 12: : IPv4. tcp accepted from: REMOTE_DEVICE_IP:61481
Feb 19 16:46:42 turn turnserver[2112]: 12: : ERROR: tcp_peer_accept_connection: peer has no permission to connect

So something is wrong on the dhtnet or jami side. digging in.

Hi, did you sort out your issues and get your CoTurn server working?
I do not know much about Jami on mobile phones, but I would like to encourage you to keep working on it. I seem to have resolved my issues, which were of course, mostly of my own making, even more than my lack of understanding. LOL.