ARI ExternalMedia mapping

In a scenario of multiple externalMedia connections I have trouble to find out how it is possible to map/find the corresponding Channel of a call, as IDs are not matching.

What I do:
Within an ARI application I am creating a new Channel by calling externalMedia on the Channel that answered the Call. The specified external_host is receiving RTP Packages and the data for header and payload can be processed without problems. So for one connection everything works fine.

ExternalMedia is created with these params:
{‘channelId’: ‘657fe748-7d5a-11ee-9d7c-fa163edfb44b’, ‘app’: ‘emari’, ‘external_host’: ‘127.0.0.1:9999’, ‘format’: ‘alaw’}

What I get:
Original Channel: 1699372657.50
EM Channel: {‘id’: ‘657fe748-7d5a-11ee-9d7c-fa163edfb44b’, ‘name’: ‘UnicastRTP/127.0.0.1:9999-0x7f86240068e0’, ‘state’: ‘Down’, ‘caller’: {‘name’: ‘’, ‘number’: ‘’}, ‘connected’: {‘name’: ‘’, ‘number’: ‘’}, ‘accountcode’: ‘’, ‘dialplan’: {‘context’: ‘default’, ‘exten’: ‘s’, ‘priority’: 1, ‘app_name’: ‘AppDial2’, ‘app_data’: ‘(Outgoing Line)’}, ‘creationtime’: ‘2023-11-07T11:42:49.850+0100’, ‘language’: ‘de’, ‘channelvars’: {‘UNICASTRTP_LOCAL_PORT’: ‘27086’, ‘UNICASTRTP_LOCAL_ADDRESS’: ‘127.0.0.1’}}
RTP Header: {‘Version’: 2, ‘Padding’: 0, ‘Extension’: 0, ‘CSRC Count’: 0, ‘Marker’: 0, ‘Payload Type’: 8, ‘Sequence Number’: 18916, ‘Timestamp’: 3200, ‘SSRC’: 767511251}

What I expected:
That SSRC is matching one of the IDs of original or externalMedia Channel, instead it is a new Id without any logical connection to the Channels.

So on the external_host side due to SSRC it is possible to distinct the packages from each other but it is impossible to know where they originated from which is crucial for the application.

How can I achieve this mapping?
Do I have to create externalMedia differently?
Might this be a bug in Asterisk 17.3?
Are there any examples showing the handling of multiple connections?

It’s not a bug. SSRC is an RTP concept. It is expected that you use 1 RTP port per external media channel on the application side. You then differentiate based on what port it is received on.

1 Like

Perfect.
It seems like ‘channelvars’: {‘UNICASTRTP_LOCAL_PORT’: ‘27086’… and the port used by the server are indeed matching. I missed this one.

Thanks, topic is solved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.