Pages

16/01/2026

Monitoring loop-resistance on a Cisco Voice Gateway and sending it via HTTP POST

Every couple of years I manage a field full of Cisco VG224 Voice Gateways, collocated in portable toilets. They're connected to a patch panel via a chunky, 25 pair "RJ21" cable which occasionally become dislodged, and I'm unaware until someone reports that their phone has stopped working, which isn't ideal.

The Cisco hardware provides some line testing facilities, so I wondered if I could utilise them to check the status of the cable remotely, and hopefully push the status to a monitoring platform such as Prometheus via push-gateway.

Note, running the tests requires the voice-port to be shutdown, and something connected to the line. I opted for a simple 470 ohm resistor between the A/B (Tip/Ring) conductors.

Running a loop-resistance looks something like this:

vg224# test voice port 0/0/3 line-test loop-resistance
Loop resistance measurement between tip-ring: 447 Ohm

So now we need a script to run the command, parse the output, and POST the result somewhere. My initial attempts failed, with the script throwing errors about the HTTP library. Fortunately with a hint from Darren Parkinson's Blog and a bit of "Vibe Coding" I managed to get it working,

First off we need to create the post_loop_resistance.tcl script. This is formatted so you can paste it directly into the Cisco console (Without being in the config terminal). Remember to update the LOOP_PORT and URL to suit your environment:

    tclsh
    set fh [open "flash:/post_loop_resistance.tcl" w]
    puts $fh {
    # Measures loop resistance and POSTs result to HTTP endpoint
    
    # ---- CONFIG ----
    set LOOP_PORT "0/0/3"
    set URL "http://webhook.site/foo"
    # ----------------
    
    source "tmpsys:lib/tcl/http.tcl"
    
    # Ensure privileged mode (safe if already enabled)
    catch {exec "enable"}
    
    # Run the line test
    set output [exec "test voice port $LOOP_PORT line-test loop-resistance"]
    
    # Normalise output
    regsub -all {\r} $output {} output
    
    # Extract numeric value
    set resistance ""
    if {[regexp -nocase {loop resistance.*:\s*([0-9]+)\s*(ohm|ohms)} $output -> resistance unit]} {
        # ok
    } elseif {[regexp {:\s*([0-9]+)} $output -> resistance]} {
        # fallback
    } else {
        puts "ERROR: could not parse resistance"
        puts "RAW:$output"
        exit 1
    }
    
    # Build Prometheus text body
    set body [format "loop_resistance_ohms{port=\"%s\"} %s\n" $LOOP_PORT $resistance]
    
    # POST the result
    set Token [::http::geturl $URL -type "text/plain" -query $body]
    
    # Print the response
    puts [::http::data $Token]
    
    # Cleanup
    ::http::cleanup $Token}
    close $fh
    exit    

To test its working you can manually run the tcl script, and you should see the HTTP POST hit your webserver:

vg224# tclsh flash:/post_loop_resistance.tcl
We can now schedule it to run every 300 seconds (Adjust to suit):
conf t
event manager applet POST_LOOP_METRIC
 event timer watchdog time 300
 action 1.0 cli command "enable"
 action 2.0 cli command "tclsh flash:/post_loop_resistance.tcl"
 end

You should now see the loop-resistance being POST'ed every 5 minutes.

The script is quite clean and easy to read so you should be able to customise it to POST any metric you want.

29/07/2024

Dialled Digit Analyser 1A

I've recently been playing with telephone dials again, and discovered that a handheld dial tester existed which would save faffing around with an oscilloscope. I managed to pick one up on eBay for slightly more than I would have liked to have paid, but it is in perfect condition so I can't complain too much.

Naturally I didn't read the manual and immediately started playing with it, but it turns out it doesn't function quite like how I'd anticipated. Still, I'll probably get some use out of it.

Digit Analyser and Tele 290 test set

18/06/2024

Checking if a telephone dial is within spec without removing it from the phone.

 

I've previously written a blog post on using a Digital Oscilloscope to adjust the dial in a telephone, but it assumed the dial had been removed for stripping and cleaning prior to adjustment. I've recently been experimenting with some telephones to figure out the tolerances for both the Pulses Per Second and Make/Break ratio of the Grandstream HT8XX ATAs and wanted to check a dial without disassembling the whole phone.

I wasn't quite sure on the best way to go about it so I asked on the Telecommunications Heritage Group mailing list and James Campbell kindly replied with a simple way of checking the dial.




05/12/2023

BBC Micro: SerialFS and the IFEL Flash ROM board, a match made in heaven.

I've been playing around with BBC Micro Computers recently. I've "accidentally" come to own 3 of them, having picked one up cheaply then finding 2 more that I intended on refurbishing and selling but couldn't bring myself to let go.

I like to demonstrate retro computing and communications hardware at various events which means the roles of the BBCs can change fairly frequently, which requires swapping out the EPROM chips inside the machines that contain the programs. This is something I'm not a big fan of, as it can result in bent pins and stresses the 40 something year old PCB and sockets.

Fortunately I've found a solution, the IFEL Flash ROM board and SerialFS.

The IFEL Flash ROM Board

30/11/2023

Building a USB Serial to 5 Pin Domino DIN Cable

 The BBC Micro computer uses an almost extinct 5 Pin "Domino" DIN connector for its RS423 (RS232 compatible) serial port. I wanted a neat cable to connect my BBC computers to things like SerialFS and TCPSer but there wasn't really anything on the market that was neat and compact.

I needed a USB to RS232 level cable, but without a DB9 on the end, as the USB Serial chip is often inside it. Many cables available online are TTL level which makes them unsuitable. After a bit of hunting I discovered the programming cable for the Kenwood TM-D710 Radio uses RS232 levels and Tx, Rx, Gnd, RTS and CTS which is exactly what we need, so I set about modifying it.


06/04/2023

Testing USB serial relay compatibility with Mikrotik RouterOS - Fail

I've got some Amateur Radio projects in the pipeline that will require the ability to turn off the radio remotely in the event of a fault developing. This needs to be out-of-band and accessible to more than one "closedown-operator" so if the main operator isn't available, someone else can shut the station down.

The projects all require a computer of some sort, so I had an idea that I could use a USB serial relay to switch the power to the radios off, assuming they'd be easy to use and compatible with both standard form factor PCs as well as SBCs like Raspberry Pis.

I quickly realised this wouldn't be ideal as the situation might arise where the computer has crashed and left the radio transmitting, and it wouldn't be possible to switch off the relay, so I needed an alternative. As it happens I was also planning on including a Mikrotik router in these builds as they've gained the nickname "The Swiss Army Knife of Routers" and allow you to quickly setup tunnels and VPNs which are useful for remote access. Some models also have a USB port, and basic support for USB serial adapters, so I bought a few from AliExpress to test them out.

USB Serial Adapters

04/04/2023

Flashing MMDVM on an STM32 Nucleo using Raspberry Pi OS 11 / Bullseye

5 years ago I wrote a blog post on Flashing MMDVM onto an STM32 Nucleo with OSX. Well, good news patient readers, I'm back with a new post, this time doing the flashing from Raspberry Pi OS 11 / Bullseye.

F0DEI's MMDVM Board