Personally I'd chop out the remaining crap and mortar a couple of replacement bricks in, doesn't matter what sort of brick as presumably it'll be covered eventually anyway.
is that the area to the side of a door/French window?
Looks like the right hand side is the external wall.
Don't go mad with foam or the cavity will fill up.
I'd use a chunk of brick