}
if (match && bit_rate && map_bit_rate && map_bit_rate != bit_rate && strcasecmp(map->rm_encoding, "ilbc")) {
- /* nevermind */
+ /* if a bit rate is specified and doesn't match, this is not a codec match, except for ILBC */
+ match = 0;
+ }
+
+ if (match && map->rm_rate && codec_rate && map->rm_rate != codec_rate && (!strcasecmp(map->rm_encoding, "pcma") || !strcasecmp(map->rm_encoding, "pcmu"))) {
+ /* if the sampling rate is specified and doesn't match, this is not a codec match for G.711 */
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "sampling rates have to match for G.711\n");
match = 0;
}
}
mimp = imp;
break;
- } else {
- match = 0;
}
}