Why does Asterisk open a second media port +1 above the other?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1















When placing a call through an Asterisk SIP server, the server will open 2 ports for every media channel:



  • 2 ports for call leg 1 video

  • 2 ports for call leg 2 video

  • 2 ports for call leg 1 audio

  • 2 ports for call leg 2 audio

Since Asterisk's media communication is bidirectional, why does it need four ports (2 video, 2 audio) for every call leg as opposed to just 2 (1 video, 1 audio)? It is indeed only using the one port for communication in a particular leg, but netstat is very clear that there are two ports open, and the second port opened (the allegedly 'unused' port) is always +1 from the used port. For example, the call leg 1 video port is 17744, but it also opens a port 17745.



Wireshark analysis of local traffic:



enter image description here



netstat analysis on Asterisk server:



enter image description here



You can see from the above (partially, I didn't include Wireshark of the other call leg - for brevity) that the same question applies to the audio and video ports of all call legs, so there are four cases of this question per call.



So: Why is there an extra port on the server for each communication path?



Is asterisk not truly bidirectional in its media communication and just forwards the traffic from one port to another?



Also, is this the usual behavior in Asterisk, or might I have something in my configuration that would affect this?










share|improve this question
























  • SIP trunk to provider?

    – Rui F Ribeiro
    Jan 12 at 1:06















1















When placing a call through an Asterisk SIP server, the server will open 2 ports for every media channel:



  • 2 ports for call leg 1 video

  • 2 ports for call leg 2 video

  • 2 ports for call leg 1 audio

  • 2 ports for call leg 2 audio

Since Asterisk's media communication is bidirectional, why does it need four ports (2 video, 2 audio) for every call leg as opposed to just 2 (1 video, 1 audio)? It is indeed only using the one port for communication in a particular leg, but netstat is very clear that there are two ports open, and the second port opened (the allegedly 'unused' port) is always +1 from the used port. For example, the call leg 1 video port is 17744, but it also opens a port 17745.



Wireshark analysis of local traffic:



enter image description here



netstat analysis on Asterisk server:



enter image description here



You can see from the above (partially, I didn't include Wireshark of the other call leg - for brevity) that the same question applies to the audio and video ports of all call legs, so there are four cases of this question per call.



So: Why is there an extra port on the server for each communication path?



Is asterisk not truly bidirectional in its media communication and just forwards the traffic from one port to another?



Also, is this the usual behavior in Asterisk, or might I have something in my configuration that would affect this?










share|improve this question
























  • SIP trunk to provider?

    – Rui F Ribeiro
    Jan 12 at 1:06













1












1








1








When placing a call through an Asterisk SIP server, the server will open 2 ports for every media channel:



  • 2 ports for call leg 1 video

  • 2 ports for call leg 2 video

  • 2 ports for call leg 1 audio

  • 2 ports for call leg 2 audio

Since Asterisk's media communication is bidirectional, why does it need four ports (2 video, 2 audio) for every call leg as opposed to just 2 (1 video, 1 audio)? It is indeed only using the one port for communication in a particular leg, but netstat is very clear that there are two ports open, and the second port opened (the allegedly 'unused' port) is always +1 from the used port. For example, the call leg 1 video port is 17744, but it also opens a port 17745.



Wireshark analysis of local traffic:



enter image description here



netstat analysis on Asterisk server:



enter image description here



You can see from the above (partially, I didn't include Wireshark of the other call leg - for brevity) that the same question applies to the audio and video ports of all call legs, so there are four cases of this question per call.



So: Why is there an extra port on the server for each communication path?



Is asterisk not truly bidirectional in its media communication and just forwards the traffic from one port to another?



Also, is this the usual behavior in Asterisk, or might I have something in my configuration that would affect this?










share|improve this question
















When placing a call through an Asterisk SIP server, the server will open 2 ports for every media channel:



  • 2 ports for call leg 1 video

  • 2 ports for call leg 2 video

  • 2 ports for call leg 1 audio

  • 2 ports for call leg 2 audio

Since Asterisk's media communication is bidirectional, why does it need four ports (2 video, 2 audio) for every call leg as opposed to just 2 (1 video, 1 audio)? It is indeed only using the one port for communication in a particular leg, but netstat is very clear that there are two ports open, and the second port opened (the allegedly 'unused' port) is always +1 from the used port. For example, the call leg 1 video port is 17744, but it also opens a port 17745.



Wireshark analysis of local traffic:



enter image description here



netstat analysis on Asterisk server:



enter image description here



You can see from the above (partially, I didn't include Wireshark of the other call leg - for brevity) that the same question applies to the audio and video ports of all call legs, so there are four cases of this question per call.



So: Why is there an extra port on the server for each communication path?



Is asterisk not truly bidirectional in its media communication and just forwards the traffic from one port to another?



Also, is this the usual behavior in Asterisk, or might I have something in my configuration that would affect this?







networking asterisk






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 12 at 1:04









Rui F Ribeiro

39.6k1479132




39.6k1479132










asked Jan 11 at 23:35









MD-7MD-7

1336




1336












  • SIP trunk to provider?

    – Rui F Ribeiro
    Jan 12 at 1:06

















  • SIP trunk to provider?

    – Rui F Ribeiro
    Jan 12 at 1:06
















SIP trunk to provider?

– Rui F Ribeiro
Jan 12 at 1:06





SIP trunk to provider?

– Rui F Ribeiro
Jan 12 at 1:06










2 Answers
2






active

oldest

votes


















0














That will be your RTCP stream. See your SDP.






share|improve this answer























  • That's exactly what it is. Lesson learned to go through my SDP more carefully before looking elsewhere. Thank you.

    – MD-7
    Jan 18 at 18:03


















0














I’ve only ever seen SIP calls use unidirectional UDP RTP audio streams, so you would need 2 for each leg.



You've already used Wireshark to capture a SIP call - the Telphony menu offers some VoIP specific analysis tools - you could try showing SIP streams in the capture you made above - that will show the call signalling. Showing RTP streams will show the media streams you were asking about. Selecting a stream and clicking Analyze will pop up a dialog box with a lot of packet data and a button for Play Streams. You'll likely find each stream in your capture will contain one side of the conversation.



For two-way communication over a single port, I’m guessing you were thinking about IAX / IAX2, which was developed by the Asterisk project.



From https://www.voip-info.org/iax/



The IAX revision 2 protocol was developed by Asterisk team as alternative to SIP, H.323, etc. when connecting to other devices that support IAX (a limited list at the moment, but growing very rapidly).
...
IAX2 uses a single UDP port 4569, and thus works well in NAT environments (the obsolete IAX1 protocol used port 5036). IAX2 uses ONLY one udp port for both control and data traffic. As outlined in point 4 of the IAX versus SIP topic with IAX you will always have audio if the control connection can be established.






share|improve this answer

























  • Thank you for your well thought out answer. Your comment is interesting about the unidirectional RTP streams. If each call leg needs two ports for audio, where can I see this happening in my analysis? The wireshark flow sequence above shows the entire flow for that leg, and I only see one port (5854). Shouldn't the other port also be seen here in some way (whether it is the sending/receiving port)?

    – MD-7
    Jan 18 at 18:11










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494047%2fwhy-does-asterisk-open-a-second-media-port-1-above-the-other%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














That will be your RTCP stream. See your SDP.






share|improve this answer























  • That's exactly what it is. Lesson learned to go through my SDP more carefully before looking elsewhere. Thank you.

    – MD-7
    Jan 18 at 18:03















0














That will be your RTCP stream. See your SDP.






share|improve this answer























  • That's exactly what it is. Lesson learned to go through my SDP more carefully before looking elsewhere. Thank you.

    – MD-7
    Jan 18 at 18:03













0












0








0







That will be your RTCP stream. See your SDP.






share|improve this answer













That will be your RTCP stream. See your SDP.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 12 at 1:28









JdeBPJdeBP

34.2k469161




34.2k469161












  • That's exactly what it is. Lesson learned to go through my SDP more carefully before looking elsewhere. Thank you.

    – MD-7
    Jan 18 at 18:03

















  • That's exactly what it is. Lesson learned to go through my SDP more carefully before looking elsewhere. Thank you.

    – MD-7
    Jan 18 at 18:03
















That's exactly what it is. Lesson learned to go through my SDP more carefully before looking elsewhere. Thank you.

– MD-7
Jan 18 at 18:03





That's exactly what it is. Lesson learned to go through my SDP more carefully before looking elsewhere. Thank you.

– MD-7
Jan 18 at 18:03













0














I’ve only ever seen SIP calls use unidirectional UDP RTP audio streams, so you would need 2 for each leg.



You've already used Wireshark to capture a SIP call - the Telphony menu offers some VoIP specific analysis tools - you could try showing SIP streams in the capture you made above - that will show the call signalling. Showing RTP streams will show the media streams you were asking about. Selecting a stream and clicking Analyze will pop up a dialog box with a lot of packet data and a button for Play Streams. You'll likely find each stream in your capture will contain one side of the conversation.



For two-way communication over a single port, I’m guessing you were thinking about IAX / IAX2, which was developed by the Asterisk project.



From https://www.voip-info.org/iax/



The IAX revision 2 protocol was developed by Asterisk team as alternative to SIP, H.323, etc. when connecting to other devices that support IAX (a limited list at the moment, but growing very rapidly).
...
IAX2 uses a single UDP port 4569, and thus works well in NAT environments (the obsolete IAX1 protocol used port 5036). IAX2 uses ONLY one udp port for both control and data traffic. As outlined in point 4 of the IAX versus SIP topic with IAX you will always have audio if the control connection can be established.






share|improve this answer

























  • Thank you for your well thought out answer. Your comment is interesting about the unidirectional RTP streams. If each call leg needs two ports for audio, where can I see this happening in my analysis? The wireshark flow sequence above shows the entire flow for that leg, and I only see one port (5854). Shouldn't the other port also be seen here in some way (whether it is the sending/receiving port)?

    – MD-7
    Jan 18 at 18:11















0














I’ve only ever seen SIP calls use unidirectional UDP RTP audio streams, so you would need 2 for each leg.



You've already used Wireshark to capture a SIP call - the Telphony menu offers some VoIP specific analysis tools - you could try showing SIP streams in the capture you made above - that will show the call signalling. Showing RTP streams will show the media streams you were asking about. Selecting a stream and clicking Analyze will pop up a dialog box with a lot of packet data and a button for Play Streams. You'll likely find each stream in your capture will contain one side of the conversation.



For two-way communication over a single port, I’m guessing you were thinking about IAX / IAX2, which was developed by the Asterisk project.



From https://www.voip-info.org/iax/



The IAX revision 2 protocol was developed by Asterisk team as alternative to SIP, H.323, etc. when connecting to other devices that support IAX (a limited list at the moment, but growing very rapidly).
...
IAX2 uses a single UDP port 4569, and thus works well in NAT environments (the obsolete IAX1 protocol used port 5036). IAX2 uses ONLY one udp port for both control and data traffic. As outlined in point 4 of the IAX versus SIP topic with IAX you will always have audio if the control connection can be established.






share|improve this answer

























  • Thank you for your well thought out answer. Your comment is interesting about the unidirectional RTP streams. If each call leg needs two ports for audio, where can I see this happening in my analysis? The wireshark flow sequence above shows the entire flow for that leg, and I only see one port (5854). Shouldn't the other port also be seen here in some way (whether it is the sending/receiving port)?

    – MD-7
    Jan 18 at 18:11













0












0








0







I’ve only ever seen SIP calls use unidirectional UDP RTP audio streams, so you would need 2 for each leg.



You've already used Wireshark to capture a SIP call - the Telphony menu offers some VoIP specific analysis tools - you could try showing SIP streams in the capture you made above - that will show the call signalling. Showing RTP streams will show the media streams you were asking about. Selecting a stream and clicking Analyze will pop up a dialog box with a lot of packet data and a button for Play Streams. You'll likely find each stream in your capture will contain one side of the conversation.



For two-way communication over a single port, I’m guessing you were thinking about IAX / IAX2, which was developed by the Asterisk project.



From https://www.voip-info.org/iax/



The IAX revision 2 protocol was developed by Asterisk team as alternative to SIP, H.323, etc. when connecting to other devices that support IAX (a limited list at the moment, but growing very rapidly).
...
IAX2 uses a single UDP port 4569, and thus works well in NAT environments (the obsolete IAX1 protocol used port 5036). IAX2 uses ONLY one udp port for both control and data traffic. As outlined in point 4 of the IAX versus SIP topic with IAX you will always have audio if the control connection can be established.






share|improve this answer















I’ve only ever seen SIP calls use unidirectional UDP RTP audio streams, so you would need 2 for each leg.



You've already used Wireshark to capture a SIP call - the Telphony menu offers some VoIP specific analysis tools - you could try showing SIP streams in the capture you made above - that will show the call signalling. Showing RTP streams will show the media streams you were asking about. Selecting a stream and clicking Analyze will pop up a dialog box with a lot of packet data and a button for Play Streams. You'll likely find each stream in your capture will contain one side of the conversation.



For two-way communication over a single port, I’m guessing you were thinking about IAX / IAX2, which was developed by the Asterisk project.



From https://www.voip-info.org/iax/



The IAX revision 2 protocol was developed by Asterisk team as alternative to SIP, H.323, etc. when connecting to other devices that support IAX (a limited list at the moment, but growing very rapidly).
...
IAX2 uses a single UDP port 4569, and thus works well in NAT environments (the obsolete IAX1 protocol used port 5036). IAX2 uses ONLY one udp port for both control and data traffic. As outlined in point 4 of the IAX versus SIP topic with IAX you will always have audio if the control connection can be established.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 13 at 1:47

























answered Jan 12 at 2:50









Adam JohnsonAdam Johnson

316




316












  • Thank you for your well thought out answer. Your comment is interesting about the unidirectional RTP streams. If each call leg needs two ports for audio, where can I see this happening in my analysis? The wireshark flow sequence above shows the entire flow for that leg, and I only see one port (5854). Shouldn't the other port also be seen here in some way (whether it is the sending/receiving port)?

    – MD-7
    Jan 18 at 18:11

















  • Thank you for your well thought out answer. Your comment is interesting about the unidirectional RTP streams. If each call leg needs two ports for audio, where can I see this happening in my analysis? The wireshark flow sequence above shows the entire flow for that leg, and I only see one port (5854). Shouldn't the other port also be seen here in some way (whether it is the sending/receiving port)?

    – MD-7
    Jan 18 at 18:11
















Thank you for your well thought out answer. Your comment is interesting about the unidirectional RTP streams. If each call leg needs two ports for audio, where can I see this happening in my analysis? The wireshark flow sequence above shows the entire flow for that leg, and I only see one port (5854). Shouldn't the other port also be seen here in some way (whether it is the sending/receiving port)?

– MD-7
Jan 18 at 18:11





Thank you for your well thought out answer. Your comment is interesting about the unidirectional RTP streams. If each call leg needs two ports for audio, where can I see this happening in my analysis? The wireshark flow sequence above shows the entire flow for that leg, and I only see one port (5854). Shouldn't the other port also be seen here in some way (whether it is the sending/receiving port)?

– MD-7
Jan 18 at 18:11

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494047%2fwhy-does-asterisk-open-a-second-media-port-1-above-the-other%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?