pari: branch pari/dahdi_support r4337 - /team/pari/dahdi_support/config/js/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Dec 10 16:47:46 CST 2008


Author: pari
Date: Wed Dec 10 16:47:45 2008
New Revision: 4337

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

 more dahdi stuff



Modified:
    team/pari/dahdi_support/config/js/pbx.js

Modified: team/pari/dahdi_support/config/js/pbx.js
URL: http://svn.digium.com/view/asterisk-gui/team/pari/dahdi_support/config/js/pbx.js?view=diff&rev=4337&r1=4336&r2=4337
==============================================================================
--- team/pari/dahdi_support/config/js/pbx.js (original)
+++ team/pari/dahdi_support/config/js/pbx.js Wed Dec 10 16:47:45 2008
@@ -465,15 +465,16 @@
 			}
 
 			if( c[d].hasOwnProperty('hasexten') && c[d]['hasexten'] == 'no' && !d.beginsWith('span_') ){ // if context is a trunk - could be a analog, iax, sip
-				if( c[d]['hasiax'] == 'yes' ){ // if the context is for an iax trunk
+				if( c[d].hasOwnProperty('hasiax') && c[d]['hasiax'].isAstTrue() ){ // if the context is for an iax trunk
 					sessionData.pbxinfo['trunks']['iax'][d] = c[d] ;
 					continue;
 				}
-				if( c[d]['hassip'] == 'yes' ){ // if the context is for an sip trunk
+				if( c[d].hasOwnProperty('hassip') && c[d]['hassip'].isAstTrue() ){ // if the context is for an sip trunk
 					sessionData.pbxinfo['trunks']['sip'][d] = c[d];
 					continue;
 				}
-				if( c[d]['zapchan'] && (!c[d]['hasiax'] || c[d]['hasiax'] =='no') && (!c[d]['hassip'] || c[d]['hassip'] =='no')){
+//				if( c[d]['zapchan'] && (!c[d]['hasiax'] || c[d]['hasiax'] =='no') && (!c[d]['hassip'] || c[d]['hassip'] =='no')){
+				if( c[d].hasOwnProperty('zapchan') || c[d].hasOwnProperty('dahdichan') ){
 					// if is an analog trunk - note that here we are NOT expecting a 'FXO channel(FXS signalled) on a T1/E1'
 					// we assume that all the ports in zapchan are actual analog FXO ports
 					// a trunk for T1/E1 analog channels would begin with 'span_'
@@ -482,7 +483,7 @@
 				}
 			}
 
-			if( d.beginsWith('span_') && c[d]['zapchan'] ){ 
+			if( d.beginsWith('span_') && ( c[d].hasOwnProperty('zapchan') || c[d].hasOwnProperty('dahdichan') ) ){
 				sessionData.pbxinfo['trunks']['pri'][d] = c[d];
 				continue;
 			}
@@ -842,7 +843,16 @@
 	addAnalogTrunk: function(tr, cbf){ // creates a new analog trunk with the details metioned in tr object, cbf is callback function
 		// usage:: astgui_managetrunks.addAnalogTrunk({ 'zapchan':'2,3,4' , (optional) trunkname:'Ports 2,3,4'} , cbf) ;
 
-		if(! tr.hasOwnProperty('zapchan') ){return false;} // zapchan is a required parameter. 
+		if( !tr.hasOwnProperty('zapchan') &&  !tr.hasOwnProperty('dahdichan') ){return false;} // zapchan is a required parameter. 
+
+		if( tr.hasOwnProperty('zapchan') ){
+			var TMP_CHANNELS = tr.zapchan ;
+			delete tr.zapchan ;
+		}
+		if( tr.hasOwnProperty('dahdichan') ){
+			var TMP_CHANNELS = tr.dahdichan ;
+			delete tr.dahdichan ;
+		}
 
 		var trunk = astgui_managetrunks.misc.nextAvailableTrunk_x();
 		var group = astgui_managetrunks.misc.nextAvailableGroup();
@@ -858,10 +868,9 @@
 			sessionData.pbxinfo.trunks.analog[trunk] = new ASTGUI.customObject; // add new/reset analog trunk info in sessionData
 		x.new_action('append', trunk, 'group', group);
 			sessionData.pbxinfo.trunks.analog[trunk]['group'] = group;
-		x.new_action('append', trunk, 'zapchan', tr.zapchan);
-			sessionData.pbxinfo.trunks.analog[trunk]['zapchan'] = tr.zapchan ;
-		var zap_channels = ASTGUI.miscFunctions.chanStringToArray(tr.zapchan);
-		delete tr.zapchan ;
+		x.new_action('append', trunk, parent.sessionData.DahdiChannelString , TMP_CHANNELS);
+			sessionData.pbxinfo.trunks.analog[trunk][parent.sessionData.DahdiChannelString] = TMP_CHANNELS;
+		var zap_channels = ASTGUI.miscFunctions.chanStringToArray( TMP_CHANNELS );
 
 		x.new_action('append', trunk, 'hasexten', 'no');
 			sessionData.pbxinfo.trunks.analog[trunk]['hasexten'] = 'no';
@@ -881,11 +890,12 @@
 
 
 		// these fields are already added, delete before iterating through userinfo
-		if(! tr.hasOwnProperty('group') ){ delete tr.group ; }
-		if(! tr.hasOwnProperty('signalling') ){ delete tr.signalling ; } // we will set the signalling based on zaptel.conf, so ignore what ever signalling is passed
-		if(! tr.hasOwnProperty('hasiax') ){ delete tr.hasiax ; }
-		if(! tr.hasOwnProperty('hassip') ){ delete tr.hassip ; }
-		if(! tr.hasOwnProperty('trunkstyle') ){ delete tr.trunkstyle ; }
+		if( tr.hasOwnProperty('group') ){ delete tr.group ; }
+		if( tr.hasOwnProperty('signalling') ){ delete tr.signalling ; } // we will set the signalling based on zaptel.conf, so ignore what ever signalling is passed
+		if( tr.hasOwnProperty('hasiax') ){ delete tr.hasiax ; }
+		if( tr.hasOwnProperty('hassip') ){ delete tr.hassip ; }
+		if( tr.hasOwnProperty('trunkstyle') ){ delete tr.trunkstyle ; }
+
 		for( var d in tr ){ if( tr.hasOwnProperty(d) ) {
 			x.new_action( 'append', trunk , d, tr[d] );
 				sessionData.pbxinfo.trunks.analog[trunk][d] = tr[d];
@@ -907,7 +917,7 @@
 			v.new_action('newcat', ct + ASTGUI.contexts.TrunkDefaultSuffix , '', ''); // add context
 			v.new_action('append', ct , 'include', ct + ASTGUI.contexts.TrunkDefaultSuffix );
 
-			v.new_action('append', 'globals', trunk , 'Zap/g' + group);
+			v.new_action('append', 'globals', trunk , parent.sessionData.DahdiDeviceString + '/g' + group);
 
 			var h = v.callActions();
 			if( h.contains('Response: Success') ){




More information about the asterisk-gui-commits mailing list