espiceland: branch 2.0 r5116 - in /branches/2.0/config: ./ js/
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Tue Nov 9 13:34:34 CST 2010
Author: espiceland
Date: Tue Nov 9 13:34:30 2010
New Revision: 5116
URL: http://svnview.digium.com/svn/asterisk-gui?view=rev&rev=5116
Log:
Allow caller ID to be set per outgoing calling rule.
Modified:
branches/2.0/config/callingrules.html
branches/2.0/config/js/astman.js
branches/2.0/config/js/callingrules.js
branches/2.0/config/js/pbx.js
branches/2.0/config/js/tooltip.js
Modified: branches/2.0/config/callingrules.html
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/callingrules.html?view=diff&rev=5116&r1=5115&r2=5116
==============================================================================
--- branches/2.0/config/callingrules.html (original)
+++ branches/2.0/config/callingrules.html Tue Nov 9 13:34:30 2010
@@ -3,9 +3,11 @@
*
* Manage Calling Rules
*
- * Copyright (C) 2006-2008, Digium, Inc.
+ * Copyright (C) 2006-2010, Digium, Inc.
*
* Pari Nannapaneni <pari at digium.com>
+ * Ryan Brindley <rbrindley at digium.com>
+ * Erin Spiceland <espiceland at digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -85,6 +87,9 @@
<TR> <TD align="right">Pattern <img src="images/tooltip_info.gif" tip="en,callingrules,1" class='tooltipinfo'> :</TD>
<TD><input id="new_crl_pattern" size=20 field_name='Pattern' validation='dialpattern' required='yes'></TD>
</TR>
+ <TR> <TD align="right">Caller ID<img src="images/tooltip_info.gif" tip="en,callingrules,8" class='tooltipinfo'> :</TD>
+ <TD><input id="new_crl_caller_id" size=20'></TD>
+ </TR>
<TR> <TD colspan=2>
<fieldset>
<legend> <input type=checkbox id='toLocalDest' required="yes">
Modified: branches/2.0/config/js/astman.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/astman.js?view=diff&rev=5116&r1=5115&r2=5116
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Tue Nov 9 13:34:30 2010
@@ -3,10 +3,12 @@
*
* Javascript functions for accessing manager over HTTP and Some UI components/functions used in AsteriskGUI.
*
- * Copyright (C) 2006-2008, Digium, Inc.
+ * Copyright (C) 2006-2010, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
* Pari Nannapaneni <pari at digium.com>
+ * Ryan Brindley <rbrindley at digium.com>
+ * Erin Spiceland <espiceland at digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -1713,11 +1715,11 @@
}
break;
- case ' ':
+ /*case ' ':
if (!depth) {
continue;
}
- break;
+ break;*/
case ')':
if (depth) {
depth--;
@@ -2010,26 +2012,35 @@
var cr = { };
cr.actualString = str ;
cr.pattern = ASTGUI.parseContextLine.getExten(str);
- if( str.contains('Macro(') && str.contains('trunkdial') ){ // if is some version of trunk dial marco
+ cr.callerID = '';
+ if( str.contains('Macro(') ){
var macroargs = ASTGUI.parseContextLine.getArgs(str);
- cr.macroname = macroargs[0] ;
- var t1 = ASTGUI.parseContextLine.parseTrunkDialArgument( macroargs[1] ) ;
- cr.firstTrunk = t1.name ;
- cr.firstPrepend = t1.prepend ;
- cr.stripdigits_firstTrunk = t1.stripx ;
- cr.firstFilter = t1.filter;
+ if( str.contains('trunkdial') ){ // if is some version of trunk dial marco
+ cr.macroname = macroargs[0] ;
+ var t1 = ASTGUI.parseContextLine.parseTrunkDialArgument( macroargs[1] ) ;
+ cr.firstTrunk = t1.name ;
+ cr.firstPrepend = t1.prepend ;
+ cr.stripdigits_firstTrunk = t1.stripx ;
+ cr.firstFilter = t1.filter;
- if( macroargs.length <= 2 || ( macroargs.length > 2 && macroargs[2].trim() == '') ){ // if a failback trunk is not defined
- cr.secondTrunk = '' ;
- cr.secondPrepend = '' ;
- cr.stripdigits_secondTrunk = '' ;
- cr.secondFilter = '';
- }else{
- var t2 = ASTGUI.parseContextLine.parseTrunkDialArgument( macroargs[2] ) ;
- cr.secondTrunk = t2.name ;
- cr.secondPrepend = t2.prepend ;
- cr.stripdigits_secondTrunk = t2.stripx ;
- cr.secondFilter = t2.filter;
+ // Why is the second part of this condition necessary?
+ // if( macroargs.length <= 2 || ( macroargs.length > 2 && macroargs[2].trim() == '') ){ // if a failback trunk is not defined
+ if( macroargs.length <= 3 ){ // if a failover trunk is not defined
+ cr.secondTrunk = '' ;
+ cr.secondPrepend = '' ;
+ cr.stripdigits_secondTrunk = '' ;
+ cr.secondFilter = '';
+ }else{
+ var t2 = ASTGUI.parseContextLine.parseTrunkDialArgument( macroargs[2] ) ;
+ cr.secondTrunk = t2.name ;
+ cr.secondPrepend = t2.prepend ;
+ cr.stripdigits_secondTrunk = t2.stripx ;
+ cr.secondFilter = t2.filter;
+ }
+
+ if(macroargs.length == 4 || macroargs.length == 6){
+ cr.callerID = macroargs[macroargs.length - 1];
+ }
}
}else{
cr.destination = ASTGUI.parseContextLine.getAppWithArgs( str ) ;
Modified: branches/2.0/config/js/callingrules.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/callingrules.js?view=diff&rev=5116&r1=5115&r2=5116
==============================================================================
--- branches/2.0/config/js/callingrules.js (original)
+++ branches/2.0/config/js/callingrules.js Tue Nov 9 13:34:30 2010
@@ -3,9 +3,11 @@
*
* Calling Rules functions
*
- * Copyright (C) 2006-2008, Digium, Inc.
+ * Copyright (C) 2006-2010, Digium, Inc.
*
* Pari Nannapaneni <pari at digium.com>
+ * Ryan Brindley <rbrindley at digium.com>
+ * Erin Spiceland <espiceland at digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -36,7 +38,7 @@
EDIT_CR_RULE = '';
_$('cr_dialog_title').innerHTML =' New CallingRule';
- ASTGUI.resetTheseFields ( [ DOM_new_crl_name, DOM_new_crl_pattern, DOM_new_crl_trunk, DOM_new_crl_tr_stripx, DOM_new_crl_tr_prepend, DOM_new_crl_tr_filter, DOM_new_crl_foChkbx, DOM_new_crl_fotrunk, DOM_new_crl_fotr_stripx, DOM_new_crl_fotr_prepend , DOM_new_crl_fotr_filter, 'toLocalDest' , 'new_crl_localDest'] );
+ ASTGUI.resetTheseFields ( [ DOM_new_crl_name, DOM_new_crl_pattern, DOM_new_crl_trunk, DOM_new_crl_tr_stripx, DOM_new_crl_tr_prepend, DOM_new_crl_tr_filter, DOM_new_crl_foChkbx, DOM_new_crl_fotrunk, DOM_new_crl_fotr_stripx, DOM_new_crl_fotr_prepend , DOM_new_crl_fotr_filter, 'toLocalDest' , 'new_crl_localDest', 'new_crl_caller_id'] );
_$('toLocalDest').updateStatus();
$(DOM_new_CRL_DIV).showWithBg();
ASTGUI.feedback({ msg:'New CallingRule !', showfor:1 });
@@ -56,6 +58,7 @@
DOM_new_crl_name.value = EDIT_CR.withOut(ASTGUI.contexts.CallingRulePrefix) ;
DOM_new_crl_name.disabled = true;
DOM_new_crl_pattern.value = tmp_cr.pattern ;
+ DOM_new_crl_caller_id.value = tmp_cr.callerID;
_$('new_crl_localDest').selectedIndex = -1;
if( tmp_cr.destination ){
ASTGUI.selectbox.selectOption('new_crl_localDest', tmp_cr.destination);
@@ -100,6 +103,7 @@
DOM_new_CRL_DIV = _$('new_CRL_DIV');
DOM_new_crl_name = _$('new_crl_name');
DOM_new_crl_pattern = _$('new_crl_pattern');
+ DOM_new_crl_caller_id= _$('new_crl_caller_id');
DOM_new_crl_trunk = _$('new_crl_trunk');
DOM_new_crl_tr_stripx = _$('new_crl_tr_stripx');
DOM_new_crl_tr_prepend = _$('new_crl_tr_prepend');
@@ -307,12 +311,29 @@
}
}
+ var caller_id = ASTGUI.getFieldValue('new_crl_caller_id');
+ if(/[^\w\d\s_\-"<>]/.test(caller_id)){
+ ASTGUI.feedback( { msg:'Invalid Caller ID format!', showfor:2, color:'red' });
+ return ;
+ }
+ if (caller_id && caller_id != 'undefined'){
+ caller_id = ',' + caller_id;
+ }else{
+ caller_id = '';
+ }
+
if( _$('toLocalDest').checked ){
var tmp_new_crl_localDest = ASTGUI.getFieldValue('new_crl_localDest') ;
if( tmp_new_crl_localDest == 'CUSTOM' ){
var as = DOM_new_crl_pattern.value + ',1,' + ASTGUI.getFieldValue('new_crl_localDest_CUSTOM') ; ////// <<<<<<<<<<<<<<<<<<<
}else{
- var as = DOM_new_crl_pattern.value + ',1,' + tmp_new_crl_localDest ;
+ var as = DOM_new_crl_pattern.value + ',1,';
+ if(caller_id){
+ var args = ASTGUI.parseContextLine.getArgs(DOM_new_crl_pattern.value + ',1,'+ tmp_new_crl_localDest);
+ as += "Macro(local-callingrule-cid-0.1," + args[0] + ',' + args[1] + ',' + args[2] + caller_id + ')';
+ }else{
+ as += tmp_new_crl_localDest;
+ }
}
}else{
var t1 = ASTGUI.getFieldValue(DOM_new_crl_trunk);
@@ -359,7 +380,7 @@
var t1_cidarg = ( t1 == 'Skype') ? ',' : ',' + t1 ;
var t2_cidarg = ( t2 == 'Skype') ? ',' : ',' + t2 ;
- var as = DOM_new_crl_pattern.value + ',1,Macro(' + ASTGUI.contexts.dialtrunks + Trunk_Build_str + foTrunk_Build_str + t1_cidarg + t2_cidarg + ')' ;
+ var as = DOM_new_crl_pattern.value + ',1,Macro(' + ASTGUI.contexts.dialtrunks + Trunk_Build_str + foTrunk_Build_str + t1_cidarg + t2_cidarg + caller_id + ')' ;
}
if( isNew ){
Modified: branches/2.0/config/js/pbx.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/pbx.js?view=diff&rev=5116&r1=5115&r2=5116
==============================================================================
--- branches/2.0/config/js/pbx.js (original)
+++ branches/2.0/config/js/pbx.js Tue Nov 9 13:34:30 2010
@@ -3,9 +3,11 @@
*
* core parsing functions used in index.html
*
- * Copyright (C) 2006-2008, Digium, Inc.
+ * Copyright (C) 2006-2010, Digium, Inc.
*
* Pari Nannapaneni <pari at digium.com>
+ * Ryan Brindley <rbrindley at digium.com>
+ * Erin Spiceland <espiceland at digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -91,19 +93,25 @@
check_For_Contexts[ASTGUI.contexts.guitools][4] = 'exten=record_vmenu,n,Record(${var1},0,500,k)';
}
+ check_For_Contexts[ 'macro-' + ASTGUI.contexts.localcrcid ] = [
+ 'exten=s,1,Set(CALLERID(all)=${IF($[${LEN(${ARG4})} > 2]?${ARG4}:)})',
+ 'exten=s,n,Goto(${ARG1},${ARG2},${ARG3})'
+ ];
check_For_Contexts[ 'macro-' + ASTGUI.contexts.dialtrunks ] = [
- // "; Macro by = Brandon Kruse <bkruse at digium.com> & Matthew O'Gorman mogorman at digium.com",
+ // "; Macro by = Brandon Kruse, Matthew O'Gorman, & Erin Spiceland <espiceland at digium.com>",
'exten=s,1,GotoIf($[${LEN(${FMCIDNUM})} > 6]?1-fmsetcid,1)',
- 'exten=s,2,GotoIf($[${LEN(${GLOBAL_OUTBOUNDCIDNAME})} > 1]?1-setgbobname,1)',
- 'exten=s,3,Set(CALLERID(num)=${IF($[${LEN(${CID_${CALLERID(num)}})} > 2]?${CID_${CALLERID(num)}}:)})',
+ 'exten=s,n,GotoIf($[${LEN(${GLOBAL_OUTBOUNDCIDNAME})} > 1]?1-setgbobname,1)',
+ 'exten=s,n,Set(CALLERID(num)=${IF($[${LEN(${CID_${CALLERID(num)}})} > 2]?${CID_${CALLERID(num)}}:)})',
+ 'exten=s,n,Set(CALLERID(all)=${IF($[${LEN(${ARG5})} > 2]?${ARG5}:)})',
'exten=s,n,GotoIf($[${LEN(${CALLERID(num)})} > 6]?1-dial,1)',
'exten=s,n,Set(CALLERID(all)=${IF($[${LEN(${CID_${ARG3}})} > 6]?${CID_${ARG3}}:${GLOBAL_OUTBOUNDCID})})',
+ 'exten=s,n,Set(CALLERID(all)=${IF($[${LEN(${ARG5})} > 2]?${ARG5}:)})',
'exten=s,n,Goto(1-dial,1)',
'exten=1-setgbobname,1,Set(CALLERID(name)=${GLOBAL_OUTBOUNDCIDNAME})',
'exten=1-setgbobname,n,Goto(s,3)',
'exten=1-fmsetcid,1,Set(CALLERID(num)=${FMCIDNUM})',
'exten=1-fmsetcid,n,Set(CALLERID(name)=${FMCIDNAME})',
- 'exten=1-fmsetcid,n,Goto(1-dial,1)',
+ 'exten=1-fmsetcid,n,Goto(s,4)',
'exten=1-dial,1,Dial(${ARG1})',
'exten=1-dial,n,Gotoif(${LEN(${ARG2})} > 0 ?1-${DIALSTATUS},1:1-out,1)',
'exten=1-CHANUNAVAIL,1,Dial(${ARG2})',
Modified: branches/2.0/config/js/tooltip.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/tooltip.js?view=diff&rev=5116&r1=5115&r2=5116
==============================================================================
--- branches/2.0/config/js/tooltip.js (original)
+++ branches/2.0/config/js/tooltip.js Tue Nov 9 13:34:30 2010
@@ -3,7 +3,10 @@
*
* Tooltips for various fields across different pages in the gui
*
- * Copyright (C) 2006-2008, Digium, Inc.
+ * Copyright (C) 2006-2010, Digium, Inc.
+ *
+ * Ryan Brindley <rbrindley at digium.com>
+ * Erin Spiceland <espiceland at digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -277,7 +280,7 @@
tooltips['iax_general'].en[36] = "<B>Ignore Expired Peers:</B> if the peers ip registration is expired use the ip information if available.";
tooltips['iax_general'].en[37] = "<B>Disallowed Codecs:</B> set default disallow codecs to the following";
tooltips['iax_general'].en[38] = "<B>Allowed Codecs:</B> set allowed codecs to the following.";
- tooltips['iax_general'].en[40] = "A single IP address or a range of IP addresses for which call token validation is not required in the form \"11.11.11.11\" or \"11.11.11.11/22.22.22.22\".";
+ tooltips['iax_general'].en[40] = "A single IP address or a range of IP addresses for which call token validation is not required in the form <b>11.11.11.11</b> or <b>11.11.11.11/22.22.22.22</b>.";
tooltips['iax_general'].en[41] = "<B>Max Call Numbers:</B> Limits the amount of call numbers allowed for a single IP address.";
tooltips['iax_general'].en[42] = "<B>Max Nonvalidated Call Numbers:</B> Limits the amount of nonvalidated call numbers for all IP addresses combined.";
@@ -360,7 +363,8 @@
tooltips['callingrules'].en[4] = "<B>FailOver Trunk:</B> Failover trunks can be used to make sure that a call goes through an alternate route, when the primary trunk is busy or down If \"Use Failover Trunk\" is checked and \"Failover trunk\" is defined, then calls that cannot be placed via the regular trunk may have a secondary trunk defined. If a user's primary trunk is a VoIP trunk, but one wants calls to use the PSTN when the VoIP trunk isn't available, this option is a good idea.";
tooltips['callingrules'].en[5] = "<B>Send To Local Destination:</B> If this option is checked and Destination is defined, calls matching the specified pattern may be sent to a local extension.";
tooltips['callingrules'].en[6] = "Defines the Trunk that calls, matching the specified pattern, will be placed through.";
- tooltips['callingrules'].en[7] = "<b>Filter:</b> This mandatory option is used to filter out certain characters. The characters listed in this field will be permitted, while all others will be filtered out. For example, a value of '012345' would allow 0, 1, 2, 3, 4, and 5, but filter out 6, 7, 8, and 9. Note: If this field is left blank, the resultant dial string will be null.";
+ tooltips['callingrules'].en[7] = "<b>Filter:</b> This option is used to filter out certain characters. The characters listed in this field will be permitted, while all others will be filtered out. For example, a value of '012345' would allow 0, 1, 2, 3, 4, and 5, but filter out 6, 7, 8, and 9.";
+ tooltips['callingrules'].en[8] = "<b>Caller ID:</b> This field takes precedence over any other Caller ID settings that may be configured for users or trunks. Specify a caller id string in the form <b>Name <000-000-0000></b> or <b>Name <0000></b>. Leaving this setting blank will allow the Caller ID settings configured in other areas to remain in place. Using only a number here will cause the name field to be blank, and the same is true for using a name only. This field is ignored when the destination is a custom macro or application.";
// Tooltips for Incoming Calls (incoming)
More information about the asterisk-gui-commits
mailing list