aboutsummaryrefslogtreecommitdiff
path: root/soxdial
diff options
context:
space:
mode:
Diffstat (limited to 'soxdial')
-rwxr-xr-xsoxdial104
1 files changed, 96 insertions, 8 deletions
diff --git a/soxdial b/soxdial
index 9b6527e..f622a84 100755
--- a/soxdial
+++ b/soxdial
@@ -184,6 +184,15 @@ is B<us>.
Play I<sec> (or I<millisec> ms) of silence before the next dial string.
+=item B<-B>, B<--bluebox>
+
+Switch to bluebox dialling mode. See B<BLUEBOX MODE> below for details.
+
+=item B<-N>, B<--normal>
+
+Switch to normal dialling mode. This is the default; this option exists
+to turn off a prior B<-B>, B<--bluebox>.
+
=back
=head2 Dial Strings
@@ -208,6 +217,34 @@ All characters that aren't mentioned above, will be silently
ignored. This allows you to paste a phone number in the form B<(555)
555-1212> and have it work correctly.
+=head1 BLUEBOX MODE
+
+A blue box is a phone phreaking device that generates tones (formerly)
+used for in-band signaling within the telephone network. B<soxdial>
+can generate these tones.
+
+To enable bluebox mode, use the B<-B>, B<--bluebox> option.
+
+Unlike touchtone dialling, bluebox signals have a timing
+specification. When entering bluebox mode, the digit time and
+inter-digit time are set to 60ms (except the kp and kp2 tones, which
+sound for 100ms).
+
+To exit bluebox mode, use the B<-N>, B<--normal> option. This resets
+the timing to whatever it was before entering bluebox mode.
+
+In bluebox mode, there is no letter-to-number conversion.
+
+The bluebox keypad has digits 0-9, which can be combined in a single
+dial string. The keys kp, kp2, st, st2, and st3 must appear alone
+as dial strings (meaning, put a space before and after them). The
+alternate names for 0 (10), st3 (11), and st2 (12) are not supported,
+since there's no way to tell an 11 from two 1's.
+
+See this Wikipedia article for more information on the blue box:
+
+ https://en.wikipedia.org/wiki/Bluebox
+
=head1 NOTES
B<1.> B<soxdial> works by iterating over the words on the command
@@ -260,6 +297,24 @@ under the WTFPL: Do WTF you want with this.
D => [941, 1633],
);
+%bluefreqs = (
+ 1 => [70, 900],
+ 2 => [700, 1100],
+ 3 => [900, 1100],
+ 4 => [700, 1300],
+ 5 => [900, 1300],
+ 6 => [1100, 1300],
+ 7 => [700, 1500],
+ 8 => [900, 1500],
+ 9 => [1100, 1500],
+ 0 => [1300, 1500],
+ 11 => [700, 1700],
+ 12 => [900, 1700],
+ kp => [1100, 1700],
+ kp2 => [1300, 1700],
+ st => [1500, 1700],
+);
+
@freqs1 = ();
@freqs2 = ();
@delays = ();
@@ -325,6 +380,20 @@ sub add_digit {
warn "$SELF: added digit '$d', time now $time\n" if $verbose;
}
+sub add_bluebox_digit {
+ my $d = shift;
+ if(!$bluefreqs{$d}) {
+ return;
+ }
+ push @freqs1, ($bluefreqs{$d}->[0]);
+ push @freqs2, ($bluefreqs{$d}->[1]);
+
+ push @delays, $time;
+
+ $time += $digittime;
+ $time += $intertime;
+}
+
# ( sox -n -p synth 2 sine 350 sine 440; sox -n -p synth 2 sine 697 sine 1209 ) | sox -G -p -d
# ...plays 2 sec of dialtone followed by 2 sec of DTMF key 1. Change the -d
# to 1.wav to save to a file. Prefix it with -rXXXX -sX if needed.
@@ -570,24 +639,43 @@ for ($argc = 0; $argc < @ARGV; $argc++) {
$intertime /= 2;
$digittime /= 2;
$pausetime /= 2;
+ } elsif(/^--?(?:B|bluebox)$/) {
+ @oldsettings = ($digittime, $intertime, $randomize);
+ $bluebox = 1;
+ $digittime = $intertime = 0.06;
+ $randomize = 0;
+ } elsif(/^--?(?:N|normal)$/) {
+ $bluebox = 0;
+ ($digittime, $intertime, $randomize) = @oldsettings if @oldsettings;
} else {
+ $_ = lc $_;
if($verbose && (/^--?[a-z]/i)) {
warn "$SELF: treating '$_' as a dial string (might be a typo?)\n";
}
warn "$SELF: start dial string '$_'\n" if $verbose;
- for (split "", $_) {
- my $digit = uc $_;
- if($extended) {
- next if $digit !~ /[0-9,#*A-D]/;
+
+ if($bluebox) {
+ if(/^(?:st[23]?|kp2?)/) {
+ add_bluebox_digit($_);
} else {
- $digit = letter2number($digit);
- next if $digit !~ /[0-9,#*]/;
+ add_bluebox_digit($_) for split "", $_;
+ }
+ } else {
+ for (split "", $_) {
+ my $digit = uc $_;
+ if($extended) {
+ next if $digit !~ /[0-9,#*A-D]/;
+ } else {
+ $digit = letter2number($digit);
+ next if $digit !~ /[0-9,#*]/;
+ }
+ add_digit($digit);
}
- add_digit($digit);
}
- warn "$SELF: end dial string '$_'\n" if $verbose;
push @sox_subcmds, make_sox_subcmd();
push @sox_subcmds, silence_subcmd(randomize($intertime));
+
+ warn "$SELF: end dial string '$_'\n" if $verbose;
}
}