From d60bcc56a7dbba38f5a3a72a8b2455f8de7cfdcd Mon Sep 17 00:00:00 2001 From: Naveen Albert Date: Fri, 18 Apr 2025 09:03:10 -0400 Subject: [PATCH] chan_iax2: Minor improvements to documentation and warning messages. * Update Dial() documentation for IAX2 to include syntax for RSA public key names. * Add additional details to a couple warnings to provide more context when an undecodable frame is received. Resolves: #1206 --- channels/chan_iax2.c | 9 +++++++-- channels/iax2/parser.c | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 118407f091..1ffcffce5a 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -234,7 +234,10 @@ The general syntax is: - Dial(IAX2/[username[:password]@]peer[:port][/exten[@context]][/options] + Dial(IAX2/[username[:password[:pubkey]]@]peer[:port][/exten[@context]][/options] + The IAX username is optionally followed by either the secret or name of the keypair to use for RSA + authentication (within square brakcets). If both need to be provided (such as for encrypted calls that + are RSA authenticated), both may be specified in either order. IAX2 optionally allows modifiers to be specified after the extension. @@ -10381,7 +10384,9 @@ static int socket_process_helper(struct iax2_thread *thread) if (f.datalen) { if (f.frametype == AST_FRAME_IAX) { if (iax_parse_ies(&ies, thread->buf + sizeof(struct ast_iax2_full_hdr), f.datalen)) { - ast_log(LOG_WARNING, "Undecodable frame received from '%s'\n", ast_sockaddr_stringify(&addr)); + char subclass[40]; + iax_frame_subclass2str(f.subclass.integer, subclass, sizeof(subclass)); + ast_log(LOG_WARNING, "Undecodable %s frame received from '%s'\n", subclass, ast_sockaddr_stringify(&addr)); ast_variables_destroy(ies.vars); return 1; } diff --git a/channels/iax2/parser.c b/channels/iax2/parser.c index ff025e1c18..18d209d34b 100644 --- a/channels/iax2/parser.c +++ b/channels/iax2/parser.c @@ -812,7 +812,8 @@ int iax_parse_ies(struct iax_ies *ies, unsigned char *data, int datalen) ie = data[0]; len = data[1]; if (len > datalen - 2) { - errorf("Information element length exceeds message size\n"); + snprintf(tmp, sizeof(tmp), "Information element length %d exceeds message size %d\n", len, datalen - 2); + errorf(tmp); return -1; } switch(ie) {