aioice.stun.TransactionFailed: STUN transaction failed (403 - Forbidden IP)
See original GitHub issueHello,
Would like to check if anyone has seen this problem before. I only have turn server added in aioice.Connection:
connection = aioice.Connection(ice_controlling=True, turn_server=turn_1, turn_username=turn_user, turn_password=turn_password, turn_ssl=True, use_ipv6=False)
When I call ‘await connection.gather_candidates()’, I can see that ICE candidates are correctly gathered including the one for relay. Something like the following:
[Candidate(cc5d96d7acaef3049243dc2dc49075a0 1 udp 2130706431 1xx.9x.xx.14x 50402 typ host), Candidate(52c97f4be0896b28eb84deed0b0dca3a 1 udp 16777215 1x.2xx.2x.x3 10008 typ relay raddr 1xx.9x.xx.14x rport 42750)]
But when relay candidate is used (after calling await connection.connect()), I got the following error:
[2021-02-23 09:32:57 -0000] [ERROR] Signaling Engine - Task exception was never retrieved
future: <Task finished name='Task-34' coro=<TurnClientMixin.send_data() done, defined at /usr/local/lib/python3.8/site-packages/aioice/turn.py:241> exception=TransactionFailed(Message(message_method=Method.CHANNEL_BIND, message_class=Class.ERROR, transaction_id=b'\x07\xfb\xc4\xb6\xa4|\x0b\xc8\x18\xa1\x08P'))>
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aioice/turn.py", line 251, in send_data
await self.channel_bind(channel, addr)
File "/usr/local/lib/python3.8/site-packages/aioice/turn.py", line 85, in channel_bind
await self.request_with_retry(request)
File "/usr/local/lib/python3.8/site-packages/aioice/turn.py", line 213, in request_with_retry
response, addr = await self.request(request)
File "/usr/local/lib/python3.8/site-packages/aioice/turn.py", line 200, in request
return await transaction.run()
File "/usr/local/lib/python3.8/site-packages/aioice/stun.py", line 299, in run
return await self.__future
aioice.stun.TransactionFailed: STUN transaction failed (403 - Forbidden IP)
If I restart again and try to gather candidates one more time, additional error presents:
[2021-02-23 09:23:01 -0000] [ERROR] Signaling Engine - Task exception was never retrieved
future: <Task finished name='Task-38' coro=<TurnClientMixin.send_data() done, defined at /usr/local/lib/python3.8/site-packages/aioice/turn.py:241> exception=TransactionFailed(Message(message_method=Method.CHANNEL_BIND, message_class=Class.ERROR, transaction_id=b"\xa2\x1b'm\xcc\xbeS#i\x07\x05\xc3"))>
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aioice/turn.py", line 251, in send_data
await self.channel_bind(channel, addr)
File "/usr/local/lib/python3.8/site-packages/aioice/turn.py", line 85, in channel_bind
await self.request_with_retry(request)
File "/usr/local/lib/python3.8/site-packages/aioice/turn.py", line 213, in request_with_retry
response, addr = await self.request(request)
File "/usr/local/lib/python3.8/site-packages/aioice/turn.py", line 200, in request
return await transaction.run()
File "/usr/local/lib/python3.8/site-packages/aioice/stun.py", line 299, in run
return await self.__future
aioice.stun.TransactionFailed: STUN transaction failed (400 - You cannot use the same channel number with different peer)
Not sure why the IP is considered forbidden and why the same channel number is picked. If anyone knows what is happening behind and scene, could you please help?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5

Top Related StackOverflow Question
I’m currently facing the same issue. I have no control over the TURN/STUN servers, so I can’t know if it comes from coturn too. How did you manage to solve it? Thanks
@hankhongyi I’m experiencing a similar issue at the moment. Do you remember how you fixed it? That would really help me and probably @demostanis too.