Hello all,

Asterisk is segfault dying when I try to park a call from an extension dialed from an AGI script.
The situation is as follows:
I call from a sip phone (really It doesn't matter if It's SIP or not) to extension 181 (corresponding to a mgcp DG-104S phone).
.....
exten => 181,1,AGI(dummydial.agi,MGCP/aaln/[EMAIL PROTECTED])
.....
dummydial.agi is only a simplified test script I made to isolate the problem, It only makes a dial to the given channel:
#############################################################
#!/usr/bin/perl
# dummydial.agi: Marcar internos con AGI
use strict;
use Asterisk::AGI;


local $::INPUT_RECORD_SEPARATOR="\n";
local $::OUTPUT_AUTOFLUSH=1;

my $agi = new Asterisk::AGI;
my %input = $agi->ReadParse();
my ($dialstring) = shift @ARGV;

$agi->verbose("Dialing: $dialstring",1);
my $ret = $agi->exec('Dial',"$dialstring|40|t");
# $ret = $agi->exec('Macro',"generic_dial|$dialstring|$vm"); # This is the real thing, crashes to
# exit 0;
##################################################################


then I peak the phone and the call is established perfectly. Then I want to park the call with the following configuration at parking.conf:
###################################
[general]
parkext => 700 ; What ext. to dial to park
parkpos => 701-720 ; What extensions to park calls on
context => parkedcalls ; Which context parked calls are in
parkingtime => 120 ; Number of seconds a call can be parked
####################################


so from the called extension (181) I press (#) I do hear "transfer" and then I dial 700.
Then the voice tell mi the call is parked at extension 701, but as soon as I hangup the called phone
and try to peak the parked call (and sometimes even before) Asterisk dies with segmentation fault.
As I said before It doesn't depend if I made a call from SIP to SIP or MGCP to SIP or MGCP to MGCP extension.
The final result (the server crashing with segfault) is always the same.
However If I do exactly the same but with the extension dialing directly from extensions.conf with:
exten => 183,1,Dial(MGCP/aaln/[EMAIL PROTECTED],40,tr)
the parking and recovering of the calls works correctly without any problem.


This is the output on the console:
=========================================================================
*CLI> -- Executing AGI("SIP/ipcontact.com.uy-0817d0c0", "dummydial.agi|MGCP/aaln/[EMAIL PROTECTED]") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/dummydial.agi
dummydial.agi|MGCP/aaln/[EMAIL PROTECTED]: Dialing: MGCP/aaln/[EMAIL PROTECTED]
-- AGI Script Executing Application: (Dial) Options: (MGCP/aaln/[EMAIL PROTECTED]|40|t)
-- MGCP mgcp_request(aaln/[EMAIL PROTECTED])
-- MGCP cw: -1, dnd: 0, so: 0, sno: 0
-- MGCP mgcp_new(MGCP/aaln/[EMAIL PROTECTED]) created in state: Down
-- Called aaln/[EMAIL PROTECTED]
-- MGCP/aaln/[EMAIL PROTECTED] is ringing
-- Endpoint 'aaln/[EMAIL PROTECTED]' observed 'hd'
-- MGCP/aaln/[EMAIL PROTECTED] answered SIP/ipcontact.com.uy-0817d0c0
-- Attempting native bridge of SIP/ipcontact.com.uy-0817d0c0 and MGCP>/aaln/[EMAIL PROTECTED]
Mar 3 16:07:42 NOTICE[458781]: rtp.c:264 process_rfc3389: RFC3389 support incomplete. Turn off on client if possible
-- Endpoint 'aaln/[EMAIL PROTECTED]' observed '#'
-- Started music on hold, class 'default', on SIP/ipcontact.com.uy-0817d0c0
-- Playing 'pbx-transfer' (language 'en')
-- Endpoint 'aaln/[EMAIL PROTECTED]' observed '7'
-- Endpoint 'aaln/[EMAIL PROTECTED]' observed '0'
-- Endpoint 'aaln/[EMAIL PROTECTED]' observed '0'
-- Stopped music on hold on SIP/ipcontact.com.uy-0817d0c0
-- Started music on hold, class 'default', on SIP/ipcontact.com.uy-0817d0c0
== Parked SIP/ipcontact.com.uy-0817d0c0 on 701
-- Playing 'digits/7' (language 'en')
-- Playing 'digits/0' (language 'en')
-- Playing 'digits/1' (language 'en')
-- AGI Script dummydial.agi completed, returning 0
-- Endpoint 'aaln/[EMAIL PROTECTED]' observed 'hu'
-- MGCP handle_request(aaln/[EMAIL PROTECTED]) ast_channel already destroyed
-- MGCP handle_request(aaln/[EMAIL PROTECTED]) set vmwi(-)
-- Endpoint 'aaln/[EMAIL PROTECTED]' observed 'hd'
-- MGCP mgcp_new(MGCP/aaln/[EMAIL PROTECTED]) created in state: Down
-- Endpoint 'aaln/[EMAIL PROTECTED]' observed '7'
-- Endpoint 'aaln/[EMAIL PROTECTED]' observed '0'
-- Endpoint 'aaln/[EMAIL PROTECTED]' observed '1'
-- Executing ParkedCall("MGCP/aaln/[EMAIL PROTECTED]", "701") in new stack
-- MGCP mgcp_answer(MGCP/aaln/[EMAIL PROTECTED]) on aaln/[EMAIL PROTECTED]
-- Stopped music on hold on SIP/ipcontact.com.uy-0817d0c0
-- Channel MGCP/aaln/[EMAIL PROTECTED] connected to parked call 701
-- Attempting native bridge of SIP/ipcontact.com.uy-0817d0c0 and MGCP/aaln/[EMAIL PROTECTED]
Mar 3 16:07:53 WARNING[475166]: channel.c:846 ast_waitfor_nandfds: Thread 475166 Blocking 'SIP/ipcontact.com.uy-0817d0c0', already blocked by thread 458781 in procedure ast_waitfor_nandfds
Mar 3 16:07:54 WARNING[491551]: channel.c:846 ast_waitfor_nandfds: Thread 491551 Blocking 'SIP/ipcontact.com.uy-0817d0c0', already blocked by thread 458781 in procedure ast_waitfor_nandfds
......... MANY, MANY OF THIS ................
...................................................................
Mar 3 16:07:55 WARNING[491551]: channel.c:1364 ast_write: Thread 491551 Blocking 'SIP/ipcontact.com.uy-0817d0c0', already blocked by thread 458781 in procedure ast_waitfor_nandfds
-- Timeout on SIP/ipcontact.com.uy-0817d0c0
== CDR updated on SIP/ipcontact.com.uy-0817d0c0
-- Executing Hangup("SIP/ipcontact.com.uy-0817d0c0", "") in new stack
== Spawn extension (local, t, 1) exited non-zero on 'SIP/ipcontact.com.uy-0817d0c0'
-- Executing GotoIf("SIP/ipcontact.com.uy-0817d0c0", "1?4") in new stack
-- Goto (local,h,4)
-- Executing NoOp("SIP/ipcontact.com.uy-0817d0c0", "") in new stack
Ouch ... error while writing audio data: : Broken pipe
Segmentation fault
========================================================================


Does anybody knows a fix for this, or if there is a work around for this. I need to use AGI to handle the extensions because this is the only way (I guess) of doing something interesting and dynamic with the calls (for example using a DB to keep the extensions information).
I thought about using SET CONTEXT and SET EXTENSION and then make the dial from a special context, but then I have no easy way to access the other extensions (for example to make a transfer) from the called one.


We already made a bug report on this topic.

Thanks in advance for any help
Luis


_______________________________________________ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to