Monday, December 1, 2008

Fun with Peregrine/HP ServiceCenter and USB7 LCD Display

ITIL isn't really fun until you learn the difference between calls, incidents and problems. I have a queue of incidents for which I am responsible, but I can't count on reliable notifications in the form of emails, and the client times me out after about 15 minutes, so I can't see if I have a new incident without logging in again.

I bought the super-cool USB7 7-segment LED kit and soldered it together in about an hour. It's a six-digit display, like you would see on clocks or a calculator. The included driver makes it appear to Windows (or Mac, or Linux) as a serial port. Thus, you write a line to the serial port and it appears on the LCD display. Simple enough.

The trick is getting useful information to the LCD display. How do I get the number of incidents in my queue to the USB7? (A better question might be, how am I supposed to know when there's a new ticket in my queue at all?)

We use Windows at work, so I needed to write this in some kind of dotNet mumbo-jumbo, which is slightly more complicated than PHP, Java ,or VB6, because you need to do things the dotNet way. This uses dotNet 2.0 or 3/3.5 and works in Visual Studio 2005 and Visual Studio 2008 on x86 and x64. It's a simple console application that runs a query and writes it to the com port. Everything is hard coded. Feel free to use it and change it as you wish. Now I need a larger LCD display. SQL query for ServiceCenter 6.1 tables in bold. (the thing with ServiceCenter, at least v6.1, is that incidents are in the probsummary tables. Calls are in the incidents tables.)


'Simple VB.Net 2008/2005 Code to write a single line to the USB7
'available from
'Tested on Win2k3 x86 amd x64 using avrcdc.inf
'11.20.2008 Larry
'release 1.1
'.Net sure is different than good old VB6. Everything's an object.

Imports System
Imports System.Text
Imports System.IO.Ports
Imports System.Data.SqlClient

Module USB7
Dim intTixCount As Int32 = 0
Sub Main()
'this is a standard ServiceCenter 6.1 query to list all the incidents in queue "My Queue"
Dim sql As String = "select count(dbo.probsummarym1.assignment)from dbo.probsummarym1 inner join dbo.probsummarym2 on dbo.probsummarym1.number = dbo.probsummarym2.number and dbo.probsummarym2.close_time is null where probsummarym1.assignment = 'My Queue';"
Using conn As New SqlConnection("Data Source=mydbserver;Initial Catalog=mydatabase;Integrated Security=True")
'you could hard-code a password in that string, but you know better.
Dim cmd As New SqlCommand(sql, conn)
Try
conn.Open()
intTixCount = Convert.ToInt32(cmd.ExecuteScalar())
'ExecuteScalar returns an int -- a regular cmd.execute would result in a recordset
'which would be a problem.
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
conn.Close()
'keep your DBAs happy and close those connections

End Using

Using com1 As IO.Ports.SerialPort = _
My.Computer.Ports.OpenSerialPort("COM2", 9600)

com1.WriteLine(intTixCount)

com1.Close()
'it really is that simple, because we're not reading anything back from the USB7

End Using
End Sub

End Module




Free 411 Service with Asterisk

Google has launched a free 411-style information service. It's not the first free one, by any means, but since it's Google's, I'll have higher expectations about its usability. There's another one available -- that's even older than Google's service. It's too bad you have to pay for e911 service, because doing the same won't send your name and address to your local PSAP.

The catch is, when you're dialing for information, you're at the phone, not the computer, and you may not have memorized the number. (1-800-GOOG-411.) If you're running Asterisk, you can easily reprogram 411 to go to the free 411 service of your choice. Just add the following lines to your extensions_custom.conf in /etc/asterisk:

[from-internal-custom]
exten => 411,1,Answer
exten => 411,2,Dial(SIP/mytrunkname/18004664411|300|)
exten => 411,4,Hangup

Friday, November 14, 2008

Comments are re-enabled after I identify the spammers' IP addresses

I had 41,000 spam comments in my photo gallery. I had thousands of unpublished spams on my blog here. Spam comments were showing up as valid keywords attracting traffic on Google searches. So a couple of weeks ago, I shut down commenting in MovableType. It turns out that one other problem, mt.cgi consuming 2 G of RAM and all my processor time, was a separate issue. ImageMagick is NOT optional in MT 4.2. I had installed it, but MT couldn't find it. Thus an infinite loop consumed all my resources through our favorite cgi-bin, mt.cgi. Fixed that, but what about comments?

I didn't think Gallery was popular enough to be targeted by automated scripts. I thought CAPTCHAs could stop them. I was quite wrong. I upgrade Gallery to 2.3 and got me a WordPress API key for Akismet, which I'm now using in MT and Gallery.

I also looked at my logs, and found that 99% of my Gallery spam comments came from a limited set of IPs. Since I started blocking them at the firewall, I've seen 13,000 attempted hits from them. Here they are. If you're running Gallery, ban them now.

91.121.108.25

91.121.110.118

91.121.111.27

91.121.111.28

91.121.120.173

91.121.143.168

91.121.169.207

91.121.179.28

91.121.71.155

91.121.81.48.3

91.121.81.48.5

91.121.84.162


Monday, November 10, 2008

Comcast Strikes Back

One week after my port order for my Comcast phone number transferred to Vitelity, Comcast shut down my Internet service. My Comcast voice port line had been dead for a week, and I got home to a dead Internet connection. My Cable modem could pick up an IP but Comcast wouldn't allow it to connect.

I called Comcast customer service and the generally polite customer service rep told me that a port order terminated phone service and Internet service, because it's not possible to activate a Cable modem with voice capabilities with the phone service off. Which is exactly what I had for a week. Customer service rep expressed that Comcast didn't like it when people ported "Comcast's" telephone numbers. Given that Comcast already sued Verizon over the porting telephone numbers difficulty, it's funny.

My only option was to get a new cable modem with no voice ports. After I hooked up the new modem, one call to an also-polite customer service rep got me connected again. I got a new IP, so a quick edit to sip_custom.conf got me connected to Vitelity again.

It was a positive experience, because I feel much freer to switch to whatever ISP I can find that's cheaper. Thus I'm looking at FIOS or DirecTV with a cheap landline for DSL. For those two shows I like to watch on Showtime and HBO, it costs us about $100 a month. Ouch.

What will next month's Comcast bill bring? Credit for terminated phone service? Extra service fees for termination? We'll find out in a month.

Friday, October 31, 2008

Goodbye Comcast Phone Service?

My port order with Vitelity for my Comcast phone number went through. That means, when I dial that number, my pbxinaflash/freepbx/asterisk server gets the call from Vitelity via SIP rather than the Digium 410P FXO card hooked up to the analog port (POTS) of my Comcast DOC device.

While I was able to place Vonage calls after my Vonage number ported through my Vonage ATA, Comcast has cut my phone service off. No calls in our out through the Comcast line.

What remains to be see is if they stop billing me for phone service on my next bill. It would be nice if they just dropped the charge. I'll update here when I get the next bill.

Tuesday, October 28, 2008

How to dump Vonage and save money.

Four years ago, unlimited domestic long distance service was a deal for $25 month. My Vonage bill had crept up to $37.50 a month with the extra virtual phone number and taxes, fees, and more fees, so I really wanted to dump them. Why pay that much for telemarketers to bug you during dinner? Vonage also had no good blacklist function.

I started looking at Asterisk. Asterisk has gotten much much better about support and stability and there are several third-party appliances available now. By appliance, I mean the download includes an entire OS, generally CentOS 5.2 these days. To name a few: AsteriskNow, FreePBX, PBXInaFlash, Elastix, and TrixBox.

I chose pbxinaflash, just because I liked the blog over at NerdVittles, and it's still free. (I still needed a modest PC and bought an analog card, the Digium TDM410 with one FXS and one FXO. I needed these to get my internal house telephone line lit and connect my Comcast POTS service into the server during the transition period.)

Then I signed up for basic service over at Vitelity. There are other VOIP/SIP trunk providers, but Vitelity worked and has low rates. Once I got my system up and running on the first Vitelity number, I ported over my Vonage number for $18. It took less than a week, compared to the month it took for my Comcast number. My combined savings from Vonage and Comcast will be $60/month for 1.2 cents-a-minute service from Vitelity for $1.49 /month plus 1.2¢ per minute in and 1.44¢ out.

My new service is metered, and that's just fine, because I don't make that many calls from home. (Math: assume $12.50 for inbound, $12.50 for outbound gives me 1041 minutes inbound and 868 minutes outbound, for a total of about 1900 minutes or 32 hours a month of talk time before I hit Vonage-size bills.)

I can also make my Asterisk box do lots of stupid phone tricks, like blacklisting telemarketing phone numbers and getting weather by voice at home.

If you find setting up a Linux appliance intimidating, or you're just not that much of a control freak, you can also buy a Linksys PAP2T-NA for about $50 and Vitelity will support it.

Vonage tried to keep me with a month of free service, but my number was already ported. Goodbye, Vonage! They also tried to charge me a termination fee of $50, which after four years of service didn't apply. Vonage is definitely getting shadier in its billing practices as they get hit with a bad economy and competition.

Update: I built a mini-ITX (small) server for this based on the Intel Atom CPU/Motherboard combo. It worked great, except that the RealTek NIC drivers weren't quite supported in the stock CentOS 5.2 installer. Some quick kernel updates and another temporary NIC got it fixed quickly, but it's not a procedure for the easily frustrated.

Wednesday, August 20, 2008

LDIFDE export from list of sAMAccountNames, using vbscript

If you need to export a list of accounts from Active Directory into ldif-format files that will preserve attributes, you can try this. It takes a text list of sAMAccountNames (one per line) and writes out an ldif file for each one. You can easily import the same way by changing the arguments on the exec line and removing the export parameters. You'll also need to fix the line breaks.


'v1.1
' The script will take a text file with usernames (sAMAaccountNames and export them via ldifde to individual files
' named as sAMAccountname.ldf.

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("samaccounts.txt",1)
'On Error Resume Next
Do Until objTextFile.AtEndOfStream
strName = objTextFile.Readline
WScript.Echo "sAMAccountName: " & strName
Set objShell = CreateObject("WScript.Shell")
'you can add/remove attributes from the line below, but be sure to get the quotes right.
Set objScriptExec = objShell.Exec("ldifde -f c:\scripts\export\" & strName & ".ldf -s myDomainController -d ""ou=myOU,ou=Clients,dc=domain,dc=com"" -r ""(sAMAccountName=" & strName & ")"" -l objectclass,dn,c,department,description,displayName,employeeID,extensionAttribute10,extensionAttribute8,extensionAttribute9,givenName,homeDirectory,initials,manager,otherTelephone,physicalDeliveryOfficeName,extension,sn,streetAddress,telephoneNumber,extensionAttribute14,extensionAttribute11,extensionAttribute12,wWWHomePage,sAMAccountName,userPrincipalName,mail,mailnickname,telephoneNumber " )
strResults = objScriptExec.StdOut.ReadAll
WScript.Echo strResults

Loop
set objFile=Nothing

'End