bkruse: trunk r1482 - in /trunk: ./ config/scripts/tooltip.js config/users.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Aug 29 16:34:22 CDT 2007


Author: bkruse
Date: Wed Aug 29 16:34:21 2007
New Revision: 1482

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1482
Log:
Merged revisions 1481 via svnmerge from 
https://origsvn.digium.com/svn/asterisk-gui/branches/1.4

........
r1481 | bkruse | 2007-08-29 16:33:04 -0500 (Wed, 29 Aug 2007) | 5 lines

Dynamic codec implementation. No longer are they
hardcoded, but parsed from asterisk's cli command
module show like codec_
(closes issue #10588)

........

Modified:
    trunk/   (props changed)
    trunk/config/scripts/tooltip.js
    trunk/config/users.html

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-1.4-merged (original)
+++ branch-1.4-merged Wed Aug 29 16:34:21 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-1291,1293,1298-1300,1326,1332,1336-1338,1342,1346,1349,1356,1359,1362,1381,1384,1395,1399,1402,1413,1416,1426,1432,1435,1439,1442,1455,1458,1465,1471,1475,1478
+/branches/1.4:1-1291,1293,1298-1300,1326,1332,1336-1338,1342,1346,1349,1356,1359,1362,1381,1384,1395,1399,1402,1413,1416,1426,1432,1435,1439,1442,1455,1458,1465,1471,1475,1478,1481

Modified: trunk/config/scripts/tooltip.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/tooltip.js?view=diff&rev=1482&r1=1481&r2=1482
==============================================================================
--- trunk/config/scripts/tooltip.js (original)
+++ trunk/config/scripts/tooltip.js Wed Aug 29 16:34:21 2007
@@ -41,6 +41,7 @@
 	tooltips['users'] .en[21] = "<B>Can Reinvite:</B> This option can be used to tell the Asterisk server whethere or not to issue a reinvite to the client. ";
 	tooltips['users'] .en[22] = "<B>NAT:</B> Try this setting when Asterisk is on a public IP, communicating with devices hidden behind a NAT device (broadband router). If you have one-way audio problems, you usually have problems with your NAT configuration or your firewall's support of SIP+RTP ports.";
 	tooltips['users'] .en[23] = "<B>DTMFMode:</B> Set default dtmfmode for sending DTMF. Default: rfc2833 <BR><B>Other options:</B><BR>info : SIP INFO messages<BR>inband : Inband audio (requires 64 kbit codec -alaw, ulaw)<BR>auto : Use rfc2833 if offered, inband otherwise";
+	tooltips['users'] .en[24] = "<B>Codecs:</B> Click to select the codecs that asterisk has to offer, for the particular user.";
 	tooltips['users'] .en[99] = "<B>Phone Serial:</B> Enter the serial number of a Polycom phone to enable phone provisioning." ;
 
 // Tooltips for Conferencing (meetme)

Modified: trunk/config/users.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/users.html?view=diff&rev=1482&r1=1481&r2=1482
==============================================================================
--- trunk/config/users.html (original)
+++ trunk/config/users.html Wed Aug 29 16:34:21 2007
@@ -29,6 +29,7 @@
 var widgets = new Object;
 var callbacks = new Object;
 var extencallbacks = new Object;
+var allcodecs = new Array;
 var fieldnames = ['callwaiting' ,'cancel' ,'cid_number' ,'context' ,'delete' ,'email' ,'fullname' ,'group' ,'hasagent' ,'hasdirectory' ,'hasiax' ,'hasmanager' ,'hassip' ,'hasvoicemail' ,'host' ,'mailbox' ,'name' ,'new' ,'save' ,'secret' ,'threewaycalling' ,'vmsecret' ,'zapchan', 'registeriax', 'registersip','canreinvite','nat','dtmfmode', 'disallow','allow'];
 
 var localextenlength = 4;
@@ -264,12 +265,34 @@
 		widgets[fieldnames[x]] = _$(fieldnames[x]);
 		widgets[fieldnames[x]].disabled = true;
 	}
-
-	config2json('zapscan.conf', 1, analoglines_loaded ) ;
+	
+	load_codecs_fromast();
 	//parent.astmanEngine.config2list("zapscan.conf", _$('zapchan'), new Array(), phonecallbacks);
 }
 
-
+function load_codecs_fromast() {
+	
+	parent.astmanEngine.cliCommand('module show like codec_', function(resp) {
+		resp = resp.replace(/Response: Follows/, "");
+		resp = resp.replace(/Privilege: Command/, "");
+		resp = resp.replace(/--END COMMAND--/, "");
+		resp = resp.split("\n");
+		for(var i=0; resp[i] != undefined; i++) {
+			resp[i] = resp[i].split("_");
+			if(resp[i][1]) {
+				resp[i][1] = resp[i][1].split("."); 
+				if(resp[i][1][0]) {
+					if(resp[i][1][0] == "a") {
+						continue; /* codec is a_mu, alaw to mulaw direct codec/decoder, not a codec preference. */
+					}
+						allcodecs[i] = resp[i][1][0];
+				}
+			}
+		}
+		config2json('zapscan.conf', 1, analoglines_loaded ) ;
+		return true;
+	});
+}
 function free_mem(){
 	if( navigator.userAgent.indexOf("MSIE") == -1 ){ return true; }
 	try{
@@ -320,29 +343,21 @@
 		_$('disallowed').innerHTML=""; _$('allowed').innerHTML="";
 		if( _$('disallow').value == "all" && _$('allow').value =="all" ){ return true;}
 		if( _$('disallow').value == "all" ){
-			this.selectbox_add(_$("disallowed"), "ulaw");
-			this.selectbox_add(_$("disallowed"), "alaw");
-			this.selectbox_add(_$("disallowed"), "gsm");
-			this.selectbox_add(_$("disallowed"), "ilbc");
-			this.selectbox_add(_$("disallowed"), "speex");
-			this.selectbox_add(_$("disallowed"), "g726");
-			this.selectbox_add(_$("disallowed"), "adpcm");
-			this.selectbox_add(_$("disallowed"), "lpc10");
-			this.selectbox_add(_$("disallowed"), "g729");
+			for(var i=0; i < allcodecs.length; i++) { /* Add the codecs that we have installed. */
+				if(allcodecs[i]) {
+				this.selectbox_add(_$('disallowed'), allcodecs[i]);
+				}
+			}
 		}else{
 			var tmp = _$('disallow').value.split(",");
 			for(var x=0; x < tmp.length; x++){ this.selectbox_add(_$("disallowed"), tmp[x]); }
 		}
 		if(_$('allow').value =="all"){
-			this.selectbox_add(_$("allowed"), "ulaw");
-			this.selectbox_add(_$("allowed"), "alaw");
-			this.selectbox_add(_$("allowed"), "gsm");
-			this.selectbox_add(_$("allowed"), "ilbc");
-			this.selectbox_add(_$("allowed"), "speex");
-			this.selectbox_add(_$("allowed"), "g726");
-			this.selectbox_add(_$("allowed"), "adpcm");
-			this.selectbox_add(_$("allowed"), "lpc10");
-			this.selectbox_add(_$("allowed"), "g729");
+			for(var i=0; i < allcodecs.length; i++) { /* Add the codecs that we have installed. */
+				if(allcodecs[i]) {
+					this.selectbox_add(_$('allowed'), allcodecs[i]);
+				}
+			}
 		}else{
 			var tmp = _$('allow').value.split(",");
 			for(var x=0; x < tmp.length; x++){
@@ -503,7 +518,7 @@
 			</tr>
 			<tr>
 				<td onclick="CODECSETTINGS.show_codecs();" style="cursor: pointer"  class="field_text">
-					<div style="margin-left: 15px;"><I>Edit Codecs</I>
+					<div tip="en,users,24" style="margin-left: 15px;"><I>Edit Codecs</I>
 						<div style="margin-left: 15px;"><span id="codecs_text"></span></div>
 					</div>
 				</td>




More information about the asterisk-gui-commits mailing list