Hello Gerry,
What is the exact topology of the call flow? i.e. where are the endpoints situated in relation to Kamailio and Asterisk, and how are Kamailio and Asterisk situated in relation to each other?
Second, can you provide your Kamailio configuration and also a packet capture illustrating the misrouting of the BYE? You can send it privately if you're not keen to post it to the list.
Cheers,
-- Alex