Bob Mottram 9 лет назад
Родитель
Сommit
a9efd5bcb3
2 измененных файлов: 9 добавлений и 9 удалений
  1. 6
    6
      src/freedombone-addsipuser
  2. 3
    3
      src/freedombone-rmsipuser

+ 6
- 6
src/freedombone-addsipuser Просмотреть файл

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

+ 3
- 3
src/freedombone-rmsipuser Просмотреть файл

43
 function sip_user_exists {
43
 function sip_user_exists {
44
     IFS=''
44
     IFS=''
45
     while read line; do
45
     while read line; do
46
-        if [[ "$line" == "<user id=\"$MY_USERNAME\">" ]]; then
46
+        if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
47
             USER_EXISTS="yes"
47
             USER_EXISTS="yes"
48
             return
48
             return
49
         fi
49
         fi
60
     IFS=''
60
     IFS=''
61
     while read line; do
61
     while read line; do
62
         if [ ! $USER_FOUND ]; then
62
         if [ ! $USER_FOUND ]; then
63
-            if [[ "$line" == "<user id=\"$MY_USERNAME\">" ]]; then
63
+            if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
64
                 USER_FOUND="yes"
64
                 USER_FOUND="yes"
65
             fi
65
             fi
66
         fi
66
         fi
67
         if [ ! $USER_FOUND ]; then
67
         if [ ! $USER_FOUND ]; then
68
             echo "$line" >> $NEW_CONFIG_FILE
68
             echo "$line" >> $NEW_CONFIG_FILE
69
         else
69
         else
70
-            if [[ "$line" == '</user>' ]]; then
70
+            if [[ "$line" == *'</user>' ]]; then
71
                 USER_FOUND=
71
                 USER_FOUND=
72
             fi
72
             fi
73
         fi
73
         fi