Summary:ASTERISK-15113: Asterisk does not connect the call to internal extension
Reporter:ilker Aktuna (mrmrmrmr)Labels:
Date Opened:2009-11-10 13:47:41.000-0600Date Closed:2011-06-07 14:00:50
Versions:Frequency of
Environment:Attachments:( 0) all_sip_conf.txt
( 1) debug.txt
Description:The following issue occurs in most of my calls received from an external SIP proxy. So it is highly reproducable.
Very rarely, the call reaches the internal extension.

Let me first describe the structure of my Asterisk Proxy:

It is running on a CentOS server with kernel.
The server has 2 interfaces ; ppp0 accesses the external SIP proxy over internet and has real IP address. br0 is the LAN interface which my SIP clients are connected. Internal SIP clients are Linksys SPA3000 and Linksys PAP2.
There is Shorewall firewall running on the server, but there is no NAT either for the external call legs or internal call legs.

In the problematic call scenario, call is coming from an external SIP proxy to my Asterisk server. The incoming rule sends the call to a ring group (600) which should forward the call to 2 internal extensions (995 and 990).

Sometimes, the call is not connected to the internal clients. They don't receive any SIP INVITE.
When I check the logs on Asterisk console I see "AGI Script dialparties.agi completed, returning -1"
But I don't have any clue why dialparties.agi script returns "-1"
I am attaching the agi debug output to this issue.
I will also attach my existing sip configuration.
Comments:By: Leif Madsen (lmadsen) 2009-11-11 08:13:12.000-0600

If this is an issue with your AGI script, then I'm not sure there is anything we can do here. I'm not sure where the bug with Asterisk would lie in this scenario.

By: ilker Aktuna (mrmrmrmr) 2009-11-11 16:01:02.000-0600

This is not a custom agi script made by me. It is a default one.
And I don't believe that the issue is related to the AGI script.
How do you come to that conclusion ?

By: Leif Madsen (lmadsen) 2009-11-11 17:29:33.000-0600

I come to that conclusion based on your description of events, as I can't think of a reason why the INVITE would not be sent to an end point. This is a very common occurrence, and the AGI appears to be a possible culprit here.

"Sometimes, the call is not connected to the internal clients. They don't receive any SIP INVITE.
When I check the logs on Asterisk console I see "AGI Script dialparties.agi completed, returning -1"
But I don't have any clue why dialparties.agi script returns "-1""

Where did you obtain dialparties.agi? I don't see this in /var/lib/asterisk/agi-bin/ which leads me to believe this must be something in some external piece of software.

By: Mark Michelson (mmichelson) 2009-11-11 18:06:14.000-0600

Most of the situations which would result in a -1 return for AGI operation are obvious things, like the calling channel hanging up, or a command's execution returning an error.

I have a hypothesis about the problem. I'm thinking that the problem is that in ast_agi_send, there is a call to ast_carefulwrite. It may be that ast_carefulwrite is encountering an error for some reason. It's not mentioned specifically what version of 1.6.0 is being used here. I just know it's an older version of 1.6.0. If you are using a version before, I would recommend as a diagnostic test to upgrade to a version >= The reason is that ast_carefulwrite was rewritten in that version. If nothing else, you may see a big red error message appear on the screen explaining why ast_carefulwrite failed. You may even find that the rewrite of ast_carefulwrite actually prevents the error you were seeing.

If you are using a version beyond and you didn't see any error messages during operation, then it is likely something else causing the problem. As a followup, is the script actually reaching the end in the example debug you provided, or is there still more to go in the script? When the AGI fails, is it always at the end of the script, or does it happen at other places during the script's operation? Does your AGI process handle SIGHUP signals? If Asterisk detected an error when executing a command, it would send a SIGHUP to your script.

By: ilker Aktuna (mrmrmrmr) 2009-11-12 14:19:53.000-0600


Asterisk version is ; it comes with Trixbox.
The AGI script is also part of Trixbox.
But please don't tell me to get help from Trixbox community. They do not help.

I don't know how AGI scripts are written and I don't know how to troubleshoot them. But the script seems to return -1 at the same point each time it fails.

By: Mark Michelson (mmichelson) 2009-11-12 14:46:04.000-0600

You've said not to direct you to the Trixbox community, but honestly there's not another choice in the matter. If you're using Foncore, it is not the responsibility of the maintainers of Asterisk to fix their bugs.

I'm suspending this issue since for all we know, the problem is due to faulty code in Foncore. Now, if you are able to reproduce the problem with Asterisk instead (and preferably the latest 1.6.0 release), then you can feel free to re-open the issue. If you do, then please specify which version of 1.6.0 you used to reproduce the problem. If at all possible, also provide the AGI script causing the problem so that developers can attempt to reproduce the problems themselves. Thanks for your understanding in the matter.

By: ilker Aktuna (mrmrmrmr) 2009-11-12 15:40:05.000-0600

I couldn't find another way to directly contact you so I try to write through re-open procedure:
Should I try compiling Asterisk 1.6.0.x latest release on my box ?
Would it be possible to use it with Trixbox ?

I am not a fan of Trixbox. If it will be possible to use all features with normal Asterisk, I can compile and use it. Please let me know...