diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b29bcdc05af33e6688e3e5ffdc70950aebce9b66..96609d2189835b98dc79ff00647d0b6621fd616b 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -30406,8 +30406,11 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
 		if (!ast_sockaddr_isnull(&peer->addr)) {
 			ao2_t_unlink(peers_by_ip, peer, "ao2_unlink peer from peers_by_ip table");
 		}
-		if (!(peer->the_mark))
+		if (!(peer->the_mark)) {
 			firstpass = 0;
+		} else {
+			ast_format_cap_remove_by_type(peer->caps, AST_MEDIA_TYPE_UNKNOWN);
+		}
 	} else {
 		if (!(peer = ao2_t_alloc(sizeof(*peer), sip_destroy_peer_fn, "allocate a peer struct"))) {
 			return NULL;