For the last week, I’ve been diagnosing a problem with our VoIP system  at work. Our setup is quite simple, and consists of an Asterisk server  with a Digium E100P card connected to a TelstraClear E1 connection.
Everything seemed to be working fine, however we discovered that  calls from Telecom NZ landlines work fine when directly dialing to  phones (DDI), but would be disconnected after ~25seconds when calling to  the IVR (Digital menu – eg: “press 1 for blah, 2 for foo”).
No other phone providers had a problem – TelstraClear landlines, Vodafone and Telecom mobiles all worked. :-/
As you can imagine, this problem caused a lot of headaches, but we  finally managed to track it down – Asterisk wasn’t sending a Q931  ALERTING message on the IVR calls, but did for the DDI calls.
After filing a bug report with digium, we were pointed to the Ringing() command which when I added before the Answer command in the IVR extension  config, caused Asterisk to send a couple of rings, and an ALERTING  signal.
Once we tested with the ALERTING signal, everything worked fine!  This may be a problem with some of the equipment Telecom NZ uses, or  just some strange incompatibility between 2 devices somewhere on the  voice network. It certainly doesn’t seem very common, due to the  complete lack of information on the web about anyone having a problem  like this.
Since we use FreePBX for Asterisk, I had to patch it so it would add  the ringing command to the configuration when it generates it. I’m  going to be upgrading FreePBX next week, but once I do, I’ll upload the  patch here for anyone needing it. :-)
UPDATE – 28 May 2007
I just upgraded our pabx from Trixbox 1.2.0 to 2.2, and found that  the problem no longer occurs. After checking though the config, I found  there has been an addition of a Ringing() command in  /etc/asterisk/extensions.conf.
Find the [from-zaptel] section and adjust it to look like this:
[from-zaptel]
exten => _X.,1,Set(DID=${EXTEN})
exten => _X.,n,Goto(s,1)
exten => s,1,NoOp(Entering from-zaptel with DID == ${DID})
; Some trunks _require_ a RINGING be sent before an Answer.
exten => s,n,Ringing()