Fork me on GitHub

Sigil.org Blogging about technology, beer, and whatever the hell I want

29Nov/092

A Strange Language

Posted by sarumont

While scanning and shredding all manner of paper record I have accumulated over the years, I stumbled across a poem given to me by an English teacher in middle or high school. There is no author on the print I have, and I could not find the poem online anywhere. To preserve its humor for eternity, here it is:

A lawless language is English;
The plural of box is boxes,
But more than one ox is not oxes.
One fowl's a goose, more are two geese,
But more than one mouse is certainly not meece.
On the contrary for mouse, the plural is mice,
While the plural for house is never hice!
If more than one man is always men,
The plural of pan should then be pen?
One may be that, and two may be those,
But the plural of hat is surely not hose!
Masculine pronouns are he, his and him.
Imagine the feminines she, shis and shim!
The English language, I think you'll agree,
Is as strange a language as ever could be.
If anyone happens to know the proper author of this, please let me know. Otherwise, enjoy what I feel is an accurate and humorous critique of the English language.

Filed under: musings 2 Comments
23Nov/098

Mark As Read with maildrop

Posted by sarumont

I run my own mail server using maildrop to deliver to multiple virtual LDAP users. My personal e-mail is sorted into many folders on the server as it comes in. To reduce my e-mail maintenance overhead, I decided to mark messages as read automatically in certain folders. This is useful for low-priority e-mails such as advertisements, coupons, etc.; I want to view these when I need them - not when I receive them.

It turns out that maildrop doesn't have any facilities built in to do this automatically. It does, however, provide you with the tools to roll your own:

cc "${MAILDIR}.offers/"
`for x in ls ${MAILDIR}/.offers/new/*; do mv $x ${MAILDIR}/.offers/cur/${x##*/}:2,S; done`
to "/dev/null"

Since the 'to' directive exits immediately after execution, you must cc then move. Delivering to /dev/null then stops execution of the filter.

Filed under: Uncategorized 8 Comments
9Nov/090

Fun with Asterisk

Posted by sarumont

I spend approximately 10-15% of my time wearing the IT hat for both my company and the company whom we are currently consulting. We are running FreePBX for both companies' phone systems. Our setups are relatively simplistic, so I have had little problems managing everything. The first real hurdle I ran into was the inability of Asterisk to allow the same extension to log on from multiple devices. I'm pretty sure this is not a SIP restriction, but I may be wrong. Either way, my goal is not to bash FreePBX or Asterisk.

Initially, I over-engineered a solution to this problem while simultaneously making it more difficult to administer and use. The setup required a ring group for each user's extension. This ring group contained an extension for each phone the user needed. To have a common voicemail box, there was yet another extension for voicemail. Convoluted? Yes, it was. It did work, however, for our use-case. We have three employees, and only one of us needed a multi-homed extension at the time. I set it up and forgot about it.

More recently, I set up another FreePBX system for our customer. At this point, I discovered the Follow-Me module. The original point of using this module was to allow calls to ring through a user's mobile phone. I also adapted my previous abomination to use Follow-Me, making for a much simpler setup. It was simpler, yes, but it was still a bit convoluted.

This system worked well until I was tasked with on-demand call recording. I determined how to enable this in a jiffy with some quick Googling. The problem? Access to these recordings was tied to the extension that initiated the recording.

To solve this, I re-visited "deviceanduser" mode in FreePBX. This is the route I should have taken in my earlier ventures - it decouples devices and users. A device can register via SIP to the server, and a user represents an extension and voicemail box. This can be enabled by setting AMPEXTENSIONS=deviceanduser in /etc/amportal.conf. Be sure to comment out the existing setting.

To enable on-demand recording, add 'w' to the dial command string and 'W' to the outbound dial command string. These settings are found in General Settings in the FreePBX UI.

Add the following to /etc/asterisk/features_general_custom.conf:

featuredigittimeout=3000
courtesytone=beep

This makes sure the PBX will register your keypress (waiting for up to 3 seconds) and beeps to confirm. Feel free to disable the beep.

To enable access to the recordings from the ARI:

ln -s /var/spool/asterisk/monitor/ /var/www/html/recordings/monitor
yum install sox

Finally, tie everything to the user. For every device a user has, add the user's extension in the 'accountcode' field on the device.
Edit /var/www/html/recordings/modules/callmonitor.module. Add:

OR accountcode = '" . $_SESSION['ari_user']['extension'] . "'

After the line:

OR dst = '" . $_SESSION['ari_user']['extension'] . "'

On my FreePBX, this was at line 614.

Now, all calls recorded from any device for a given user will show up in that user's ARI for download.

Filed under: technology No Comments