Why does 'pjsip send register' unregister first?

When using ‘pjsip send register’ to renew an outbound registration, it will first send an unregister (i.e. REGISTER with Expires:0) to the SIP server. I can’t see why it would do this in any given scenario.

  • If the given registration had already been active, simply refreshing it by sending another REGISTER wont do any harm
  • If the given registration had not already been active, then there is nothing to unregister anyway.
  • If it really was my intention to first unregister and then register again, I would probably use ‘pjsip send unregister’ followed by a ‘pjsip send register’, but that’s not really an option when ‘pjsip send register’ already does the unregister.

As I see it, sending an unregister first only generates unnecessary traffic and puts more strain on the SIP servers.
Any thoughts?

I don’t quite know why it was written that way as it’s older PJSIP code. An option to disable that for the “pjsip send register” CLI command and AMI command would be welcome, though.