EOF
-# extract extensions to ring and reload extensions.conf
+# extract extensions to ring
+#echo "Input $QUERY_STRING\n"
a=`echo "$QUERY_STRING" | sed -n "s/=on*//pg" | sed -n 's,_,/,pg'`
fi
sed -i "s_s,1,Dial(.*) ;; mini-asterisk_s,1,Dial($a) ;; mini-asterisk_" /etc/asterisk/extensions.conf
+
+#reload extensions.conf
+
#asterisk -rx "dialplan reload" 2>/dev/null 1 > /dev/null
// incomming calls are routed to these extensions
-var reception = ["6002"];
+var reception = [];
function loadExtensions() {
// exten => s,1,Dial(Zap/4&SIP/6011) ;; mini-asterisk - don't remove this comment
if(line.indexOf("exten => s,1,Dial") != -1) {
- // for each Zap/ read in a single digit and convert to extension
- ret = line.indexOf("Zap/");
i=0;
- if (ret != -1)
+
+ // for each Zap/ read in a single digit and convert to extension
+ while((ret = line.indexOf("Zap/"))!=-1) {
reception [i++] = analog_ext[line.substr(ret+4,1)];
+ line = line.substr(ret+6,line.length);
+ }
// for each SIP/ read in four digits
- ret = line.indexOf("SIP/");
-// for( x in ret )
- if (ret != -1)
- reception [i++] = line.substr(ret+4,4);
-
+ while ((ret = line.indexOf("SIP/")) != -1) {
+ reception [i++] = line.substr(ret+4,4);
+ line = line.substr(ret+9,line.length);
+ }
}
}
//html += "<td>(Reception)</td>";
// the reception checkbox code
- html += "<td>" + '<input type="checkbox" name="ZAP/' + i ;
+ html += "<td>" + '<input type="checkbox" name="ZAP_' + i ;
+ // Underscore used instead of forward slash to pass thru html request
- if (reception.indexOf(analog_ext[i])> -1) {
+ if (reception.indexOf(analog_ext[i]) != -1) {
html += '" checked/>';
}
else {
html += "<td>" + ip_ext[j] + "</td>";
// the reception checkbox code
- html += "<td>" + '<input type="checkbox" name="SIP/' + ip_ext[j] ;
+ html += "<td>" + '<input type="checkbox" name="SIP_' + ip_ext[j] ;
+ // Underscore used instead of forward slash to pass thru html request
- if (!reception.indexOf(ip_ext[j])) {
+ if (reception.indexOf(ip_ext[j])!=-1) {
html += '" checked/>';
}
else {