Friday, May 22, 2009

My Latest Hint

I just had this hint posted on

On my last project, I was collaborating with people in the States via iChat, using audio, video screen and document sharing.
We had such wide-ranging and complex discussions, I kept wishing I could record them.

Ironically, it was not until after the work ended that I found the iChat / Video / Record menu item (aarrgghh!!).

Well anyway, I thought it would be useful to automate the recording feature and wrote the script featured in MacOSX Hints.

You can attach this script to specific buddies, or to everyone. When an AV Chat starts, recording is automatically started ..... well actually the other party is first asked if they mind and can choose to reject the request.

It seems that only the person who initiates, records, so if both parties want a recording they both have to start it.

Many thanks to Ross and Dave for help testing :-)

Wednesday, May 20, 2009

Logging to GTalk

I was reading yesterday that Apple is thought to be using XMPP the Jabber protocol for their new iPhone Push Notification technology.

That's funny I thought, I had just started using XMPP for logging!!!

I am experimenting with Asterisk at the moment. Asterisk for those that do not know is an Open Source PBX (Private Branch Exchange) a phone system in software. I have it running on my ancient 500 Mhz Mac Cube, it has been extremely reliable. My home office now has a ridiculously sophisticated phone system ;-)

IMHO most of the monitoring tools for Asterisk suck. They are written in nasty languages like PHP, Perl, Flash etc. that not only do I not want on my system, they are overkill.

What I wanted was to receive simple messages about the run-time status of the system. I wanted to be able to receive these messages securely, from wherever I was (because I can use my phone system from wherever I am, but more on that another time).

Asterisk has a Jabber module, so this was an easy way to go.

So, I have two GMail Accounts, one for personal email, one for mailing lists.
I have iChat on my desktop/laptop/iPhone already subscribed to GTalk on my personal GMail account.

First I added my spare GTalk account as a buddy to my personal account (requires some fiddling around, but if you know your IM client, it's pretty easy).

Then I configured Asterisk (beware, she's a complex beast, BTW a semi-colon marks a comment).

First configure /etc/asterisk/jabber.conf :
debug=yes ;Turn on debugging by default.
autoprune=no ;Auto remove users from buddy list.
autoregister=no ;do not auto register users from buddy list.

[gtalk-logger] ;label
type=client ;Client or Component connection ;Username with optional roster.
secret=************** ;Password for MY_SPARE_GTALK_USERNAME
port=5222 ;Port to use defaults to 5222
usetls=yes ;Use tls or not
usesasl=yes ;Use sasl or not ;Manual addition of buddy to list.
statusmessage=Up and Running ;custom status message for Asterisk.
timeout=100 ;Timeout on the message stack.

This allows Asterisk to connect to GTalk to send messages.

The next thing to do is to emit messages from the appropriate parts of your dialplan.

First I defined a Macro, that can be used from anywhere in the dialplan, this goes in /etc/asterisk/extensions.conf :

; log message - to Jabber
; @param ${ARG1} - the message to send
exten => s,,Jabbersend(gtalk-logger,,${STRFTIME(${EPOCH},GMT,%C%y-%m-%d %H:%M%n)} ${ARG1})

This sends the message in $ARG1 with a timestamp.

Next is to use the macro from the dialplan. Here is an example of an outbound route to go via SipBroker, matching dialed numbers beginning with * :
exten => _*X.,1,Macro(logger,Outbound call to ${EXTEN} via SipBroker) ; log the call
exten => _*X.,2,Set(CALLERID(all)=${JQNAME} <${JQOFFICE}>) ; Set outbound CallerID
exten => _*X.,3,ChanIsAvail(SIP/${EXTEN}@sipbroker,j) ; Check to see if available (jumps to priority + 101 on fail)
exten => _*X.,4,Dial(SIP/${EXTEN}@sipbroker,,tTW) ; Dial, allowing transferring and recording
exten => _*X.,5,Macro(dial-result) ; Check result
exten => _*X.,104,Playback(all-circuits-busy-now) ; if ChanIsAvail fails, say message

I know, it looks really weird !!!! :-)

I left out a few details like, looking up the phone number in my to show the recipient's name and using to splash these messages received by iChat. I plan to cover these in a subsequent post.

I have found this to be a really simple and reliable solution.

There are XMPP libraries for many systems, I may start using this technique elsewhere as well.

Wednesday, May 06, 2009

Nested Screen Sharing

I am starting a new spare-time project (more on this later).

I am using Maven, Spring etc. etc. within IntelliJ.
While I have worked on projects started by other people using this tech, this is the first time I have started a new project using this stuff myself, so I reckoned I needed someone to review what I was doing.

So I contacted my good friend "M" (all names redacted).

We both fired up iChat and had a video conference for a while, M became interested.

Then we switched to an iChat screen sharing session to look through my code and show him what worked, this included me launching Screen to open a session to my server (so now we have one level of nested screen sharing).

M became even more interested.

M wanted to check out the code, so I fired up a Terminal and let him type in his own password into the htdigest command.

M then suggested that a mutual friend "G" would be really interested in this. iChat would not let me add G to it's screen sharing session, so M shared his screen with G via Skype. Now we have 2 levels of nested screen sharing.

G cannot type into my machine, but we can all talk to each other.

G wanted to check out the code, but as he could not type, I made a password for him using the Password Assistant in, then pasted it into our iChat text session.

G could not read the text easily, so I used Control-ScrollWheel to zoom into the stuff we were discussing.

M had compiled the project and wanted to run it, but could not set up the complex server the project connects to, so we reversed the screen sharing session, so I could set up his machine to connect through my VPN.

M and G make their first commit, adding their names to the project's pom.

It was an incredibly constructive few hours.

And a very warm welcome to my two new collaborators !!!!