Moment of Zen: Make a textual QR Code from the command line

[dude@talos werkkeys]$ yum install qrencode
[dude@talos werkkeys]$ qrencode -t utf8 "foobar"

Use it to:

  • Get plain text on your cell (remember: copy to clipboard, it’s not just for URLs)
  • Transfer a strong (and long) password from a terminal session
  • Get URLs from a remote terminal session
  • Impress the ladies. [optional?]
Posted in Geekery

Raspberry Pi w/ Arch Linux: Static IPs the easy way

So you want a static IP in your Arch distribution on your Raspberry Pi because you don’t wanna hunt down DHCP huh? Yeah, I don’t.

I used a variety of tutorials, but…. Nothing was easy. And almost all of them invariably make it so you have to log in once, first.

I like to change my network settings by pulling the SD card out and then changing the files — if I’m between locations with my Pi. I might carry it in my backpack and use it on up to 4 networks (home, studio, werk, and inevitably @ Laboratory B)

Well, take a stroll on easy street. The default configuration lives @ [I think! Chris thanks for pointing out that I had the wrong location in this post!!] /etc/network.d/interfaces/ethernet-eth0

If you can’t find the file there, go for a:

find /etc/. | grep -i "eth0"

Find this section and change it up (especially, uncomment it) to suit your network. Also, comment out the DHCP stuff, too (it’s up at the top)

## Change for static
CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='192.168.1.100'
##ROUTES=('192.168.0.0/24 via 192.168.1.2')
GATEWAY='192.168.1.1'
DNS=('192.168.1.1')

Boot, and enjoy.

Or if you’re already at the command line, go ahead and reset it with

[user@host]$ netcfg -r ethernet-eth0
Posted in raspberryPi

Raspberry Pi Bluetooth w/ GBU321 — the solution.

Got yourself one of these? A GBU321, as recommended in the verified peripherals?

I didn’t have a cake walk. Namely, I kept running into an error like “hci0 command tx timeout” — and lots of flakiness. Sometimes my hci0 would come up in a up state, sometimes a down. Here’s my lsusb:

pi@raspberrypi ~ $ lsusb
[...]
Bus 001 Device 004: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)
Bus 001 Device 005: ID 0a5c:4502 Broadcom Corp. Keyboard (Boot Interface Subclass)
Bus 001 Device 006: ID 0a5c:4503 Broadcom Corp. Mouse (Boot Interface Subclass)
Bus 001 Device 007: ID 0a5c:2148 Broadcom Corp. BCM92046DG-CL1ROM Bluetooth 2.1 Adapter

I have what I believe to be the silver bullet. It appears that the Raspberry Pi Github has an issue listed that is what did the trick, for mine.

It appears that the issue might be with the USB speed negotiation. So, here’s a work-around in your /boot/cmdline.text, add “dwc_otg.speed=1″ near the end. My entire line now looks like:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline dwc_otg.speed=1 rootwait

To install up the requirements — I followed this method for a PS3 controller as recommended by a guy in this raspi forum post (which I mean to comment on: note to self!)

/* asdf foo */
root@raspberrypi:~# apt-get install bluetooth
root@raspberrypi:~# apt-get install bluetooth --fix-missing
root@raspberrypi:~# reboot
root@raspberrypi:~# hciconfig -a
root@raspberrypi:~# hciconfig hci0 piscan
root@raspberrypi:~# bluez-simple-agent 
Agent registered
RequestConfirmation (/org/bluez/1824/hci0/dev_B0_D0_9C_58_XX_YY, 614348)
Confirm passkey (yes/no): yes
root@raspberrypi:~# bluez-test-device trusted B0:D0:9C:58:XX:YY yes
Posted in raspberryPi

Asterisk + Zoiper on Android Sample Configuration, with IAX

Yep, this is really the thing that makes Zoiper worthwhile as a softphone is that you can use an IAX connection. Pretty nice.

I figured I’d post up my configuration in case any one else is looking for an example:

Here’s my /etc/asterisk/iax.conf

[general]
bandwidth=low
disallow=lpc10                  ; Icky sound quality...  Mr. Roboto.
jitterbuffer=no
forcejitterbuffer=no
autokill=yes
 
[theuser]
type=friend
auth=md5
context=yourextensioncontext
trunk=no
secret=makeagoodsecret
defaultuser=theuser
username=theuser
host=dynamic
encryption=yes
requirecalltoken=no
disallow=all
allow=gsm

And on my Zoiper softphone:

Account name: [arbitrary]
Host: [your hostname/ip/etc]
Username: theuser
Password: makeagoodsecret
Context: yourextensioncontext

I whiffed a good couple times trying to get it to work, it seemed to be a combo between A. not setting the context in Zoiper, and B. possibly having the wrong “type” (friend/peer/user) in the iax.conf section.

Posted in Asterisk, Uncategorized

Tightening down Asterisk on CentOS: Don’t run as root.

First order of business, in Future of Telephony 3rd edition chapter 3, their install process goes through adding a specific user for asterisk. It’s great. But, one thing it doesn’t do for me, is… Allow a user that’s “not root” and “not the asterisk” user, to access the Asterisk CLI. So, if you want to run the CLI with group permissions, there’s a few more steps. That way I can add my regular users who need access to the Asterisk CLI (including me) to the “asterisk group”.

To summarize, without having to sift through the rest of the install (assuming you’ve already got an install process). Note: You’ll probably have to do most of this sudo/root style. I shut my asterisk service down before doing this, you might want to, too.

# You probably want to have something less obvious than "asterisk" as the user name, fwiw.
[user@host ~]$ /usr/sbin/useradd asterisk
[user@host ~]$ passwd asterisk
# assuming you don't want them to login [I don't].
[user@host ~]$ usermod -s /usr/sbin/nologin asterisk
# Next, add your user to the asterisk group.
[user@host ~]$ usermod -a -G asterisk your_user_name
# Then apply the permissions as suggested by Leif in *:TFoT
[user@host ~]$ chown -R asterisk:asterisk /usr/lib/asterisk/
[user@host ~]$ chown -R asterisk:asterisk /var/lib/asterisk/
[user@host ~]$ chown -R asterisk:asterisk /var/spool/asterisk/
[user@host ~]$ chown -R asterisk:asterisk /var/log/asterisk/
[user@host ~]$ chown -R asterisk:asterisk /var/run/asterisk/
[user@host ~]$ chown asterisk:asterisk /usr/sbin/asterisk

And then you’ll have to set that in the asterisk.conf, that you want asterisk to run as that user, uncomment these lines / tailor the user & group:

runuser = asterisk              ; The user to run as.
rungroup = asterisk             ; The group to run as.

What’s left out in Leif’s process is making sure your asterisk.ctl file in /var/run/asterisk/ has proper permission so that users of the asterisk group can write to it. These settings can be found in the asterisk.conf file as well.

; Changing the following lines may compromise your security.
[files]
astctlpermissions = 0775
astctlowner = asterisk
astctlgroup = asterisk
astctl = asterisk.ctl
Posted in Asterisk

Xiki: For the VIM and Fedora guy

So yeah, I love the idea of Xiki (definitely check out this screencast for a snapshot of how it works)… But as they say, “You lost me at Emacs.”

i_use_emacs.jpeg

* This is a scambaiting trophy from the infamous “Fritz Weisenheimer” a scam-baiting personality. It’s just all too applicable now.

So, ehn. As a long time vi guy (and I don’t expect this to fully replace vi), I decided to bite the bullet and try it. Also, I’m not a ruby guy. So this Emacs + Ruby stack was like “Uhhh oh.” But as the xiki guy says “You don’t have to know Emacs.” So along I trudged, and eventually I was able to get it to work in Fedora 17, the beefy miracle.

You can follow their installation tutorial, at the main page of Xiki’s github page. And as usual that kind of thing got me “most of the way there.” But, I ran into a few snags, and this is the recipe I came up with.

Note! You may have to run some of these commands as root.

[user@host]$ yum install ruby rubygems
[user@host]$ yum install emacs
[user@host]$ gem install bundle
[user@host]$ gem install trogdoro-el4r
[user@host]$ wget https://github.com/trogdoro/xiki/zipball/master
[user@host]$ mv trogdoro-xiki-X.Y.Z-stuff.zip xiki.zip
[user@host]$ unzip xiki.zip
[user@host]$ mv xiki/ /usr/src/xiki
[user@host]$ cd /usr/src
[user@host]$ cd xiki
[user@host]$ bundle install --system
[user@host]$ ruby etc/command/copy_xiki_command_to.rb /usr/local/bin/xiki
[user@host]$ bash etc/install/el4r_setup.sh
[user@host]$ xiki
[user@host]$ xiki status
[user@host]$ xiki restart
[user@host]$ xiki directory # copy the output from this for the init.rb
[user@host]$ nano ~/.el4r/init.rb
# init.rc file:
# $LOAD_PATH.unshift "{copied directory from above}/lib"
# require 'xiki'
# Xiki.init
#
# KeyBindings.keys   # Use default key bindings
# Themes.use "Default"  # Use xiki theme
[user@host]$ emacs

Now once you’re in emacs, give it a try, create a line that reads: “$ ls -l” and then hit alt-enter. Voila! It should print a list from a ls command and allow you to edit that text, etc.

When you’re going through this and run into trouble, list your /tmp dir and check out the newest files there — you’ll see a couple logs from el4r, and from xiki. (This didn’t exactly help me through the process, but, figured I would note it)

I also realized that “alt+l” (small l, as in Larry) re-loads the el4r, which if xiki bugs out, is handy to use.

Notably, after this whole process… The “pretty theme” didn’t load, all the formatting was plain, and I could only use alt-enter, and not double click. I’m not sure -exactly- what fixed it. But in the meanwhile doing other things, I rebooted my laptop, and then fired up emacs again… And! It all worked. I understand this isn’t a solution by any means, but, maybe it can trigger in your own brain reading this, what you may need to reset/restart if you’d like to achieve this without a reboot.

Continue reading »

Posted in Geekery

Asterisk+Debian RaspberryPi Image for Download

Torrent: debian_asterisk18_2012-06-04.img.gz.torrent [Magnet URL]
SHA-1: c21807659d045a3b9e942313d516412072db1ac5

Debian Squeeze (debian6-19-04-2012) + Asterisk 1.8.13rc2 For Raspberry Pi. The Image.

Asterisk features installed:
- TLS / SRTP
- Jabber / GTalk (for Google Voice)
- No ODBC.
- No FreePBX.

The only alterations are:
- Root password is: root
- User “pi” password is: raspberry (that’s actually default)
- Static IP @ 192.168.1.101
- SSH Daemon starts at boot
- Dependencies for Asterisk installed
- Asterisk 1.8.13 rc 2 installed.
- Asterisk source in /usr/src
- Asterisk starts at boot

Requires: 2 gig (preferably 4 gig or more) SD card.

You should gunzip the image (I’ve made that mistake!).
You must resize the partition after you flash it.
For instructions see: http://elinux.org/RPi_Easy_SD_Card_Setup#Manually_resizing_the_SD_card_on_Linux

Flashing the card is easy, too: http://elinux.org/RPi_Easy_SD_Card_Setup

Want to know more? Here’s where I documented my steps while creating this image.

Posted in Asterisk, raspberryPi

Yep, this would pwn.

Table-top-sized demo Strowger switch. Awwww yeah.

Posted in Asterisk

Raspberry Pi + Asterisk = werd.

RaspberryPi is in hand \m/ So what’s the first thing I’m going to do with it? Install Asterisk, naturally.

I first fiddled with the Fedora Remix for Raspberry Pi, but, I was finding that I was getting a bunch of errors. Namely, I was getting something like a “long write” warning/failure (which may be specific to my SD card, I don’t know). So I didn’t give up, I tried running the Fedora 17 nightly (with instructions) on my RasPi. Welp… Same thing. Seems as though the most favored distro, and the distro (currently) recommended by raspberrypi.org, is Debian.

So, I haven’t really been a Debian user. I might’ve installed it 8 years ago, but, that’s the most I ever did. So I’m also loading up with some notes about what was different for me as a mostly CentOS/RHEL/Fedora guy. And of course! My Asterisk build :)

Continue reading »

Posted in Asterisk, raspberryPi

Asterisk: Intermittent RTP issues on NAT’d clients?

Or any clients for that matter.

I spent what would’ve been hours of joy playing and playing with the fun toys of Asterisk, but, I found myself trouble shooting intermittent problems with clients behind a NAT. What threw me off was that one softphone (Bria) would send/receive RTP every, single, time. But others, not so much.

What was it?

Turned out that I had the range “10000-10200″ in my rtp.conf.

But in my firewall? I had “10100-10200″.

It was a typo in my rtp.conf. Dammnit. So hopefully if you are googling for intermittent RTP problems with natted clients, you find this and you double check it. Man was that frustrating!!!

Posted in Asterisk