newspaint

Documenting Problems That Were Difficult To Find The Answer To

Monthly Archives: September 2016

How To Change TLS Bind Port In Asterisk

Asterisk doesn’t make it necessarily easy to change the port that TLS is bound to.

In sip.conf I’d set a different port (6000):

tlsbindaddr=0.0.0.0:6000

But when I set sip set debug on I would see a message like the following on answer:

<--- Reliably Transmitting (no NAT) to 5.6.7.8:42849 --->
  P/2.0 200 OK
Via: SIP/2.0/TLS 192.168.1.3:42849;branch=z9hG4bKPjBFu7pgHTfOHCaNamaqTKTq3wenp-G.oY;alias;received=5.6.7.8;rport=42849
From: "myext" ;tag=mQqEvydONdU7yOGgCi2.OiDu8lSfXZuK
To: <sip:test@myhost.com>;tag=as378489ee
Call-ID: tAYfXG5BEF9w8lY.ghupqOtwNyV3J18G
CSeq: 12562 INVITE
Server: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:test@1.2.3.4:5061;transport=TLS>
Content-Type: application/sdp
Require: timer
Content-Length: 387

The problem was that the Contact: header was advertising the wrong TLS port to the extension which would then attempt to contact the wrong port in response to the answered call (so no audio would start getting received by the extension).

The solution was to add to sip.conf:

externtlsport=6000

As mentioned in another article if the advertised IP address is wrong in this Contact: header then you may also want to specify:

externip=1.2.3.4

Converting XPS to PDF using MuPDF on Ubuntu Linux

I had a recently generated “.xps” file sent to me and needed it in PDF form for convenient viewing. The following took place on Xubuntu Trusty Tahr 14.04 LTS.

The “xpstopdf” tool failed me with a poorly converted document (just a single rectangle, no text).

Then I installed “mupdf”:

~$ sudo apt-get install mupdf
~$ mupdf mydocument.xps

This it rendered to my satisfaction to the screen. Next I wanted a PDF file!

But when I tried using “mudraw“, the associated tool installed with the “mupdf-tools” Ubuntu package, I got the following error:

~$ sudo apt-get install mupdf-tools
~$ mudraw -o /tmp/mydocument.pdf /tmp/mydocument.xps
error: empty page tree, cannot insert page
error: cannot draw '/tmp/mydocument.xps'

In the end I decided to try compiling the latest version available from MuPDF‘s download page (I downloaded “mupdf-1.9a-source.tar.gz” published 2016-04-21).

~$ wget 'http://mupdf.com/downloads/mupdf-1.9a-source.tar.gz'
~$ tar -xvzf mupdf-1.9a-source.tar.gz
~$ cd mupdf-1.9a-source
~$ sudo apt-get install mesa-common-dev libxcursor-dev libxshmfence-dev libxext-dev libxrandr-dev libxinerama-dev
~$ nice make -j 3
~$ ./build/release/mutool draw -o /tmp/mydocument.pdf /tmp/mydocument.xps

This time my PDF was rendered without any errors!

Adjusting a Sliding Door’s Wheels

So you have a mirrored sliding door and you want to put it on the tracks for the first time; but it doesn’t seem to quite fit. Ideally the wheels should go down and something needs to secure the door to the track above.

First step is to identify the top and bottom of the sliding door. The wheels are at the bottom. We’ll come to the top later.

The wheel looks like the following picture:

Sliding door wheel

Sliding door wheel

What we want to do is twist the screw (left or anti-clockwise to raise, right or clockwise to lower) until the wheel is at the height we want it.

The screw head pushes against the plate to give the wheel height

The screw head pushes against the plate to give the wheel height

So get a plus screwdriver, if that is the kind of screw fitted to your door wheel mechanism, and give it a twist until you get the height you want.

Twist the screwdriver anti-clockwise or left to raise the wheel, clockwise to lower

Twist the screwdriver anti-clockwise or left to raise the wheel, clockwise to lower

Note that if you want to make your door lean you can raise or lower just the one side of the door. The following diagram should make this clearer:

Raising the right wheel makes the door lean left

Raising the right wheel makes the door lean left

Now for the top of the door. You can identify the top of the door by a sliding mechanism designed to push up and fit into the track above the door.

Sliding mechanism at the top to fit into the track above

Sliding mechanism at the top to fit into the track above

Quite simply push this up until you hear a click and the mechanism has settled into place in the elevated position.

Push up the sliding mechanism until you hear it click

Push up the sliding mechanism until you hear it click

It should stick in the elevated position. You can lower it when it comes time to take the door out (for cleaning or replacement).

Sliding mechanism on top of door should stay in place in elevated position

Sliding mechanism on top of door should stay in place in elevated position