char *ext, *end; ext = ast_strdupa(peer->name); ext = strchr(ext, '/') + 1; if ((end = strchr(ext, '-'))) *end = '\0';