Hi Ali,
I was unable to open your client trace, but the Kamailio trace worked:
client-trace.pcap: pcap-ng capture file - version 1.0 kamailio trace.pcap: data
Anyway, looking at the Kamailio trace, you will see that the BYE is going straight from 192.168.26.3 (client) to 192.168.26.4 (gateway), bypassing Kamailio.
This is the normal, default behaviour for a proxy. A BYE is a kind of request called a sequential request, which means it occurs within a dialog. After the initial INVITE transaction is set up through the proxy, sequential requests such as end-to-end ACKs, BYEs, reinvites, etc. flow directly between the endpoints, using the network and transport-layer reachability information in their respective Contact headers.
If you want these sequential requests to traverse Kamailio, you must add a Record-Route header to the initial INVITE before forwarding it. This tells the two endpoints to pass sequential requests through Kamailio as well:
if(is_method("INVITE")) { ...
record_route();
...
if(!t_relay()) sl_reply_error(); }
-- Alex