pari: branch asterisknow r2344 - /branches/asterisknow/config/home.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Tue Feb 19 11:07:21 CST 2008


Author: pari
Date: Tue Feb 19 11:07:21 2008
New Revision: 2344

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=2344
Log:
update trunkdial macro if it is old



Modified:
    branches/asterisknow/config/home.html

Modified: branches/asterisknow/config/home.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/home.html?view=diff&rev=2344&r1=2343&r2=2344
==============================================================================
--- branches/asterisknow/config/home.html (original)
+++ branches/asterisknow/config/home.html Tue Feb 19 11:07:21 2008
@@ -169,55 +169,64 @@
 function checkessentials(){
 	// see if asterisk_guitools exists in extensions.conf
 	//if everything ok set  asterisk_guitools_inextconf = 1;
-	var opt = { method: 'get', asynchronous: true, onComplete: checkExtconfig };
-	opt.parameters="action=getconfig&filename=extensions.conf" ;
-	var tmp = new Ajax.Request(asterisk_rawmanPath , opt);
-}
-
-
-function checkExtconfig(originalRequest){
-	var lines = originalRequest.responseText.split("\n");
-	for( var i=0 ; i < lines.length ; i++){
-		if ( lines[i].substr(0,9) == "Category-"  ){
-			var tmp = lines[i].split(": ");
-			if( tmp[1].match(asterisk_guitools) ){
-				parent.asterisk_guitools_inextconf = 1;
-				break;
-			}
+	var mtd = 'macro-trunkdial';
+	var updateTrunkDial = function(){
+		parent.ABOUT_TORELOAD_GUI = true;
+		var after = function(){ // then reload asterisk
+			parent.astmanEngine.cliCommand('dialplan reload', function(t){ gui_feedback("Restarted Asterisk !!",'blue'); 
+				top.window.location.reload(); // at this point ztscan call was failed as it needs this context to run, so reload
+			}); 
+		};
+		var chs = new listOfActions(); 
+		chs.filename('extensions.conf'); var c = 0;
+		chs.build_action ( 'delcat', c , mtd, '', '');
+		chs.build_action ( 'newcat', c , mtd, '', '');
+		chs.build_action ( 'append', c , mtd, 'exten', 's,1,set(CALLERID(all)=${IF(${LEN(${CALLERID(num)})} > 6 ? ${CALLERID(all)} : ${ARG2})})' );
+		chs.build_action ( 'append', c , mtd, 'exten', 's,n,Dial(${ARG1})' );
+		chs.build_action ( 'append', c , mtd, 'exten', 's,n,Goto(s-${DIALSTATUS},1)' );
+		chs.build_action ( 'append', c , mtd, 'exten', 's-NOANSWER,1,Hangup' );
+		chs.build_action ( 'append', c , mtd, 'exten', 's-BUSY,1,Hangup' );
+		chs.build_action ( 'append', c , mtd, 'exten', '_s-.,1,NoOp' );
+		chs.callActions(after);
+	};
+	var installguitools = function(){
+		parent.ABOUT_TORELOAD_GUI = true;
+		var after = function(){ // then reload asterisk
+			parent.astmanEngine.cliCommand('dialplan reload', function(t){ gui_feedback("Restarted Asterisk !!",'blue'); 
+				top.window.location.reload(); // at this point ztscan call was failed as it needs this context to run, so reload
+			}); 
+		};
+		var chs = new listOfActions(); 
+		chs.filename('extensions.conf'); var c = 0;
+		chs.build_action ( 'newcat', c , asterisk_guitools, '', '');
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'executecommand,1,System(${command})' );
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'executecommand,n,Hangup()' );
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,1,Answer' );
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,n,Playback(vm-intro)' );
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,n,Record(${var1})' );
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,n,Playback(vm-saved)' );
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,n,Playback(vm-goodbye)' );
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,n,Hangup' );
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'play_file,1,Answer' );
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'play_file,n,Playback(${var1})' );
+		chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'play_file,n,Hangup' );
+		chs.callActions(after);
+	};
+
+	var checkExtconfig = function (op){
+		if( !op.hasOwnProperty(mtd) || (op[mtd] && !op[mtd][0].beginsWith('exten=s,1,set')) ){
+			updateTrunkDial();
+			return;
 		}
-	}
-	
-	if(parent.asterisk_guitools_inextconf == 0 ){	// if no context by name asterisk_guitools 
-		//parent.window.location.href = "./setup/install.html";
-		installguitools();
-	}
-
-}
-
-
-function installguitools(){
-	parent.ABOUT_TORELOAD_GUI = true;
-	var after = function(){ // then reload asterisk
-		parent.astmanEngine.cliCommand('reload', function(t){ gui_feedback("Restarted Asterisk !!",'blue'); 
-			top.window.location.reload(); // at this point ztscan call was failed as it needs this context to run, so reload
-		}); 
-	};
-	var chs = new listOfActions(); 
-	chs.filename('extensions.conf'); var c = 0;
-	chs.build_action ( 'newcat', c , asterisk_guitools, '', '');
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'executecommand,1,System(${command})' );
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'executecommand,n,Hangup()' );
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,1,Answer' );
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,n,Playback(vm-intro)' );
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,n,Record(${var1})' );
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,n,Playback(vm-saved)' );
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,n,Playback(vm-goodbye)' );
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'record_vmenu,n,Hangup' );
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'play_file,1,Answer' );
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'play_file,n,Playback(${var1})' );
-	chs.build_action ( 'append', c , asterisk_guitools, 'exten', 'play_file,n,Hangup' );
-	chs.callActions(after);
-}
+		if( !op.hasOwnProperty(asterisk_guitools) ){	// if no context by name asterisk_guitools 
+			installguitools();
+		}else{
+			parent.asterisk_guitools_inextconf = 1;
+		}
+	};
+	config2json('extensions.conf',0,checkExtconfig);
+}
+
 
 </script>
 <body id="foo" onload="localinit()" topmargin=0  bgcolor="EFEFEF">




More information about the asterisk-gui-commits mailing list