Monday, April 21, 2008

Happy Fun Asterisk: Emulate Nortel Meridian LD95/CPND in Asterisk with SCCP

If you are asking yourself "WTF?" in reference to the title of this post, well...so am I. LOL!

I run an Asterisk phone system at home. It is great for totally destroying telemarketers! If you don't know what Asterisk is, familiarize yourself here: http://www.asterisk.org.

I run two Nortel Meridian Option 11c phone switches at work, each in a separate building about 1km apart. They are connected together via our LAN and a T-1 tie line, and both run Succession 3.0.

For those familiar with Nortel Meridian switches, there is a program load of "95" that handles what is called the CPND database. CPND stands for "Calling Party Name Display", and is a database of directory numbers (local to the switch) that have names attached to them. So you can assign extension 100 to Suzy Lu and 101 to Billy Rex, etc.

If you have Asterisk, you can do similar with its built-in database services if you are running Cisco phones with the SCCP firmware and are using chan_sccp on your Asterisk box. On my home network, I have three Cisco 7912s and two Cisco 7940s running SCCP 8.0.

In the Asterisk database, I created a table called CPND and loaded it with my extensions and their associated names, thus:

database put CPND 210 Office
database put CPND 220 Living Room
...etc...


Using the application SetCalledParty() in the chan_sccp driver, you can then add a piece to your internal dialing macro...you DO have an internal dialing macro, don't you?...to force the display of the called party on the phone you are calling FROM. The phone you are calling TO gets the CPND information from the channel driver anyhow.

Here is my internal dialing macro with the database lookup information...

[macro-dialinternal]
exten => s,1,NoOp(*** Internal Call to Ext ${MACRO_EXTEN} < ${CALLERID(all)})
exten => s,n,GotoIf($[ ${DB_EXISTS(cpnd/${MACRO_EXTEN})} ]?cpnd:nocpnd)
exten => s,n(cpnd),SetCalledParty("${DB(cpnd/${MACRO_EXTEN})}" <${MACRO_EXTEN}>)
exten => s,n,Goto(dial)
exten => s,n(nocpnd),SetCalledParty("Internal" <${MACRO_EXTEN}>)
exten => s,n,Goto(dial)
exten => s,n(dial),Dial(${ARG1}/${MACRO_EXTEN},30,Ttr)
exten => s,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
exten => s,n(unavail),Voicemail(100,g(3))
exten => s,n,Hangup()
exten => s,n(busy),Voicemail(100,g(3))
exten => s,n,Hangup()

You don't explicitly need to use this feature. In fact, I didn't know about the application until I watched Asterisk load while debugging a dialplan issue. You can use the app to change the display to say whatever you want...

SetCalledParty("Mom's House" <2345678901>)
SetCalledParty("Joe's Crib" <8005551212>)
SetCalledParty("Jerks" <3178169336>)

This is a pretty useful app, but is only part of the chan_sccp driver and will probably only work on phones that use SCCP compatible firmware. I have not tried it on a SIP device, but I don't think it will do anything.

I hope to have more Happy Fun Blog Entries soon...

Saturday, March 29, 2008

HDR Photography

I just recently treated myself to a new digital camera. I was tired of my little point-and-shoot since I'm used to an SLR. I hesitated to get a digital SLR because they were so expensive and I wanted one that would be compatible with all the Minolta lenses I have for my Maxxum film SLR bodies. The one I chose, and found a good deal on, is the Sony alpha 200.

Sony purchased the digital camera business from KonicaMinolta a few years back, and turned the Maxxum 7D digital SLR into the alpha 100. KonicaMinolta is now concentrating on computer imagery like laser printers.

I've been a big fan of Minolta cameras for a long time, thanks to my Great Uncle Jimmy. He always had Minolta SLR cameras...probably 15 to 20 different ones...over the years. My dream camera for years was the Maxxum 7000. This was the first modern autofocus electronic control camera ever. I did not, however, get one of these $1,000+ cameras until the late 90's...which I bought used for $170. I've run copious amounts of film through this camera for everything from vacation snaps to the occasional wedding.

Minolta was never really the tops in pro cameras for reasons that I could never figure out. Sure Nikon and Canon are great cameras, but I've just always preferred the Minoltas. I like Nikons, they are just really expensive and Canon's (the affordable ones) bodies and lenses have always seemed too lightweight and flimsy. My pal Chris swears by Canons and he's a burnt-out pro...which is why he's in the IT industry now.

Anyhow, HDR is an area that has interested me for a while now. HDR is "High Dynamic Range" photography. It is essentially processing a set of pictures to get to an image that emulates what the human eye would see naturally.

Fig. 1: The original image.

The picture above is an image of the front window of my living room. I took it when the sun was up high around midday. The window is bright and the room dark. The actual image that my eye saw was a relatively bright interior and a bright but distinct exterior...the lighting was "even". To the camera, the bright area overrides the CCD and overexposes the light areas and underexposes the dark areas. This is, unfortunately, unavoidable. Why? The human eye has a high dynamic range and can determine and adjust your perception to even out the lighting of the image. The camera has a limited dynamic range. Basically, the eye is sensitive to a wider range of light than the CCD in a digital camera (or even film). But with HDR, this can be corrected to some extent.

To create an HDR image, you have to have an area that has wide variation of light intensity. You can work with images that don't, but I've not had real good luck with it...but I'm not a pro.

HDR requires three or more images. One, is your normal image...mine was the one above in figure 1. This was taken 28mm, f4 at 1/80 sec. Then you need one or more overexposed images, and one or more underexposed images. The overexposed image will brighten up the dark areas of the original, and the underexposed ones will darken the lighter areas. For the image above I took three under at 1, 2 and 3 stops and three over at 1, 2 and 3 stops. How you do this, however, can be important. Adjust the shutter speed and NOT the aperture. Adjusting the aperture will affect the focal length of the image and can cause areas to sharpen or blur as compared to the original.

The other images I took were at a shutter speed of 1/40, 1/20 and 1/10th of a second for the overexposed images, and 1/160, 1/320 and 1/500th of a second for the underexposed.

To combine the images, I used GIMP 2.4 (an open-source image editor). I opened the original as the background, then the other six images as layers in the same image. To create the HDR image, the idea is to remove the unnecessary parts of the over and underexposed images and include them in the original. To do this, you need to create a mask of the image. GIMP has the facility to create a mask from the layer automatically, and I created a grayscale mask for each layer. On the overexposed image, the grayscale layer needs to be inverted. This is because the mask's dark areas will become transparent, leaving the wanted details of the overexposed image (lighter versions of the dark areas of the image above) intact to be layered upon the original. Likewise, a non-inverted grayscale image is used as a mask for the underexposed areas. This leaves the wanted details of the underexposed areas (the light areas of the original) to be layered on the original.

This all sounds very complicated and can be for the first few times you do it. A great tutorial on how to do HDR with the GIMP can be found here on Instructables.

In the end, I think it came out pretty well, considering that it was not a very good selection of a subject. But, here is the final result.

Fig. 2: The resulting HDR of the image in Figure 1.

You can now see the detail of the furniture and plants in the living room, as well as the detail of that which is outside the window. No adjustments were made to the images, other than the application of the layer masks. I did not use the image taken at 1/40th of a second since it made the interior much to dark. Using GIMP, you can turn layers on and off indiscriminately to see how the image will look.

This is something that I am sure I will play with more in the future.

Friday, March 14, 2008

Random Stuff...

Snow
The snow from my last post is almost completely gone. There are a few piles of filthy, black snow lying around in the shadows of buildings. However, with the warmer temps...it was 63° yesterday...they won't last long. It is supposed to be in the 50's today with rain, which will further beat down the remaining slush.

Time
What is the deal with this daylight savings crap? Now when I get up in the morning, it is dark! At 7 am! I don't know why we even bother changing the clocks. It seems to me that it would be better just to shift all our zones forward from standard time by 30 minutes and be done with it for good. You know, split the difference. But, who am I?

Car
On two of the coldest days last week I awoke to my car not able to start. You want to talk about being ticked off! I've never had a problem with my car ever, so I thought this quite unusual. I got new tires weekend before last and it figures that would be the first day this all started. They checked out the alternator and battery and said both were good, but that there could be a flaw in the battery that only showed up when cold. After the last time I had to jump it...by driving my mother's car around my house through my backyard to get to the front of my car...I went and bought a new battery. Haven't had any problems since...knock on wood.

Water Heater
OK, I spent some of my tax refund on a new water heater. The happiness was short lived as I discovered in my research that I have to have a special flue dedicated just to the tankless heater! I was intending to vent it up through the existing chimney with some of the special stainless-steel "type III" vent tubing, but you can't do that. The county would not approve a permit for a new heater installed in that manner. So much for lower gas bills.

I sent it back and should get the refund soon. Then I will go out and buy a regular gas water heater. They are quite a bit more efficient these days than my existing 25 year old heater, so the gas bills should still be lower. And I intend on getting a fitted insulating blanket to make it even more energy efficient. I tell you, it is always something!

Cancer Update
I am holding steady around 200 lbs., which is very nice. I actually had to move my seat in my car up a little bit because I was so far away from the wheel. I have long legs anyhow, so I can't be too close to begin with, but I feel so small in such a large car. That's OK by me!

I am now on passive monitoring, which means I will have a CAT scan and checkups every three months for about a year. Then I will be looked at every six months for about five years. And I will have a PET scan about once every year, too. So, things are looking up!

Films
I don't usually recommend films to people because I have such an eclectic taste, but my friend Chris turned me on to one lately that is one of the best I've ever seen. It is called Hot Fuzz. I initially thought it was a porno, but it isn't. It is about a British cop in London that is so good at his job his colleagues decide to have rid of him an promote him to sergeant and ship him out into the countryside. It gets better from there, with lots of twists and turns, conspiracies and a good bit of comedy. It is pretty gory on occasion, but I have to say it is one of the best cop movies of all time. You must see it!

British entertainment is so much better than our American crap.

Saturday, March 8, 2008

Snowstorm 2008

It's snowing.
Fig. 1: My house.

It has been snowing since about 12 noon on Friday, 7 March. The weather people were calling for about 10 inches of snow to fall.

Fig. 2: From my porch, looking north (church across the street)

Fig. 3: Looking east up my street.

The snow has been coming down so quickly that the city has not been able to keep up with the plowing. My street is a major thoroughfare and usually gets priority attention, since there is a fire station to the east. The car in the picture was going about 10 mph, which is wise.

Fig. 4: Looking west, from my porch.

Fig. 5: The backyard.

For comparison sake, the bottom edge of the satellite dish you see in figure 5 is exactly 6' off the ground.

Fig. 6: Snowdrift directly in front of my porch.

There are steps in figure 6. Somewhere.

Fig. 7: Another view of the drift.

Fig. 8: Another drift actually on the porch!

Fig. 9: The drift in front of the porch being measured.

The drift in front of my porch is 16.5" deep.

Fig. 10: Me, standing nearly calf-deep in snow on my driveway.

And it is still snowing! To add insult to injury, the wind is blowing quite mightily, thus causing all the drifts. But, as you can see from mine and other cars, the snow is quite powdery and is not really sticking that well, so cleanup should be pretty easy.

Father has already been out with his snowblower and cleaned off their drive and walkway. He said he would do mine after it stopped snowing. He and mother are on their way to clean off my great aunt's driveway right now.

As for me, I'm hibernating and watching TV!

Update
It finally stopped snowing today, Saturday, 8 March, at 4:30 pm.

Wednesday, March 5, 2008

Phantom Pager Syndrome

I have a syndrome. I call it "Phantom Pager Syndrome". This is going to sound weird, but stay with me.

You see, I have had a pager, cell phone or both...sometimes even more than one each...since I have started working. That's about 17 years now.

I wear my pagers/cell phones on my belt, on the right side, just above my right leg. For the last few years, I have felt strange vibrations in this area...like a pager set on vibrate. I feel it all the time. Even now as I type this, it seems like someone is trying desperately to get hold of me.

I generally set any communications devices I have to ring and vibrate, because I can't always hear the ringing due to ambient noise or the speaker location versus the case muting the sound. When I feel a distinct vibration, I check and listen for the ring. I leave the ring turned all the way up because I don't hear very well anyhow.

Well, since I have the phantom vibrations, I'm checking my phone ALL THE TIME!

I have the most annoying ring that I could imagine. It is a ring that I like because it is loud and I keep the ringer volume all the way up. That way I have an incentive to answer it...to shut it up. It is called "Vintage Phone" and sounds like an old bell phone ringer. It is great! This way when my phone rings I can always tell it is mine. Plus, it is a unique ringing sound that is quite well done that I bought from a company that specializes in ambient sound effects called SoundRangers. I thought a unique solution such as this would a) annoy people, b) ensure that I know my phone is ringing and c) not be stupid like some other ringers I've heard like whatever the current popular top 40 hip-hop song is.

That is not to say that I don't have other ringers, for example...
- For my friend Chris, I have the theme to "Benny Hill", since he is always horny.
- For my boss, I have the "Imperial March" from Star Wars, since he's like Lord Vader sometimes.
- For my friend KL, I have the theme to "Dynasty" (an '80s prime-time soap) since everything she gets involved with has some kind of extreme drama.
- And for my co-worker APK from Sri Lanka I have the "Monkey" sound from the classic MacOS...it's been around since System 6. (Not very PC, I know!)

But these "Phantom Pages" are getting quite annoying. I started having problems back when I was working for the contract computer service company. At that time I was carrying two pagers and two cell phones! Thankfully, I have only one cell phone now...my own. If I didn't have to have it, I wouldn't!

In another related issue is the Nextel walkie-talkie feature. Not only is it annoying to see and hear people using this feature rather than holding a proper phone conversation (since we can now hear BOTH sides of the conversation) the chirp that it makes really bothers me. This is because I had a Nextel when I worked for the contract service company...every time that thing would chirp, I would cringe. It got so bad that at one point I thought I was going to go completely mad. All day long it would chirp with my boss or co-workers wanting something. Even to this day, hearing the Nextel chirp makes me shudder.

I suppose this is enough rambling for today...

Monday, March 3, 2008

Springtime?

It is, right at this very second, 64° in Dayton. It is a beautiful sunny day. I didn't think springtime would ever come. For the first time this year I did not have to warm up my car before leaving for work...I just got in and went.

Alas, this is a cruel joke by good ol' mother nature...it is about 15 minutes away from pouring down rain. Then it is supposed to turn cold and snow on Tuesday.

Typical Ohio weather...hang around a second, it'll change.

Wednesday, February 27, 2008

Ask and ye shall receive...

I got an invite today in the mail from the HR department at work. It is an RSVP to attend the annual "Service Awards" banquet. For us office workers, it means that we have been employed by the RTA for a number of years evenly divisible by five.

This is my fifth year of working at the RTA. I have to say that it is the best job I have ever had. The strangest thing is that I kinda asked for it.

I used to work downtown for a law firm as their IT manager. I handled all the day to day maintenance of the servers, computers, phone system and the like. I even did more mundane things like court running, serving papers, refilling the copier, processing the mail and all that jazz.

While I worked there, I noticed a lot of activity at a building across the street from the building I worked in. Someone had bought the old, decrepit building and was doing a complete refurb on it. I didn't know who was doing it, but they were doing a great job of it.

I went to lunch one day with an attorney friend and on the way back to the office, we passed by the building on Third Street. We had to stop at a traffic light and I was able to get a pretty good look into the second floor window. A second floor room with lots of server cabinets.

I immediately thought to myself, "Boy, I'd like to work in a place like that. Lots of infrastructure to take care of."

Within a matter of weeks, I was contacted by a guy from a company who was desperate to get someone that knew Windows networking to maintain a couple of companies. His current guy left to pursue other interests. I was desperate to get out from under 'Frank'*. So, we hooked up, I got hired and went to work with the clients that he was desperate to service.

One of the clients was a company south of town that was owned by a Japanese conglomerate. They made glue for the auto industry and there were a lot of Japanese personnel there. This is where I picked up a few choice naughty Japanese words and first came into contact with the Japanese version of Windows.

The second company was the RTA.

Strangely enough, the RTA is the company that bought the downtown building that was being refurbished and the company that had the server cabinets on the second floor!

I have actually worked for the RTA for six years: one year as a part-time contractor working for the now defunct company I left the law firm for and five as a real, live employee.

After the company went under, my current boss immediately hired me in to be a permanent employee in the position I was working in anyhow.

So, I guess I asked for it.

My boss says that he only expects five years of work out of a person. Well, I'm not ready to leave. Sure, I have looked around to see what is out there and what the prevailing wages are and compare that to the pittance I make now. But, I have it pretty good where I am. We have great insurance, a great retirement plan, the salary isn't bad and me and Chris get away with absolute murder. Plus, my boss is pretty great, too. Ah, who am I kidding...I'm too lazy to look for another job!

I will never forget the first time I met my current boss those six years ago. He had planned a little verbal quiz to test my skills. He is a skeptic, which is great really, and doesn't necessarily trust everything any salesman says to him. In the case of my former boss from the now defunct company, this was wise.

He asked me if I knew what a RAID was.

RAID stands for Redundant Array of Inexpensive Disks. A way of protecting data on a set of hard drives by using more than one, either striping the data across them or mirroring.

After I gave him the five-minute explanation, he had no more questions for me. :) I guess he must have been satisfied with my answer.

I'm just glad to be out from under 'Frank'*.

* When you think of 'Frank', envision Bill Lumbergh from Office Space. Then you will understand.