diff --git a/src/api/pbx-groups.js b/src/api/pbx-groups.js index 0ec58c08..72a4abf6 100644 --- a/src/api/pbx-groups.js +++ b/src/api/pbx-groups.js @@ -24,9 +24,7 @@ import { assignNumbers, getNumbers } from './user' -import { - getSeatsOnly -} from './pbx-seats' +import { getSeatsOnly } from './pbx-seats' export function getGroups (options) { return new Promise((resolve, reject) => { @@ -121,7 +119,7 @@ export function createGroup (group) { let subscriberId Promise.resolve().then(() => { return createSubscriber({ - username: _.kebabCase(group.name), + username: createUsername(group.name), password: createId(), is_pbx_group: true, display_name: group.name, @@ -306,3 +304,9 @@ export function setGroupSoundSet (options) { }) }) } + +// This mirrors the logic we use in ngcp-admin to handle the pbx groups creation +// If you change the logic below make sure you make the same changes in ngcp-admin too +function createUsername (name) { + return name.trim().replaceAll(' ', '-').replace(/[^a-zA-Z0-9\-_ ]/g, '') +} diff --git a/src/pages/CscPagePbxGroupDetails.vue b/src/pages/CscPagePbxGroupDetails.vue index c2ae5df5..53ea4b91 100644 --- a/src/pages/CscPagePbxGroupDetails.vue +++ b/src/pages/CscPagePbxGroupDetails.vue @@ -67,6 +67,12 @@ /> +