[asterisk-dev] [Code Review] 3474: TLS and SRTP status not available in CLI

Patrick Laimbock reviewboard at asterisk.org
Thu Apr 24 10:14:51 CDT 2014



> On April 24, 2014, 7:31 a.m., Olle E Johansson wrote:
> > /branches/11/channels/chan_sip.c, line 21286
> > <https://reviewboard.asterisk.org/r/3474/diff/1/?file=57790#file57790line21286>
> >
> >     If the header is just "signalling" we should also list other transports than TLS - UDP, TCP, WS, WSS. "non-TLS" is not a good solution :-)

Oej: thank you for your comment. I totally agree. The reason for TLS or non-TLS is my very limited C foo. I did some digging and came up with the patch below which seems to work (tested UDP/TLS,RTP/SRTP). Is that more like it?

diff -uNr asterisk-11.9.0.org/channels/chan_sip.c asterisk-11.9.0/channels/chan_sip.c
--- asterisk-11.9.0.org/channels/chan_sip.c	2014-04-21 22:56:05.000000000 +0200
+++ asterisk-11.9.0/channels/chan_sip.c	2014-04-24 16:14:05.116999990 +0200
@@ -21294,6 +21294,24 @@
  				}
 			}
 
+			/* add transport and media types */
+			char *transport_type;
+			if (cur->socket.type ==  SIP_TRANSPORT_TLS) {
+				transport_type = "TLS";
+			} else if (cur->socket.type ==  SIP_TRANSPORT_UDP) {
+				transport_type = "UDP";
+			} else if (cur->socket.type ==  SIP_TRANSPORT_TCP) {
+				transport_type = "TCP";
+			} else if (cur->socket.type ==  SIP_TRANSPORT_WS) {
+				transport_type = "WS";
+			} else if (cur->socket.type ==  SIP_TRANSPORT_WSS) {
+				transport_type = "WSS";
+			} else
+				transport_type = "Unknown";
+			
+			ast_cli(a->fd, "  Transport:              %s\n", transport_type);
+			ast_cli(a->fd, "  Media:                  %s\n", cur->srtp ? "SRTP" : "RTP");
+
 			ast_cli(a->fd, "\n\n");
 
 			found++;


- Patrick


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3474/#review11726
-----------------------------------------------------------


On April 23, 2014, 7:52 p.m., Patrick Laimbock wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3474/
> -----------------------------------------------------------
> 
> (Updated April 23, 2014, 7:52 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-23564
>     https://issues.asterisk.org/jira/browse/ASTERISK-23564
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> AFAICT there is no way to see from the CLI if TLS and SRTP are enabled for a channel. I asked on the ML and in #asterisk but received no answer other than that nobody knew how to get that info from the CLI. This patch shows TLS or non-TLS and SRTP or RTP.
> 
> 
> Diffs
> -----
> 
>   /branches/11/channels/chan_sip.c 412921 
> 
> Diff: https://reviewboard.asterisk.org/r/3474/diff/
> 
> 
> Testing
> -------
> 
> Testing was done on Asterisk-11.8.1 with TLS & RPT, TLS & SRTP, non-TLS & RPT configured and a Nexus GSM using Linphone with similar configs. AFAICT the status of the channel and media was correctly reported for each scenario.
> 
> 
> Thanks,
> 
> Patrick Laimbock
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140424/4c087b3c/attachment-0001.html>


More information about the asterisk-dev mailing list