@miconda, i was able to isolate the problem to a single line of python script. I did so by writing two sipp scripts to simulate our asterisk and the isp and subsequently removing logic from the kamailio script.
Segfault happens when i use this selector within ksr_reply_route:
`KSR.pv.get("$sel(@hf_value.Via)")`
a simpler `KSR.pv.get("$sel(via)")` works without crashes. I could surely ommit the "hf_value" part to workaround the problem but it looks like some KEMI/python binding problem. Using e.g. "hf_value.From" does not result in a crash as well. I tried replies with multiple Via lines and also multiple Via's in one header line and could not find a difference in the behavior.
As stated above, the segfault happens after so and so many packets (typically 14-20) but the pace of the messages seems to play a role as well.
Hope it helps!
Cheers, Thomas