Don't delete voip_numbers (which was forgotten if the status
got set to terminated anyways), rather than free them by
undef'ing the subscriber_id and reseller_id.
Don't try to insert a number into billing.voip_numbers directly,
rather than using the update_subscriber_numbers helper, which
handles the re-using of free numbers.
If a sound set is contract default and you create another default one,
the old gets non-default.
Properly handle contract default setting also when editing sound sets.
And while at it, set np-display as outbound-from-display-name dom-pref
when creating a PBX domain.
If a new contract sound set is marked as contract_default, use this
for every existing subscriber in contract_sound_set prefs if no
other set is specified yet.
If a new subscriber is created and such a sound set exists, also
use this one.
This prevents having to go over each single subscriber to assign
the contract_sound_set preference.
Now also handle alias numbers with the outsourced subroutine
update_subscriber_numbers.
Plus remove some leftovers which are already handled by
this sub.
Actually use update_subscriber_numbers when updating a subscriber
and not only when creating one. Also handle all neccessary side effects.
Now we can switch our primary number to a number which has been
inactive (that is: did not belong to a subscriber) without an update error.
Outsource the handling of the primary number from
the subscriber controller to a util sub called
update_subscriber_numbers.
It also takes care to reuse a number that has
subscriber_id set to NULL which caused the original
problem in the ticket.
This makes it possible to configure multiple lines (private, shared,
blf) and attendant console keys (blf) on a field device and generate the
proper config for it.
It does not yet support editing such a field device.
The preferences rewrite_rule_sets, ncos_levels, and sound_sets
on a domain should be restricted to ones, that have the same reseller
as the domain itself.
In addition we have to make sure, the preference view does not die,
if an invalid preference had already been selected, for example when
the respective *set/*level had been deleted or had been one, with a wrong
reseller, because of this bug, we just fixed.
Mantis: 4127
Sip diagram no longer have hardcoded parts LB, PROXY, APP, SBC.
The componnets order on diagram exactly the same as
order in call, usually it is "UA1->LB->PROXY->SBC->UA2...->UAx".
when a preference with empty value is saved, this row was just
deleted from the db. This is not true for enums, because an empty string
is not always the default value. Therefore we only delete enum preferences
when their value matches the one of the enum, configured as default.
This can be checked, by setting the domain preference outbound_pai_user
to None, which resulted in wrong behaviour before.
Mantis: 3769