diff options
author | jim-p <jimp@pfsense.org> | 2010-09-24 11:57:54 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2010-09-24 11:57:54 -0400 |
commit | a6ae250626448753ec25daa5b8bf84fdcc431871 (patch) | |
tree | 9cc55d9e615422874153c1ab10dd91ef89737a6c /config/freeswitch | |
parent | 29e2a67d74b0db151ba2df6a17f98b192e987421 (diff) | |
download | pfsense-packages-a6ae250626448753ec25daa5b8bf84fdcc431871.tar.gz pfsense-packages-a6ae250626448753ec25daa5b8bf84fdcc431871.tar.bz2 pfsense-packages-a6ae250626448753ec25daa5b8bf84fdcc431871.zip |
More DOS line endings fixes.
Diffstat (limited to 'config/freeswitch')
-rw-r--r-- | config/freeswitch/disa.js | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/config/freeswitch/disa.js b/config/freeswitch/disa.js index 5cff6424..f705b79c 100644 --- a/config/freeswitch/disa.js +++ b/config/freeswitch/disa.js @@ -1,78 +1,78 @@ -include("/usr/local/freeswitch/scripts/config.js");
-
- //var admin_pin = ""; //don't require a pin
- //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id
- var predefined_destination = ""; //example: 9999
- //predefined_destination leave empty in most cases
- //Use this to define a single destination
- var digitmaxlength = 0;
- var timeoutpin = 7500;
- var timeouttransfer = 7500;
-
- function mycb( session, type, obj, arg ) {
- try {
- if ( type == "dtmf" ) {
- console_log( "info", "digit: "+obj.digit+"\n" );
- if ( obj.digit == "#" ) {
- //console_log( "info", "detected pound sign.\n" );
- exit = true;
- return( false );
- }
-
- dtmf.digits += obj.digit;
-
- if ( dtmf.digits.length >= digitmaxlength ) {
- exit = true;
- return( false );
- }
- }
- } catch (e) {
- console_log( "err", e+"\n" );
- }
- return( true );
- } //end function mycb
-
-
- //console_log( "info", "DISA Request\n" );
-
- var dtmf = new Object( );
- dtmf.digits = "";
-
- if ( session.ready( ) ) {
- session.answer( );
-
- if (admin_pin.length > 0) {
- digitmaxlength = 6;
- session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav", mycb, "dtmf");
- session.collectInput( mycb, dtmf, timeoutpin );
- //console_log( "info", "DISA pin: " + dtmf.digits + "\n" );
- }
-
- if (dtmf.digits == admin_pin || admin_pin.length == 0) {
-
- //console_log( "info", "DISA pin is correct\n" );
-
- us_ring = session.getVariable("us-ring");
- session.execute("set", "ringback="+us_ring); //set to ringtone
- session.execute("set", "transfer_ringback="+us_ring); //set to ringtone
- session.execute("set", "hangup_after_bridge=true");
-
- if (predefined_destination.length == 0) {
- dtmf.digits = ""; //clear dtmf digits to prepare for next dtmf request
- digitmaxlength = 11;
- session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_phone_number.wav", mycb, "dtmf");
- session.collectInput( mycb, dtmf, timeouttransfer );
- console_log( "info", "DISA Transfer: " + dtmf.digits + "\n" );
- session.execute("transfer", dtmf.digits + " XML default");
- }
- else {
- session.execute("transfer", predefined_destination + " XML default");
- }
-
- }
- else {
- session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav", mycb, "dtmf");
- console_log( "info", "DISA Pin: " + dtmf.digits + " is incorrect\n" );
- }
-
- }
+include("/usr/local/freeswitch/scripts/config.js"); + + //var admin_pin = ""; //don't require a pin + //if you choose not to require a pin then then you may want to add a dialplan condition for a specific caller id + var predefined_destination = ""; //example: 9999 + //predefined_destination leave empty in most cases + //Use this to define a single destination + var digitmaxlength = 0; + var timeoutpin = 7500; + var timeouttransfer = 7500; + + function mycb( session, type, obj, arg ) { + try { + if ( type == "dtmf" ) { + console_log( "info", "digit: "+obj.digit+"\n" ); + if ( obj.digit == "#" ) { + //console_log( "info", "detected pound sign.\n" ); + exit = true; + return( false ); + } + + dtmf.digits += obj.digit; + + if ( dtmf.digits.length >= digitmaxlength ) { + exit = true; + return( false ); + } + } + } catch (e) { + console_log( "err", e+"\n" ); + } + return( true ); + } //end function mycb + + + //console_log( "info", "DISA Request\n" ); + + var dtmf = new Object( ); + dtmf.digits = ""; + + if ( session.ready( ) ) { + session.answer( ); + + if (admin_pin.length > 0) { + digitmaxlength = 6; + session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_pin_number.wav", mycb, "dtmf"); + session.collectInput( mycb, dtmf, timeoutpin ); + //console_log( "info", "DISA pin: " + dtmf.digits + "\n" ); + } + + if (dtmf.digits == admin_pin || admin_pin.length == 0) { + + //console_log( "info", "DISA pin is correct\n" ); + + us_ring = session.getVariable("us-ring"); + session.execute("set", "ringback="+us_ring); //set to ringtone + session.execute("set", "transfer_ringback="+us_ring); //set to ringtone + session.execute("set", "hangup_after_bridge=true"); + + if (predefined_destination.length == 0) { + dtmf.digits = ""; //clear dtmf digits to prepare for next dtmf request + digitmaxlength = 11; + session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/please_enter_the_phone_number.wav", mycb, "dtmf"); + session.collectInput( mycb, dtmf, timeouttransfer ); + console_log( "info", "DISA Transfer: " + dtmf.digits + "\n" ); + session.execute("transfer", dtmf.digits + " XML default"); + } + else { + session.execute("transfer", predefined_destination + " XML default"); + } + + } + else { + session.streamFile( "/usr/local/freeswitch/sounds/custom/8000/your_pin_number_is_incorect_goodbye.wav", mycb, "dtmf"); + console_log( "info", "DISA Pin: " + dtmf.digits + " is incorrect\n" ); + } + + } |