|
@@ -45,7 +45,7 @@ function show_help {
|
45
|
45
|
function sip_user_exists {
|
46
|
46
|
IFS=''
|
47
|
47
|
while read line; do
|
48
|
|
- if [[ "$line" == "<user id=\"$MY_USERNAME\">" ]]; then
|
|
48
|
+ if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
|
49
|
49
|
USER_EXISTS="yes"
|
50
|
50
|
return
|
51
|
51
|
fi
|
|
@@ -62,17 +62,17 @@ function update_sip_user {
|
62
|
62
|
IFS=''
|
63
|
63
|
while read line; do
|
64
|
64
|
if [ ! $USER_FOUND ]; then
|
65
|
|
- if [[ "$line" == "<user id=\"$MY_USERNAME\">" ]]; then
|
|
65
|
+ if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
|
66
|
66
|
USER_FOUND="yes"
|
67
|
67
|
fi
|
68
|
68
|
else
|
69
|
|
- if [[ "$line" == "<extension>"* ]]; then
|
|
69
|
+ if [[ "$line" == *"<extension>"* ]]; then
|
70
|
70
|
line="<extension>$EXTENSION</extension>"
|
71
|
71
|
fi
|
72
|
|
- if [[ "$line" == "<secret>"* ]]; then
|
|
72
|
+ if [[ "$line" == *"<secret>"* ]]; then
|
73
|
73
|
line="<secret>$PASSWORD</secret>"
|
74
|
74
|
fi
|
75
|
|
- if [[ "$line" == "<display>"* ]]; then
|
|
75
|
+ if [[ "$line" == *"<display>"* ]]; then
|
76
|
76
|
line="<display>$MY_USERNAME $EXTENSION</display>"
|
77
|
77
|
USER_FOUND=
|
78
|
78
|
fi
|
|
@@ -90,7 +90,7 @@ function add_sip_user {
|
90
|
90
|
touch $NEW_CONFIG_FILE
|
91
|
91
|
IFS=''
|
92
|
92
|
while read line; do
|
93
|
|
- if [[ "$line" == '</provision>' ]]; then
|
|
93
|
+ if [[ "$line" == *'</provision>' ]]; then
|
94
|
94
|
echo "<user id=\"$MY_USERNAME\">" >> $NEW_CONFIG_FILE
|
95
|
95
|
echo "<extension>$EXTENSION</extension>" >> $NEW_CONFIG_FILE
|
96
|
96
|
echo "<secret>$PASSWORD</secret>" >> $NEW_CONFIG_FILE
|