Disconnected number - asterisk dials indefinitely

Setup: asterisk 1.8 + freepbx 2.9 (CentoOS 5.5)
Problem: if I place an outbound call to a disconnected number, phone will ring indefinitely or till specified timeout value.
If I call the same number from a regular landline or a cell phone, it will play a specific sound and then a per-recorded message “Number is not in service”.
This is a real life scenario trying to reach to someone for 3 days who already moved. Co-incidentally, I called from my cell only to find out that “number is not in service”

asterisk logs:
[Aug 26 13:48:28] VERBOSE[1164] netsock2.c: == Using SIP RTP TOS bits 184
[Aug 26 13:48:28] VERBOSE[1164] netsock2.c: == Using SIP RTP CoS mark 5
[Aug 26 13:48:28] VERBOSE[1164] app_dial.c: – Called SIP/my_trunk/XXX9964941
[Aug 26 13:48:30] VERBOSE[1164] app_dial.c: – SIP/my_trunk-00000008 is making progress passing it to Local/[email protected];2
[Aug 26 13:49:13] VERBOSE[1164] app_macro.c: == Spawn extension (macro-dialout-trunk, s, 20) exited non-zero on ‘Local/[email protected];2’ in macro ‘dialout-trunk’

From the logs, it just waits to connect, but never connects. Why cell phone connects?
Is there a way to identify if the number is disconnected or not?

This sounds like a problem with your SIP provider not recognizing the fact that the number is not in service.

BF

You’re not by any chance using Google Voice for your outgoing calls, are you? They will often play “fake” ringing signal until a call is answered.

No it’s not Google voice.
It is a PSTN number, and they are sending 180 SIP progress along with the early media audio.
My VoIP provider is using our value route which is a mix of providers to maintain low cost and therefore there might be no standards. Even when their providers return the proper sip codes, they might also play early media recordings before doing so, such as “number is not in service”. They claimed to pass along the SIP response or early media received by the provider.
My Voip provider expalnation: What is happening is that our 1st value provider is randomly providing early media 180 SIP progress for this number, until it falls back to our backup carrier which return the proper early media audio with the invalid number error. We have seen that it may take up to two minutes for the first carrier to fall back to our backup carrier.

As for ISUP Cause values and corresponding mapped SIP responses, they claiming they did not receive any so they cannot pass it me ?

Considering all of the above, I guess there is nothing could be done?

May be somebody could suggest a better provider that is known to send back ISUP Cause values or at least SIP values mapped to the ISUP Cause values?