rbrindley: branch 2.0 r4713 - in /branches/2.0/config/js: astman.js pbx2.js

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Tue Apr 7 09:02:35 CDT 2009


Author: rbrindley
Date: Tue Apr  7 09:02:31 2009
New Revision: 4713

URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4713
Log:

js/pbx2.js
- registersip, not reigstersip :-/
- also, registersip is yes if host != dynamic
js/astman.js
- consalidated line if statement into switch case
- last unregistered condition now says Unrecognized Trunk


Modified:
    branches/2.0/config/js/astman.js
    branches/2.0/config/js/pbx2.js

Modified: branches/2.0/config/js/astman.js
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/js/astman.js?view=diff&rev=4713&r1=4712&r2=4713
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Tue Apr  7 09:02:31 2009
@@ -1188,25 +1188,23 @@
 		var uname_lc = uname.toLowerCase().substr(0,10);
 
 		for(var i = 0; i < lines.length; i++) {
+			var line_orig = lines[i];
 			var line = lines[i].trim().toLowerCase();
-			if (!line || line.beginsWith('host') ){ continue; }
+			if (!line || line.beginsWith('host') ) { 
+				continue; 
+			}
 			if( ( line.beginsWith(host+':') || ( this_IP && line.beginsWith(this_IP + ' ') ) )  && line.contains( ' ' + uname_lc + ' ' ) ){
-				if( line.contains(' registered') ){
-					return '<font color=green>Registered</font>' ;
-				}else if( line.contains('auth. sent') ){
-					return '<font color=red>Waiting for Authentication</font>';
-				}else if( line.contains('request sent') ){
-					return '<font color=red>Request Sent</font>';
-				}else if( line.contains('rejected') ){
-					return '<font color=red>Rejected</font>';
-				}else if( line.contains('unregistered') ){
-					return '<font color=red>Unregistered</font>';
-				}else{
-					return '<font color=red>Unregistered</font>';
-				}
-			}
-		}
-		return '<font color=red>Unregistered</font>';
+				var vals = line_orig.split(/[ \t][ \t]*/); /* Host, Username, Refresh, State, Reg.Time */
+				switch(vals[3]) {
+				case 'registered':
+				case 'Registered':
+					return '<font color="green">registered</font>';
+				default:
+					return '<font color="red">'+vals[3]+'</font>';
+				}
+			}
+		}
+		return '<font color=red>Unrecognized Trunk</font>';
 		}catch(err){
 			top.log.error(err.description);
 		}

Modified: branches/2.0/config/js/pbx2.js
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/js/pbx2.js?view=diff&rev=4713&r1=4712&r2=4713
==============================================================================
--- branches/2.0/config/js/pbx2.js (original)
+++ branches/2.0/config/js/pbx2.js Tue Apr  7 09:02:31 2009
@@ -1215,7 +1215,7 @@
 	trunk.hasiax = (type === 'iax') ? 'yes' : 'no';
 	trunk.hassip = (type === 'sip') ? 'yes' : 'no';
 	trunk.registeriax = (type === 'iax') ? 'yes' : 'no';	/* same conditions as hasiax */
-	trunk.reigstersip = (trunk.host === 'dynamic' && type === 'sip') ? 'yes' : 'no';
+	trunk.registersip = (trunk.host !== 'dynamic' && type === 'sip') ? 'yes' : 'no';
 	trunk.trunkname = trunk.trunkname || '';
 	trunk.trunkstyle = (type === 'analog') ? type : 'voip';
 




More information about the asterisk-gui-commits mailing list