Praise to ZSH

Jochen Maes talks about zsh today. (I found that blog via planet.gentoo.org)

I wholeheartly agree with Jochen here.

Finally someone else writing good stuff about zsh.

I’m using this shell since 2000 where I did my first serious steps with Unix. This mainly has three reasons:

One is the “User Friendly Users Guide” available here. Besides this being an excellent introduction to zsh it is one to unix shells in general. When you’re learning unix shells using this guide, you’ll somewhat automatically stay with zsh.

The other reason is the great flexibility and expandibility. Zsh had a programmable autocomplete-feature long before bash had (or at least long before it was generally known) and even better: It came with some autocompletition functions already enabled for some tools (like tar or even scp). Programmable autocompletition allows you create special autocompletitions depending on the context you are hitting tab.

So let’s say if you are beginning to type

$ scp gnegg.dat pilif@server.example.com:~/gn

and then hit tab, zsh will actually autocomplete on the remote server(!) and create

$ scp gnegg.dat pilif@server.example.com:~/gnegg

for you (assuming that directory exists)

The same goes for tar (even with .gz or .bz2 compressed ones). Or cvs or svn

While gentoo provides bash-completition-config which does the same for bash, zsh was there first. And it provides many senseful completitions.

The third reason for me going with zsh is the syntax of the shell-scripts which can be configured to be much more intuitive to a C-programmer than the default-syntax, while still being more like ksh/bash than (t)csh.

So for me, switching from bash to zsh was a no-brainer back in 2000. And as with the text-editors: Once you use a certain tool, you will not change it afterwards.

I strongly recommend you to take a look at zsh too.

Asterisk – it’s getting real

Last week I talked about me and Christoph installing Asterisk on my thinkpad to do a little VoIP-Experiment.

While we were able to create a should-be-working configuration, actually calling to the outside PSTN network did not work. Read the details in my other article.

Last saturday, we fixed that.

There seems to be a problem somehwere between the AVM CAPI Driver and the CAPI layer of the 2.6.11 kernel. After we downgraded to 2.6.10, the problem solved itself without we doing anything more.

So… this was getting interesting…

The first thing I did was to annoy my wonderful girlfriend:


exten => s,1,Wait,1 ; Wait a second, just for fun
exten => s,2,Answer
exten => s,3,MP3Player(/home/pilif/mp3/3.mp3)

(included into or used as the default context)

Where 3.mp3 is that endlessly stupid song “Tell me” (or whatever it’s called) by britney spears (this is an insider-joke – both of us just hate that song). Then I told her to call that number…

While this example is completely pointless, it was fun to watch my girlfriend connecting and listening to the song (which soon ended in a disconnection log entry)


exten => s,1,Wait,1
exten => s,2,Dial(SIP/12345,60,tr)
exten => s,3,Congestion

This makes much more sense and directs all incoming calls to the SIP-Phone 12345 as configured in sip.conf. After 60 seconds, it sends back a congestion signal. The first entry would not be necessary, but I hate it when I call somewhere and the phone is answered just at the first ring. So in my PBX, the answering party will wait one second before directing to the sip-phone.

In musiconhold.conf I’ve configured madplay as my MP3-Player for music on hold:


default => custom:/home/pilif/mp3/,/usr/bin/madplay --mono -R 8000 --output=raw:-

madplay is much better than mpg123 used per default as it accepts VBR encoded input and bitrates > 128 kbit which is what nearly all of my MP3’s are encoded with.

In zapata.conf enable music on hold with musiconhold=default in [channels]

The next thing was an optimization of the SIP-Phone used…

X-Lite is nice, but in the end it’s just a demo for other products by the same vendor. Call transferring is not possible for example, which is what we wanted to try next.

The best soft phone we’ve seen so far is SJPhone. A configuration guide is here

But the real clou is the Zyxel 2000W phone that’s currently on my desk: The phone has a WLAN interface (unfortunately no WPA support) and can perfectly well speak with asterisk.

The phone has some problems though: it’s slow, it has no support for call transferring, nor holding, neraly every configuration change causes it to reboot,… In the end I really hope Zyxel will further improve the firmware, which is what they seem to be doing – the current release is from the end of february, so quite current.

The next thing will be trying to install a webbased frontend to asterisk and creating a real dialplan with voice mail. Then, our experiment will be over and we’ll see how it can be put into practical use (like finally getting rid of the old, proprietary PBX from alcatel of our landlords)

Fun with VoIP

When I read for then n-th time about Asterisk, an Open Source PBX solution, I deceided to team up with Christoph and tame the beast.

I have actually two problems with asterisk as it stands now:

  1. There’s not much really useful newbie-documentation or tutorials. There are some sample configurations, but they are not very useful because…
  2. the tool has a incredibly intransparent and difficult to understand syntax for it’s main configuration file (extension.conf). I’t just like it’s with sendmail: Many extremely low-level things to care of for getting complex high-level results.

I thought, that teamed up with Christoph, we’ll more likely to see some results.

The first thing was defining the parameters of our experiment. Here’s what we wanted to do:

  • Act as a SIP-Proxy, so two softphones (we did not want to buy too much actual hardware yet) could talk to each other.
  • Provide a gateway to the ISDN-Network, so both SIP-Phones can dial out to the rest of the world.
  • The same gateway should be able to receive incoming calls and direct them to one of the Phones (just one for now).

In the next session, we want more advanced features, like voicemail and waiting music. A third session should provide us with a webbased frontend (I know there are some). But for now, we wanted to concentrate on the basics.

The next step was to get the required hardware. I already have Gentoo running on my Thinkpad, so that was a good base. Furthermore, we needed any ISDN-Solution being supported by Asterisk. As we had a plain old BRI interface and a very limited budget (it was just an experiment after all), we went with the Fritz Card USB by AVM which has Linux CAPI drivers, albeit only binary ones (we could also have used the PCMCIA-version, but this is three times as expensive as the USB one).

Said piece of hardware proved to be a real pearl: It’s very compact, does not need a power adaptor and was very easily installed under Linux. I would not be using this for a real-world solution (which most likely requires PRI support and absolutely would require open sourced drivers), but for our test, this was very, very nice.

Installing the needed software is where gentoo really shined as everything needed was already in the distribution: After hooking up all the stuff, we emerged net-dialup/fritzcapi, net-misc/asterisk and net-misc/asterisk-chan_capi which suked in some more dependencies.

The next step is to reconfigure the kernel for the CAPI-stuff to work. Just include everything you find under “Device Drivers / ISDN Support / CAPI” – even the one option marked as Experimental (as the CAPIFS is needed and only available when enabling “CAPI2.0 Middleware support”)

Then, we made sure that CAPI (a common ISDN access API) was running by issuing capiinit start.

Then we went on to asterisk.

The fist thing, you have to do is to set up the phones you’re using. As we worked with SIP-Phones, we used sip.conf:

[general]
port = 5060
bindaddr = 0.0.0.0
tos = none
realm = sen.work
srvlookup = yes

[12345]
context = theflintstones
dtmfmode = rfc2833
disallow = all
allow = gsm
callerid = "Fred Flintstone" <12345>
secret = blah
auth = md5
host = dynamic
reinvite = no
canreinvite = no
nat = no
qualify = 1000
type = friend

[12346]
accountcode = 12346
dmtfmode = rfc2833
host = dynamic
auth = md5
secret = blah
canreinvite = no
context = theflintstones
qualify = 2000
type = friend
disallow = all
allow = gsm

This worked with our two test-phones running X-Lite

Interesting are the following settings:

realm The realm. I used our internal domain here. The default is asterisk. Your VoIP-Address will be identifier@[realm].
accountcode This is the username you’re going to use on the phone
context The context will be used when we create the dial plan in the feared extension.conf

Then, we configured CAPI in capi.conf

[general]
nationalprefix=0
internationalprefix=00
rxgain=0.8
txgain=0.8

[interfaces]
msn=44260XXXX
incomingmsn=*
controller=1
softdtmf=1
accountcode=
context=demo
devices=2

Those settings are said to work in Switzerland. Interesting is the setting for msn. This is where you enter the MSNs (phone numbers) assigned to your NT. I somewhat X-ed it out. Just don’t use any leading zeroes in most countries. You can enter up to five using commas as separator.

The next thing is to update modules.conf. In the [modules]-Section, add load => chan_capi.so, in the [global]-section, add chan_capi.so=yes.

Without those entries, asterisk will complain about unresolved symbols when loading the CAPI modules and will finally terminate with a “broken pipe”-Error. Thrust us. We tried. ;-)

The best thing now is that you can already test your setup so far. Launch asterisk with asterisk -vvvvvc (each v adds a bit of verbosity, while -c tells it not to detach from the console). If it works well, you’ll end up at a console. If not, make sure, that capiinit did not report any error and that you’ve really added those lines to module.conf.

Now for the fun of it, call one of your MSNs with any phone.

Asterisk should answer and provide you with a demo-menu

The next step is configuring extensions.conf. This is somewhat complex and I will go into more detail, as soon as I’ve figured out, what’s wrong with our test-configuration. We’ve added this to the end:

[ch-fest-netz]
exten => _0[1-9].,1,Dial(CAPI/44260XXXX:b${EXTEN},30)
exten => _0[1-9].,2,Hangup

[theflintstones]
include => ch-fest-netz

Just look that you enter one of the MSNs you have configured in capi.conf.

Now what this configuration should do is to allow those SIP-phones (recognize the “context” we used in sip.conf?) to dial out via CAPI.

You best learn how to configure this beast by calling the demo-voicebox and then comparing the log output of Asterisk with the entries in extension.conf. Basically, exten => defines a dial plan to execute. Then comes the pattern of numbers dialed to recognize. After that comes a (BASIC-like) sequence-number, followed by the action to execute.

The format of the number-pattern is explained in one of the comments in extension.conf

Now, this configuration does not work for us: When I dial on the SIP-Phone, Asterisk notices this, actually connects the ISDN-line (the target phone actually rings), but does not seem to notice when the target phone is answered.

If I answer the phone, it’s just silence in the line. The SIP-phone is still in the “trying to connect”-state.

This stays this way until I cancel the dial attempt in the SIP-phone. After that, asterisk prints more log entries – one of them the notice that the connection was successfully established.

A question in the malinglist was promptly answered: My configuration is correct, but maybe I’m running into a bug of Kernel 2.6.11. I was told to downgrade to 2.6.10, which is what I’m going to do next.

After this, I will extend the dial plan so I can call the internal SIP-phones both from another softphone or from a real phone over the ISDN

It’s hacky, it’s just somewhat working, but it’s a lot of fun!

I’ll keep you updated.

World Of Warcraft – A little Newbie-Guide

I just had three of the most pleasant hours I’ve ever had with gaming. As you can imagine, the game was World of Warcraft (I hereby promise not to post any more WoW-related stuff in the near future, but bear with me one last time ;-)

I’m playing as a human mage and I’ve now reached level 17 (looking forward to 18 to get more spells)

For some time, I had problems getting along, but it’s really better now, so I though I maybe give you some advice if you too play as a human mage:

  • When you’re first sent to westfall, you may be completely under-leveled. It began being fun for me about at level 15 or so, but when you get there, you’re usually at 9 to 11. You can do two things to remedy that:
    • Join groups (use the /4 chat-command). As a group you’re so much more efficient
    • Use the underground railroad (it’s in the dwarven destrict) in Stormwind to go to the dwarven capital city Ironforge and from there take some quests outside and in Loch Modan (east of the region around Ironforge). Those are easy to do for you and the scenery is much nicer than in Westfall
  • Never hesitate to talk to people. So far, I never had problems getting along with other players. Don’t be afraid and talk to them. You have so much better chance of accomplishing something if you work in groups.
  • Try to meet with people you’ve already met. Once you know them better, it becomes even more fun
  • As a mage, never… I repeat… never try to attack a group of enemies. Wait till they separate. Or Sheep them and attack just one.

I really think, the balance of difficulty is way off in westfall and maybe, the guys at Blizzard fix that in the future. Until then, you will have much fun in the dwarfen lands. Return to Westfall after reaching level 15 or so and do the easier quests first. Talk to people. You’ll see: It will get fun. Much fun..

World Of Warcraft Patch

Today, when I wanted to login with my somewhat tweaked installation of WoW, I was greeted with an error message telling me something about not being able to verify my version.

This was fixed by temporarily using the US login-servers so that the new patch could be installed.

During installation of said patch I found this note here:

– Reduced the respawn rate of the troggs on the islands in Loch Modan.

This is nice – just yesterday I’ve had some serious problems with those troggs there. Too bad, the patch was released only today when I don’t have to go back there.

QTek S100

I have been talking about mobile phones quite a lot on this blog.

I’ve always been on the lookout for the optimal phone for my needs, which I finally thought to have found in the combination of the SonyEricsson K700i and the iPAQ hx4700 by HP. I used the phone (good usability, small size) for communication and the iPAQ for emailing and the PIM applications. The combination beared the risk of not having the PIM-Data ready when I needed it, but all other smartphone offerings out there where either too heavy, too user-unfriendly, too large or just too limited in their feature-set.

However, last week, the joystick of my K700 completely stopped working (I’ve never met even one person not having a broken joystick after about a year or so), so I needed a replacement.

SonyEricsson does not have any new devices to offer (the next one being the K750i, released in Q2 – about june or july, I suppose), so I was on the lookout to something different.

Then I found the QTek S100 quite by accident. You may know the device produced by HTC where it’s called “Magician” under the name JAM by i-Mate (or as SPV if you’re a customer of Orange, or even MDA compact at T-Online – it’s always the same device).

Size-wise it’s a bit thinner than the K700, has the same height, but it’s a bit wider. It runs Windows Mobile 2003 Phone Edition, so it can naturally be natively integrated in our Exchange-Environement. All known PocketPC-Software runs on it and it’s even powerful enough for watching videos (only at 320×240 pixels – the device has no VGA-Screen). It has a SD-slot which is SDIO capable, so I could use that for WLAN which the device unfortunately does not have built-in.

It comes with Bluetooth-Support which I’ve already used both for dialing into the internet and synchronizing with the PC.

I’m told that the MS-Stack is a bit limited, but it fits my needs.

The sound quality isn’t as good as with the K700, but far better than what I feared it’d be.

Usability-wise, this is the first Smartphone that really works for me. I’m as fast with the QTek as I’m with my K700. As I’m already used to the letter-recognition of the PocketPC, I’m quite fast in writing SMS too, though the device does have a special input-panel with T9 support.

What surprises me the most (which actually led me to write this article) is the battery lifetime: It’s now 5 days since I last charged it and it’s still 45% full. This is already longer than what my K700 did when it was completely new. I did not think I’d last longer than 2 days at most….

Additionally, as it’s a real PocketPC, you will have the device connected to your PC when you are in your office. So it will automatically be charged during the day, so battery lifetime would not even be that an issue.

For me, the QTek is a great device. Nearly the optimal phone (which I still have not found). The only things I’m missing are (in no particular order):

  • A standard 3mm headphone connector. The S100 has a smaller 2.5mm connector which doesn’t allow me to plug my headphones and use the phone as an MP3 player. I know that adaptors exist, but it would have been nice if it thad the right connector in the first place.
  • A VGA screen. This is unrealistic for this small screen size, but whatever…
  • WLAN-Support. Public WLANs are getting more and more common here. It would have been nice to connect to those.
  • A real docking station. Currently they provide only a USB-cable. A real docking-station would have been a nice thing to have
  • A real keypad. While the soft-keyboard is nice, an exdendable real hardware-keypad has the advantage of being usable even when not looking at the device.

That’s all. Small things. Not nearly as annoying as the problems I found in the P800.

So if you ask me what phone you should buy: For now it’s clearly one of those HTC Magician based phones as it combines the power of the smartphone and the known user interface of the PocketPC with the small size and battery power of a regular cellphone.

Hacking Hiltl

The Hiltl is an excellent vegetarian restaurant in the middle of Zürich. I eat there quite often because the food’s great, the waitors are friendly and they always have space for you despite being constantly full of guests (others seem to think the same).

What’s interesting from a technical point of view is their ordering system: All waiters are equipped with a Windows CE device by Symbol and use WLAN to communicate with a central server (two actually, but see later) to process your order, send it to the citchen and finally print out the receipt for you.

What’s even more impressive is the seemingly perfect user interface: The waitors are actually faster with those things than they’d ever be using the old-fashioned paper-way. Even if you have special whishes, they can enter them in an efficient way.

The only time papers are involved is when they print your receipt. The system automatically selects the nearest printer.

This is one of the secrets behind the incredible efficiency of the Hiltl allowing for an incredible throughput of guests while still giving them all the time they need to eat and chat. Actually, a table is ready for the next guest only about one minute after the previous guests have left.

The restaurant is devided into two floors. Both have a master-waitor which has control over all the tables. They communicate via radio.

So you see: This is the restaurant for a geek to visit: Good food and good tech in one.

Now, the Zyxel access point they had mounted to the roof of the restaurant somewhat itched me. I mean: It’s WLAN after all. And I know the devices they are using – I wrote some lines for them too. So, maybe I can get some insight, I thought.

Armed with a notebook and the right software, me and Christoph took our meal in the Hiltl today.

The bad thing first: They don’t even use WEP for their network. They just created and empty SSID but don’t even hide it. So we did not have to use a WEP cracking equipment.

The devices communicate via SOAP over HTTP on a non-standard port. Additionally, the server often pings the known clients to check if they are still there. Then there’s a misconfigured router sending out IPv6 packets which are not used in any way. Oh and a Win9x-machine is there too, announcing itself as a network browser.

There are two servers: One for ordering, the other for printig.

Unfortunately, the SOAP messages (especially those to the ordering-system) contain much binary data, so there’s not much one can do there without isolating one device and doing some known steps on it.

Unfortunately, our equipement was not running until after our order was taken, so I don’t even have a reference point.

The printing though, uses some clear text XML-parameters. I think, I could be able to print some funny messages to all of those printers.

As I see it, no authentication whatsoever takes place – besides a hard-coded registration of the devices IP-adresses. ARP-spoofing could help about that though.

Now… what do I want to say with this? I’m certainly not going to attack them as I really, really like their food and want to return there often for my nutritial needs. Then, it’s a matter of honor: They are so progressive and efficient that I just can’t punish them for their (quite obvious) security problem.

Still, for educational purposes, this little experiment was very useful. Maybe, another day, I will even try to decode those binary parameters – just to know how it would work, not to hack me a cheaper meal or so ;-)

The last thing to do for me on this posting is one thing: I ask you kindly to do the same thing as I do: Don’t crack the network there, but go there to eat. It’s really worth it.

World of Warcraft

For the last three years or so, I was constantly thinking about those online RPGs, but the high amount of micro-management you had to do and the steep learning-curve, the newbie-killers and all those other factors led me to ask myself: “Why spending money for that kind of dubious entertainment?”

Then I’ve read many good things about Blizzards World of Warcraft: It was said to have a nice learning curve, few micro-management and to be entertainment-centered – now we where talking…

So I went ahead and bought it last tuesday.

While there were some problems at first when I tried to create my character (Blizzard was quite overrun by the many people trying it out here in Europe), they were solved the same day and since then I had no problems with long waiting lists or disconnects. So from a technical point of view, it’s very satisfying.

And then there’s the gameplay of course.

This is very well done: There are many small things where the designers have tried to minimize the problems other MMORPG seem to have: There’s no senseless doing stupid jobs with your alter-ego just to earn money (you earn money by beating quests which are somewhat diablo-like). There’s this concept of getting double experience points when you log in after a larger pause. Then, if you don’t want to play in a designated player-vs-player-area, it’s immensely difficult to be slaughtered by another player – if you get killed by another player, it’s entirely your own fault. And besides: Other players cannot steal your inventory.

While the game provides an incredible amount of options how to progress your character, it introduces them nice and slowly. I’m still quite the newbie (playing about 2 hours per day I’m now at level 9) and I never felt overwhelmed. Very nice.

The most interesting experience I’ve had so far was yesterday when I was having problems concluding a certain quest alone: The boar I had to kill was just too strong for me.

So I did the logical thing: I went to the nearest tavern and asked around if there was someone willing to kill that beast with me. I soon found someone and we succeeded. This is what I expect from a MMORPG – not forging horseshoes and selling them for much too less money becuase of ebay-caused inflation – each horseshoe taking about 1000 senseless clicks to build.

So WoW is definitely getting my $11 monthly after my one month trial runs out.

Oh. There’s one thing though: Here in Switzerlad, you just get the german version of the game. This is very unfortunate for me as I prefer playing in english realms. Now its quite difficult to talk about something with an other player if I just have my own translation of the german name instead of what’s on the screen of the other players.

This is partly my own fault – I could play on a german realm, but partly blizzards too – here in Switzerland, many of us are used to read and understand english – all the movies are shown in the original language (mostly english) with subtitles for example. I think, that many of us would really prefer to have an english version of the game.

I for myself will probably do as I always do: Use the CD-key of the german original with an english copy I get via other channels. This is not particulary legal, but not that illegal too, I think.

Please, Blizzard, if you hear me: Provide us swiss with an english version of your games in the future.

WoW: Language Hacking

As I explained in my previous posting, I very much like to play World of Warcraft in the english version.

Now I got my hands on the US-version and installed it (after uninstalling the german version).

The problem came after patching to the current version: My account was not recognized anymore – no wonder: The game was connecting to the US servers while my account is on the european ones.

A bit searching for worldofwarcraft.com in the games directory revealed the string set realmlist [something] in base.mpq

As always, google was my friend and showed me the solution: Add

SET realmlist "eu1.wow.battle.net"

to the file config.wtf in the directory WTF of your WoW installation.

This lets you login to the european servers where your account is recognized.

Works well (at least until the next patch is released ;-)

Update: if you have a file called realmlist.wtf in the main installation directory, change that one, not the config.wtf as it will get overwritten on every launch. And additionally, you should set the server to eu.logon.worldofwarcraft.com instead – the older one was for the beta.

Check for update

I’ve seen many pieces of different software.

Many of them provide the user with a way to go online and check for new versions of the program.

Nearly all of them have the corresponding menu entry in the “Help”-Menu.

Why is that so? Checking for updates does not provide you with help. Maybe, just maybe it can fix a problem you are having – but it’s nowehre near providing help.

If I wrote software, it would have this option in the Tools menu or – if the application had none – in the File-Menu, though it’s misplaced even there. As is “quit” for example…