I have a simple project which I’m using ARI.
I did the following steps:
- Snoop Channel
- Create External Media channel
- Create Bridge
- Adding Snoop Channel and External Media Channel to Bridge.
All is ok, I’m receiving RTP stream on my end by External Media channel.
This integration is for OpenAI Realtime api.
2025-03-18T08:53:46,122 INFO [ari-example.py:57] Processing new channel: 1742280823.203
2025-03-18T08:53:46,123 DEBUG [connectionpool.py:243] Starting new HTTP connection (1): 127.0.0.1:8088
2025-03-18T08:53:46,131 DEBUG [connectionpool.py:546] http://127.0.0.1:8088 "POST /ari/channels/1742280823.203/answer HTTP/11" 204 0
2025-03-18T08:53:46,131 INFO [ari-example.py:134] Answered call on channel: 1742280823.203
2025-03-18T08:53:46,132 INFO [ari-example.py:102] Opening external media with data: {'app': 'hello-world', 'external_host': '127.0.0.1:9000', 'format': 'ulaw'}
2025-03-18T08:53:46,132 DEBUG [connectionpool.py:243] Starting new HTTP connection (1): 127.0.0.1:8088
2025-03-18T08:53:46,134 DEBUG [connectionpool.py:546] http://127.0.0.1:8088 "POST /ari/channels/externalMedia HTTP/11" 200 572
2025-03-18T08:53:46,135 INFO [ari-example.py:107] Started external media: {'id': '1742280826.204', 'name': 'UnicastRTP/127.0.0.1:9000-0x7fb92408bc60', 'state': 'Down', 'protocol_id': '', 'caller': {'name': '', 'number': ''}, 'connected': {'name': '', 'number': ''}, 'accountcode': '', 'dialplan': {'context': 'default', 'exten': 's', 'priority': 1, 'app_name': 'AppDial2', 'app_data': '(Outgoing Line)'}, 'creationtime': '2025-03-18T08:53:46.133+0200', 'language': 'en', 'channelvars': {'UNICASTRTP_LOCAL_PORT': '15934', 'UNICASTRTP_LOCAL_ADDRESS': '127.0.0.1'}}
2025-03-18T08:53:46,136 DEBUG [connectionpool.py:243] Starting new HTTP connection (1): 127.0.0.1:8088
2025-03-18T08:53:46,152 DEBUG [connectionpool.py:546] http://127.0.0.1:8088 "POST /ari/channels/1742280823.203/snoop HTTP/11" 200 430
2025-03-18T08:53:46,152 INFO [ari-example.py:123] Snoop channel created: {'id': '1742280826.205', 'name': 'Snoop/1742280823.203-00000025', 'state': 'Up', 'protocol_id': '', 'caller': {'name': '', 'number': ''}, 'connected': {'name': '', 'number': ''}, 'accountcode': '', 'dialplan': {'context': 'default', 'exten': 's', 'priority': 1, 'app_name': '', 'app_data': ''}, 'creationtime': '2025-03-18T08:53:46.151+0200', 'language': 'en'}
2025-03-18T08:53:46,153 DEBUG [connectionpool.py:243] Starting new HTTP connection (1): 127.0.0.1:8088
2025-03-18T08:53:46,153 DEBUG [connectionpool.py:546] http://127.0.0.1:8088 "POST /ari/bridges HTTP/11" 200 269
2025-03-18T08:53:46,154 INFO [ari-example.py:145] Created bridge: {'id': 'cbbb163d-9486-4151-ae08-b27a7c4c1e6d', 'technology': 'simple_bridge', 'bridge_type': 'mixing', 'bridge_class': 'stasis', 'creator': 'Stasis', 'name': '', 'channels': [], 'creationtime': '2025-03-18T08:53:46.153+0200', 'video_mode': 'talker'}
2025-03-18T08:53:46,154 DEBUG [connectionpool.py:243] Starting new HTTP connection (1): 127.0.0.1:8088
2025-03-18T08:53:46,172 DEBUG [connectionpool.py:546] http://127.0.0.1:8088 "POST /ari/bridges/cbbb163d-9486-4151-ae08-b27a7c4c1e6d/addChannel HTTP/11" 204 0
2025-03-18T08:53:46,172 INFO [ari-example.py:157] Added channel 1742280826.205 to bridge cbbb163d-9486-4151-ae08-b27a7c4c1e6d
2025-03-18T08:53:46,173 DEBUG [connectionpool.py:243] Starting new HTTP connection (1): 127.0.0.1:8088
2025-03-18T08:53:46,335 DEBUG [connectionpool.py:546] http://127.0.0.1:8088 "POST /ari/bridges/cbbb163d-9486-4151-ae08-b27a7c4c1e6d/addChannel HTTP/11" 204 0
2025-03-18T08:53:46,335 INFO [ari-example.py:157] Added channel 1742280826.204 to bridge cbbb163d-9486-4151-ae08-b27a7c4c1e6d
2025-03-18T08:53:46,338 INFO [ari-example.py:51] Ignoring already processed or snoop channel: 1742280826.204
Everything is ok until I’m sending OpenAI Audio chunks to Asterisk.
- I have tried to send audio chunks back to snoop channel with below request:
curl -XPOST 127.0.0.1:8088/ari/channels/1742280826.205/play?media=sound:/home/sabuhigr/demo-congrats -u asterisk:asterisk
I saw Asterisk console says its playing but doesn’t hear anything.
-
I have sended to External Media channel, also same situation, I heard nothing.
-
I have sended to Bridge, also same situation.
-
Only I can hear OpenAI audio while I’m sending it to the main channel.
But now the issue is, External Media channel again sends same audio to RTP and OpenAI Realtime just talking with itself.
But it shouldn’t send that audio to back OpenAI Realtime by External Channel RTP stream.
I have not so much knowledge here, maybe you can give me suggestion.
Thanks in advance.