Engin updates their software and breaks routing

Engin updated their software a while ago and broke inbound switchboard distinctions. The To SIP header used to contain the switchboard number but now it doesn’t.

Incase you dont understand what this is about, engin is an Australian VoIP provider that allows “switchboard” numbers to be added for $5 per month to an account. This is great for saving money with 1300 numbers and provides local answer points that still come back to a single place. As we are migrating many customers away from Telstra (and hosting the VoIP asterisk system in the cloud at rackspace) this is a necessary function to determine where the calls came from.

Heres updated code that will work.

[ext-engin]

exten => _X.,1,noop(ENGIN STARTING)
exten => _X.,n,Set(ENGINH=${SIP_HEADER(DIVERSION)})
exten => _X.,n,Set(ENGINH=${IF($[${LEN(${ENGINH})} > 0]?”${ENGINH}”:”${SIP_HEADER(TO)}”)})
exten => _X.,n,Set(ENGIN=${CUT(ENGINH,:,2)})
exten => _X.,n,Set(ENGIN=${CUT(ENGIN,@,1)})
exten => _X.,n,GotoIf($[${LEN(${ENGIN})} > 0]?ext-did,${ENGIN},1:ext-did,${EXTEN},1)

ย 

just set the context for incoming calls to ext-engin and then this will send all calls back to the ext-did context with the appropriate target based on which switchboard number was used.

ย 

ย 

By the time I get to Phoenix, i’ll be sleeping

The day started off quite well. While sitting in the airport, I was organised, with a combination of TripIt, Dropbox, Google Calendar Sync, Evernote I had all my documents ready at hand. This makes life much easier when filling in forms with passport numbers etc.

The US war on tourism was in full force and apart from their difficult on board requirements, this year they have a online form to fill in before you can leave. This must be done 72 hours before leaving and no-one reminds you of it. Luckily, I had read something about it and filled it in.

It seems, a Visa is a document telling you had permission to enter a country, the USA and Australia participate in the visa waver program so this means you don’t need one. That sounds great until you realise what a visa does for you. It gives you permission to enter the country, now we don’t have it at all.

So, weeks ago, i fill in an online form with passport number, flight number, date of entry, date of exit and address where I will be staying. This could have been a real time saver but no-one apparently reads this form.

On getting to the airport I discovered that they didn’t know about my form and asked me to fill it all in again at the check in. Oh well, it only 5 mins and not too hard. My docs were all organised and not too hard to setup.

I always find it annoying that the little green form you need to fill in to leave the country is only provided when you get to the airport so this had to be filled in also.

Anyway, After all this, I was sitting in Qantas club charging the laptop and phone up feeling quite good about it all.

The Flight was annoyingly long (although obviously expected) and during the flight, we were given a blue form that asked the same questions again. I thought, as others had, that we didn’t need to do this as we had filled in one online and one at checkin. Well the crew made a PA announcement saying that this was needed regardless of what was done online. I was also annoyed at this point that Qantas doesn’t give you one of those as its a dedicated USA checkin desk and they should know whats required.

On getting to LAX, I was a little pleased to discover they have about 50 little cubicles readily to rapidly process the incoming traveller and send them on their way.Unfortunately, on loser inspection, only about 5 cubicles had people in them. Bugger.

25 mins later, I was told with a little sense of ‘understanding’ by the staff that I also needed a green form and I needed to go back and start again. This had the tone of ‘why is everyone getting this wrong today’

Well, in a very Douglas Adams moment, I found the green forms in a drawer. There were no signs on it saying ‘beware of the leopard’ but it might as well have.

Filling in this form, with the same information they had from online, checkin, and the blue form, i waited 25 mins more and got through immigration only leaving them with the required left hand, left thumb, right hand, right thumb fingerprints on the scanner and a nice new photo of me.

My bags were dizzy from going around and around and after I was sniffed by the puppies, I walked out without further interruption. I think the customs part of it all is working quite nicely now, it was really painless at that stage.

The car rental documents I had said wait for a car labeled ‘JohnnyPark’. 20 mins waiting was aparently enough because it finally decided to turn up and took me to the car rental place.

On getting there, I noticed it looked pretty dumpy. They didn’t believe be I had paid and it took a while to work out that I had only paid insurance.

Well, I thought this would have been quite simple as when I ordered online I clicked all the insurance boxes.

Well, Aparently I hadn’t ticked the not offered fourth party insurance, swamp insurance, doorknob tax, foreign accent and foreign licence tax, internet booking fees and a ‘oh, you actually want the car you ordered’ fees which updated me to the car they had available.

It was nicely already dented and scratched so that saves me the worry of having to do it later.

Luckily the guy wasn’t there to see me getting in the wrong side or there would have been a ‘the steering wheel is missing’ tax. Ok, I was a little tired.

The Garmin satnav i took with me had the usa maps on it and after the 10 min warmup time when it looks at all the music files on the SD card to make sure they haven’t changed, it started telling me what direction to take out of LA.

About an hour later, I stopped at a Wal*Mart and decided to get some breakfast and coffee. I also picked up a AT&T prepaid card (after doing lots of research on the net) and some recharge cards for it. I also picked up a cradle to charge the phone (I forgot to bring the car charger) and I was set. In the car, I spent 30 mins on the phone to AT&T working out that the iphone cannot be used in the USA. After I told them that I was wrong, it wasn’t an iphone, it was a nokia, they processed it and told me they can’t do it on the phone, I needed to go to an AT&T store and work it out there.

Giving up on that, I started driving again. With 5 hours of driving, i needed to get moving to get there on time. about 2 hours later, an impromptu lane change encouraged me to pull over and get something to keep me awake. I pulled into a carpark of a service station and thought I would just get an hours sleep. The ads on the TV in australia telling me that nothing beets a little sleep is working I guess.

After about 15 mins of sort of sleeping, I overheard someone talking. In my dazed state (trying to sleep really hard) I started to make out words and realised they were talking about me. Aparently the 911 operator was interested there was a body in a car in a car park. I then got up (much to the surprise of the person calling) and went into the service station and told them I was going to have a sleep in their car park.

This worked far better.

After about 30 mins of real sleep, I went back to the service station feeling I should buy something after using their carpark, I bought some ‘energy drink’ thats only about 60 ml. The packet says its 5hrs energy and you should take only half at a time. I took it all and that, with the sleep I had, had me feeling great.

3.5 hours or so later, I was in Glendale (near Pheonix) and checkin into the hotel. Aparently theres a cisco conference here at the same time so the world nerd population could be in real danger if there was a natural disaster here.

I then went out to find an AT&T store to get this phone thing sorted. When I arrived, I explained that the phone person told me that it had to be done in a store. She called the call center and in 10 mins, had it working. I guess the store part is nothing special, you only have to know to ignore them when they say its not possible.

Anyway, I now had a phone (working for voice) with a revolving 100mb data plan. If I used my Optus card, this represents $2000 of data, locally its $20. I know the $2000 is AUD and the $20 is USD but it still seems cheper to me.

After getting some pizza to eat, I tried the data part and realised it was not working. Maybe I really can’t use an Australian iphone here with data. Again, Bugger.

I called tech support and after a while, realised I was being passed from AT&T to Apple and back again many times I gave up. I setup the laptop up with the wifi in the hotel ($10 USD per day) and googled it. Right, I needed to update the carrier file. After plugging in the phone to iTunes, updating carrier files and realising it didn’t work any better, I had to then start playing with the phone more seriously.

The WIFI here gives you a /30 address range and even with the phone and laptop both connected ($10 USD per day EACH) I couldn’t ssh between them as they weren’t on the same subnet and they were blocking port 22.

I then setup both the laptop and phone to VPN back to the office (other side of the world, via 2 translations, over PPTP) and finally they were on the same subnet. I could then SFTP in, get the carrier file, edit it manually on the mac here, re-send it back, reboot and WOO HOO, data works.

Apple (ok, optus) turns off the APN settings for a phone so that users can’t break it. It means that we also can’t fix it (and they can’t either) so the change I made tuened on the settings screen where I could type in the right APN and get it all working.

So, its now 23:30, the energy drink seems to still be working (I can’t sleep now after about 2 hours earlier) and decided to write stuff that is a) too technical and b) not interesting.

I also got the virgin mobile internet working for the laptop so I have connections everywhere now.

AT&T seem to block port 5060 so sip doesn’t work over 3G but I can live with that i think.

Anyway, tomorrow the Asterisk (astricon 2009) conference starts and I’m really keen to see what its like. I just hope I get some sleep soon so I don’t have to sleep in class.

Asterisk, Digium and dCAP

I haven’t blogged that much lately as I have been struggling to keep up with the workload I have.

I thought I should however, let you know about a new certification available from Digium.

Digium are the people that create Asterisk. Its an open source telephony system we have been using at work for some years now and I have done quite a lot of customisations with it.

I thought I should try to get more real world customers and jobs with this technology rather than just setup my own systems and therefore wanted to get certified.

So, after a week in Melbourne, which only covers a small amount of the content in the exams, I am now a Digium Certified Asterisk Professional (dCAP #1360)

Just thought I would post something :-)

Trixbox, Caller ID (CID) and ENGIN

Trixbox has what i consider to be a strange behaviour where an extensions Outbound CID will override the trunk CID.

Using engin, i wanted to supress caller id on all outgoing calls. This is easy, i hear you say just by prefixing numbers with 1831. For engin, this works for everywhere but an 07 number. I called them about it and they told me that its not a problem at their end. This seemed strange to me as other Australian numbers worked perfectly. Anyway, i discovered that if you use a PAP2T or a SPA-3000, and supress caller id with them, the CID sent to engin is “anonymous”.

I now knew how to supress it but had trouble getting trixbox (or FreePBX) to actually use it. I decided that I could use the “Emergency CID” field in FreePBX Extensions and only mark engin as the emergency route. Then on the outgoing routes, tick Emergency for the numbers you want to supress caller id on.

I know its a bodgy solution but it works and i would present a normal CID for emergency calls anyway.

engin switchboard – Knowing which number was called

Using engin I was having trouble as all incoming calls from switchboard numbers were appearing on my primary number.

This was annoying as I wanted more control in the inbound routes of trixbox. The following extensioins_custom.conf contect worked for me.

[custom-from-engin]
include => ext-did
exten => _X.,1,SIPGetHeader(Var_TO=To)
exten => _X.,n,Goto(ext-did,switch${Var_TO:5:10},1)

As you can see, the SIP header contains a TO header which can be looked at. I simply add a Custom app inbound route for the main number like “custom-from-engin,${EXTEN},1” and using the above context, it re-routes the call back to the inbound contect (ext-did) with thenumber called with a “switch” prefix.

Then its just a simple matter of adding inbound routes like
switch0297990000 and making them do as you like.