[SR-Users] Gracefully dropping all branches

Andreas Granig agranig at sipwise.com
Wed Feb 20 11:58:58 CET 2019


Hi all,

I’ve a scenario where after lookup() I get multiple branches, and I want to drop some or all of them based on some filter criteria in a branch route before sending requests out. Problem is that if all branches are dropped, kamailio replies with some implicitly generated 500 server error since there are no more branches, but I want to send a 404 or 480 instead.

Is there a way to determine if I’m processing the last active branch (so all others have been dropped already), so I can send a graceful reply like 404 or 480 instead of dropping this last branch as well if I decide I have to filter that one too?

I’m thinking of a hash table table or something to track and decrease the number of branches for a call, and based on a flag (whether one of the previous branches has been sent out or all have been dropped so far) either drop the last branch or reply with an error. However I’m wondering if kamailio comes with a mechanism to determine the branch state out of the box?

Thanks,
Andreas


More information about the sr-users mailing list