Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
2ae3f297
Commit
2ae3f297
authored
9 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Get the next available SIP extension number
parent
932100d8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+2
-0
2 additions, 0 deletions
Makefile
src/freedombone-adduser
+1
-0
1 addition, 0 deletions
src/freedombone-adduser
src/freedombone-sipfreeext
+69
-0
69 additions, 0 deletions
src/freedombone-sipfreeext
with
72 additions
and
0 deletions
Makefile
+
2
−
0
View file @
2ae3f297
...
...
@@ -43,6 +43,7 @@ install:
install
-m
755 src/
${
APP
}
-logging
${
DESTDIR
}${
PREFIX
}
/bin
install
-m
755 src/
${
APP
}
-addsipuser
${
DESTDIR
}${
PREFIX
}
/bin
install
-m
755 src/
${
APP
}
-rmsipuser
${
DESTDIR
}${
PREFIX
}
/bin
install
-m
755 src/
${
APP
}
-sipfreeext
${
DESTDIR
}${
PREFIX
}
/bin
mkdir
-m
755
-p
${
DESTDIR
}${
PREFIX
}
/share/man/man1
install
-m
644 man/
${
APP
}
.1.gz
${
DESTDIR
}${
PREFIX
}
/share/man/man1
install
-m
644 man/
${
APP
}
-keydrive
.1.gz
${
DESTDIR
}${
PREFIX
}
/share/man/man1
...
...
@@ -133,6 +134,7 @@ uninstall:
rm
-f
${
PREFIX
}
/bin/
${
APP
}
-logging
rm
-f
${
PREFIX
}
/bin/
${
APP
}
-addsipuser
rm
-f
${
PREFIX
}
/bin/
${
APP
}
-rmsipuser
rm
-f
${
PREFIX
}
/bin/
${
APP
}
-sipfreeext
clean
:
rm
-f
\#
*
\.
#* debian/*.substvars debian/*.log
rm
-fr
deb.
*
debian/
${
APP
}
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-adduser
+
1
−
0
View file @
2ae3f297
...
...
@@ -205,6 +205,7 @@ if grep -q "Blog domain" $COMPLETION_FILE; then
fi
if
grep
-q
"install_sip"
$COMPLETION_FILE
;
then
SIP_EXTENSION
=
$(
freedombone-sipfreeext
)
freedombone-addsipuser
-u
$MY_USERNAME
-e
$SIP_EXTENSION
-p
"
$NEW_USER_PASSWORD
"
if
[
!
"
$?
"
=
"0"
]
;
then
echo
'SIP user could not be added'
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-sipfreeext
0 → 100755
+
69
−
0
View file @
2ae3f297
#!/bin/bash
#
# .---. . .
# | | |
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
#
# Freedom in the Cloud
#
# Returns the next free SIP extension number
# License
# =======
#
# Copyright (C) 2015 Bob Mottram <bob@robotics.uk.to>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
CONFIG_FILE
=
/etc/sipwitch.conf
extensions
=()
# get the used extensions
for
line
in
$
(
cat
$CONFIG_FILE
)
do
if
[[
"
$line
"
==
"<extension>"
*
]]
;
then
ext
=
$(
echo
"
$line
"
|
awk
-F
'>'
'{print $2}'
|
awk
-F
'<'
'{print $1}'
)
extensions+
=(
$ext
)
fi
if
[[
"
$line
"
==
'</provision>'
]]
;
then
break
fi
done
#echo "used extensions:"
#echo $extensions
#echo " "
# which is the first available unused extension ?
for
ext
in
$(
seq
201 299
)
;
do
is_used
=
for
i
in
"
${
extensions
[@]
}
"
do
if
[[
"
$i
"
==
"
$ext
"
]]
;
then
is_used
=
1
break
fi
done
if
[
!
$is_used
]
;
then
echo
$ext
;
break
fi
done
exit
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment