Monthly Archives: November 2007

Asterisk 1471: Take 3

Hmm, this is turning into a regular saga now: so much so I’ve added a voip tag to these posts to help keep them together.

My original macro worked just fine when the incoming number and the dialled extension matched, but this is only true for my LAN and is not generally true when using external SIP providers as the incoming extension is very often the user id of the account. For this reason it’s very helpful to be able to pass in the destination extension number to the macro so that when the user calls 1471, the extension used to place that call will hear the correct caller id.

In this example, 123456 is the incoming extension from an external SIP provider, and 2000 is the actual extension on the LAN that the call is destined for:

[macro-dialcliexten]
exten => s,1,Set(DB(LastCallFrom/${ARG2})=${CALLERID(num)})
exten => s,2,Set(DB(LastCallTime/${ARG2})=${STRFTIME(${EPOCH},,%s)})
exten => s,3,Dial(${ARG1},30,toj)
exten => s,104,Voicemail(${ARG2})
exten => s,105,Hangup
 
[fromexternalsip]
exten => 123456,1,Answer
exten => 123456,2,Macro(dialcliexten,SIP/2000,2000)

Yes, this does cause some slight issues with groups: I haven’t got enough devices on my LAN to test that properly, but one idea I had was to store the caller id twice in the macro, with 0 being the group number (a synonym for the operator/group ring: change it if you like !):

[macro-dialcliexten]
exten => s,1,Set(DB(LastCallFrom/0)=${CALLERID(num)})
exten => s,2,Set(DB(LastCallFrom/${ARG2})=${CALLERID(num)})
exten => s,3,Set(DB(LastCallTime/0)=${STRFTIME(${EPOCH},,%s)})
exten => s,4,Set(DB(LastCallTime/${ARG2})=${STRFTIME(${EPOCH},,%s)})
...etc...

and with 1471 then reading out two numbers. This slightly deviates from the BT norm, and might need some user education but it’s not enough to simply store the number and only read out the most recent timestamp when calling 1471 as it’s possible for a group call to come in whilst one extension is in use.

Recording a couple of new voice prompts to give a result such as:

“The last number to call this extension was 01234 567890, today at 12:04pm and the last number to call these premises was 09876 543210 at 12:07pm”

might be one solution.

Share

aperture 1.5.6 hack

Now I haven’t actually got around to trying find these myself: 1.5.4 was working just fine for me and I couldn’t see anything that the 1.5.6 update would give me until I get OS X 10.5 (and that’s not likely until Aperture is properly supported there[1]) but others have found this information and posted them in the old 1.5.2 and 1.5.4 threads, so I thought it would be helpful to make a more Google friendly URL.

All of the credit for these values goes to Thao Nguyen and Paul (I can verify that only the first of Thao’s values is required for my dual 867MHz MDD as it has a hacked Radeon 9800 and 2GB of RAM so the video check and plist mods aren’t required).

Thao suggests:

0xbf08: 40 9E 00 88 –> 48 00 00 88
0xbfa4: 40 9E 00 88 –> 48 00 00 88
0xc0a4: 40 9E 00 6C –> 48 00 00 64

Paul suggests:

0xbf08: 40 9E 00 88 -> 48 00 00 80
0xbfa4: 40 9E 00 88 -> 48 00 00 80

Of course, having applied the change I now feel that 1.5.6 is faster than 1.5.4, but I can’t say how much of that is down to the usual problem of “newer must be better”…

[1] Hint, hint, Apple: stop making the Aperture library a 3rd-class citizen compared to iPhoto, and give us the full Time Machine whizziness too please. Feel free to make this part of Aperture 2 (including vignetting), of course !

Share

spec writing for the PHB

Ok, so who thinks of Dilbert’s boss when reading this snippet from a product spec PDF:

Dimension 25mm x 115mm x 75mm (when laying flat);
115mm x 25mm x 75mm (standing up)

I really, really hope that was put in there after an inane comment in a meeting… If the writer was actually serious about that, then I fear for the future of all documentation: at the very least they could have included the size of the stand and made it a useful statement.

Share

Asterisk 1471: Take 2

Update: Thanks to Steve for pointing out that SayNumber (line 5 of 1471 below) is a bad idea: it works just fine in limited testing on my LAN, but when given a normal UK 11-digit number it seems to have some trouble trying to pronounce 01234 567 890 as 1 billion, 234 million, 567 thousand 890…

Switching that command for SayDigits not only lets the function work, it also makes far, far more sense when listening to the result, too.

Ok, so I couldn’t leave it alone: here’s a macro’ed version with a modified 1471 readout that ought to trap illegal values. The only issue here is that I don’t currently have the FXO hardware and so I can’t say what the BT Unavailable, International and Withheld caller ID codes translate to in Asterisk.

All in the extensions.conf file, starting with the Macro definition:

[macro-dialcli]
exten => s,1,Set(DB(LastCallFrom/${MACRO_EXTEN})=${CALLERID(num)})
exten => s,2,Set(DB(LastCallTime/${MACRO_EXTEN})=${STRFTIME(${EPOCH},,%s)})
exten => s,3,Dial(${ARG1},30,toj)
exten => s,104,Voicemail(${MACRO_EXTEN})
exten => s,105,Hangup

And again, place these mappings in the correct context for your usage:

exten => 2000,1,Answer
exten => 2000,2,Macro(dialcli,SIP/2000)
 
exten => 2001,1,Answer
exten => 2001,2,Macro(dialcli,IAX2/2001)

Finally the new 1471 with a better date phrasing and some error checking:

exten => 1471,1,Answer
exten => 1471,2,Set(last=${DB(LastCallFrom/${CALLERID(num)})})
exten => 1471,3,Set(dtime=${DB(LastCallTime/${CALLERID(num)})})
exten => 1471,4,Playback(last-num-to-call)
exten => 1471,5,ExecIf($["${last}" != ""]|SayDigits|${last})
exten => 1471,6,ExecIf($["${last}" = ""]|Playback|unavailable)
exten => 1471,7,ExecIf($["${dtime}" != ""]|SayUnixTime|${dtime}||"Q IMp")
exten => 1471,8,Wait(2)
exten => 1471,9,Hangup

If anything, I suppose the lack of caller ID could be trapped at the start of the 1471 code and an “Unavailable” message could be played, but because this is on my own network I’m not that bothered about those cases as I will always want internal CID to be presented.

(Oops: an extra } crept in, so if you have taken a copy of this any time before the 23rd then do check your macro carefully)

Share

Asterisk 1471

Wanting to make my home Asterisk box a convergence point for VoIP and PSTN mans that I really wanted to have the “last number caller id” option that BT offer in the UK, but sadly the page on the Asterisk Wiki that mentions 1471 is no longer valid, so here’s my own implementation. It’s not 100% feature complete, but it does work in a comparable way to the PSTN version.

All the work is done in the extensions.conf file and you need to add an explicit store of the incoming CID and time before routing the call to the correct extension, so this could (obviously) be improved by using the Macro command, but that, as many of my past lecturers used to say, is left as an exercise for the reader.

In this case, two extensions 2000 and 2001 are shown as examples:

exten => 2000,1,Answer
exten => 2000,2,Set(DB(LastCallFrom/${EXTEN})=${CALLERID(num)})
exten => 2000,3,Set(DB(LastCallTime/${EXTEN})=${STRFTIME(${EPOCH},,%s)})
exten => 2000,4,Dial(SIP/200,30,toj)
 
exten => 2001,1,Answer
exten => 2001,2,Set(DB(LastCallFrom/${EXTEN})=${CALLERID(num)})
exten => 2001,3,Set(DB(LastCallTime/${EXTEN})=${STRFTIME(${EPOCH},,%s)})
exten => 2001,4,Dial(IAX2/201,30,toj)

The playback code is fairly straight forward:

exten => 1471,1,Answer
exten => 1471,2,Set(last=${DB(LastCallFrom/${CALLERID(num)})})
exten => 1471,3,Playback(last-num-to-call)
exten => 1471,4,SayNumber(${last})
exten => 1471,5,Playback(on)
exten => 1471,6,Set(dtime=${DB(LastCallTime/${CALLERID(num)})})
exten => 1471,7,SayUnixTime(${dtime})
exten => 1471,8,Wait(2)
exten => 1471,9,Hangup

Items to note:

  • Correct use of the Macro command would improve this a lot, so by creating something like DialCID and using that in place of Dial would make it trivial to use for all extensions
  • I have not tested this with Witheld or Blocked numbers and would expect that the SayNumber line would just say "Zero", so adding some conditional testing in there would make things nicer (test for zero CID)
  • I have not tested this for the case when no call has been received before for an extension: I would assume it’s another "Zero" response, but again, more conditionals in the 1471 section would make that nicer (test for zero date)
  • I find the date pronunciation quite offensive, as I am not currently in the year "two thousand seven" but "two thousand and seven" – there are options to SayUnixTime that I have yet to investigate
  • I haven’t implemented the "Press 1 to return this call" voice prompt that BT have

Feel free to correct these oversights in the comments – if things get optimised a lot I’ll post an update with the best/most feature complete version.

Share

Gloves for Photography

Taking pictures in cold weather has always been a little problematical as nice warm gloves don’t really help when fiddling with DSLR settings. One fairly decent solution I found in 2002 was a pair of Windstopper lightweight gloves with a thin leather palm that is just sensitive enough to allow buttons to be felt through them which worked well in Yosemite in the spring with a compact digital camera.

Needless to say, this year I manage to loose them (since found in the pockets of an old coat, of course) and so found myself wandering around shops trying to find something similar, and not prohibitively expensive as I’ll probably be doing this on an annual basis when I ‘loose’ these ones too… For some reason, this seasons fashion is for hugely impractical (for camera use) ski gloves, so I’d pretty much decided that I just has to get used to cold hands when my eldest spotted an interesting pair of gloves in my local John Lewis: they are fairly standard looking knitted fingerless gloves with a Thinsulate lining and hence nicely wind proof, at least for the lowlands of Cambridgeshire (-9ft to 480ft ASL) but with an extra pocket (again, lined) stitched to the back of the knuckles that folds down to create a mittens and velcros to the back of the hand when not in use.

These are truly excellent for fiddling with the smaller buttons of a DSLR, and mine have the thumb tip permanently exposed so using the 8-way selector for direct AF-point selection on an EOS 20D is fast and unencumbered. When walking my thumb does get cold, but it can be folded around and tucked into the top of the mitten if I’m not carrying anything, so it’s probably the best compromise for camera work.

Having searched around online, I’ve discovered that they’re actually called Shooters Mittens and come with either a fully knitted thumb, or a fully fingerless one and start from very little money indeed: under 4 UKP without P&P was my cheapest find (the pair from John Lewis were 8 UKP (sadly not in their online store) and used immediately I left the shop, and so well worth getting !). I would strongly suggest looking for ones with a Thinsulate (or similar) lining as without that the wind would whip through the wool fairly quickly, and the small (fake ?) leather palm pads on mine are an advantage as it does help with grip over fully woollen gloves.

They are a little bulky, and I can’t quite manage to use them as gloves without without thinking of Fagin, but they are probably the most useful photographic ones I’ve owned.

Share

i has been mostly…

Today, I has been mostly trying to convince FrameMaker not to change baudrate into obdurate.

It’s very persistent, though.

Share
Page 1 of 212