[Home]

Summary:ASTERISK-10962: FASTAGI disconnects all ssh sessions to PC when hangup occurs
Reporter:Alan McMillan (alanmcmillan)Labels:
Date Opened:2007-12-03 22:23:35.000-0600Date Closed:2007-12-11 09:47:23.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_agi
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:While using fastagi to control calls it is closing ssh sessions when the agi session terminates. I will be logged in to asterisk via ssh and running asterisk -r. Then we dump a file into the /var/spool/asterisk/outgoing directory which dials an aleg then on answer dials a bleg and bridges the call legs. Once the FASTAGI session terminates its control is disconnects my asterisk -r ssh session completely from the PC.. happens on every call and all connection to the PC are terminated.

Thanks in advance!

Alan
Comments:By: Alan McMillan (alanmcmillan) 2007-12-06 22:22:02.000-0600

More info - This is running on LIBSS7 and it seems to happen when the a outgoing call file has called the Aleg party and once the ALEG has answered then spawns the FASTAGI  which does the command STREAMFILE,  then the far end of ALEG(called party) hangs up and the REL is received. At this point all SSH, VNC sessions are terminated.

By: Alan McMillan (alanmcmillan) 2007-12-07 20:49:09.000-0600

I have found the line (2211) in the code the kills all the ssh sessions.. IN RES_AGI.c --function static enum agi_result run_agi
for (;;) {if (needhup) {
needhup = 0;
dead = 1;
kill(pid, SIGHUP);  -----The PID is = -1 when it runs this line..
     }

If the PID runs as -1 it kills all SSh sessions...



By: Alan McMillan (alanmcmillan) 2007-12-07 20:50:33.000-0600

In 1.4 this code is not in the "function static enum agi_result run_agi"

By: Alan McMillan (alanmcmillan) 2007-12-09 13:11:11.000-0600

sending the sighup with PID =-1 will send the sighup to all pids greater than 1. This is what is causing the sessions to drop. Changing it from kill(pid,SIGHUP) to a break fixed the problem of disconnecting all ash sessions.

By: Digium Subversion (svnbot) 2007-12-10 10:04:37.000-0600

Repository: asterisk
Revision: 92199

U   trunk/res/res_agi.c

------------------------------------------------------------------------
r92199 | file | 2007-12-10 10:04:37 -0600 (Mon, 10 Dec 2007) | 4 lines

Only send a SIGHUP if the pid is greater than -1, otherwise all PIDs greater than -1 will get the SIGHUP... and that is bad.
(closes issue ASTERISK-10962)
Reported by: alanmcmillan

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=92199

By: Alan McMillan (alanmcmillan) 2007-12-10 12:05:52.000-0600

I think you should have set your if statement to the following -

if (pid > -1)
     kill(pid, SIGHUP)
else
  break;

It doesn't close the socket otherwise.

By: Tilghman Lesher (tilghman) 2007-12-10 17:00:10.000-0600

No, that's intentional.  Though we send the process a SIGHUP to tell it that a hangup has occurred, we will continue to interact with the process, if it survives the HUP signal (which it can, if it installs a signal handler).

By: Alan McMillan (alanmcmillan) 2007-12-10 17:40:15.000-0600

So how will agi know that the call hungup? The 1.4 version has the break and we see the socket close which tells us the call/agi is completed.  How are we suppose to know AGI has completed successfully and the channel has closed? should we receive the AGI RESULT 200 = ???? or something else telling us success or do we need to poll the agi process? Is there another way to tell that the AGI is completed/ when called party has hungup? Currently are getting a AGI RESULT 511 when  we send an  AGI command on a dead channel. Should we look for this result or should ASTERISK close the socket upon call completetion? (which it does not do with the current fix).

Should the FASTAGI server receive a SIGHUP? We are running our server on a windows platform.

Thanks, Alan

By: Digium Subversion (svnbot) 2007-12-11 09:47:23.000-0600

Repository: asterisk
Revision: 92303

_U  team/file/bridging/
U   team/file/bridging/Makefile
U   team/file/bridging/Makefile.moddir_rules
U   team/file/bridging/apps/Makefile
U   team/file/bridging/apps/app_queue.c
U   team/file/bridging/apps/app_voicemail.c
U   team/file/bridging/build_tools/make_version
U   team/file/bridging/build_tools/make_version_h
U   team/file/bridging/cdr/Makefile
U   team/file/bridging/channels/Makefile
U   team/file/bridging/channels/chan_sip.c
U   team/file/bridging/channels/chan_zap.c
U   team/file/bridging/codecs/Makefile
U   team/file/bridging/doc/CODING-GUIDELINES
U   team/file/bridging/doc/manager_1_1.txt
U   team/file/bridging/formats/Makefile
U   team/file/bridging/funcs/Makefile
U   team/file/bridging/include/asterisk/_private.h
U   team/file/bridging/include/asterisk/adsi.h
U   team/file/bridging/include/asterisk/ael_structs.h
U   team/file/bridging/include/asterisk/aes.h
U   team/file/bridging/include/asterisk/agi.h
U   team/file/bridging/include/asterisk/alaw.h
U   team/file/bridging/include/asterisk/app.h
U   team/file/bridging/include/asterisk/ast_expr.h
U   team/file/bridging/include/asterisk/astdb.h
U   team/file/bridging/include/asterisk/astobj2.h
U   team/file/bridging/include/asterisk/callerid.h
U   team/file/bridging/include/asterisk/causes.h
U   team/file/bridging/include/asterisk/cdr.h
U   team/file/bridging/include/asterisk/devicestate.h
U   team/file/bridging/include/asterisk/doxyref.h
U   team/file/bridging/include/asterisk/dsp.h
U   team/file/bridging/include/asterisk/event.h
U   team/file/bridging/include/asterisk/extconf.h
U   team/file/bridging/include/asterisk/frame.h
U   team/file/bridging/include/asterisk/hashtab.h
U   team/file/bridging/include/asterisk/io.h
U   team/file/bridging/include/asterisk/localtime.h
U   team/file/bridging/include/asterisk/logger.h
U   team/file/bridging/include/asterisk/mod_format.h
U   team/file/bridging/main/rtp.c
U   team/file/bridging/pbx/Makefile
U   team/file/bridging/res/Makefile
U   team/file/bridging/res/res_agi.c
U   team/file/bridging/utils/Makefile
U   team/file/bridging/utils/check_expr.c
U   team/file/bridging/utils/clicompat.c

------------------------------------------------------------------------
r92303 | file | 2007-12-11 09:47:21 -0600 (Tue, 11 Dec 2007) | 193 lines

Merged revisions 92082-92084,92103-92104,92122,92140,92159-92160,92199,92201,92203,92205-92206,92243,92267,92285 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r92082 | rizzo | 2007-12-09 23:50:38 -0400 (Sun, 09 Dec 2007) | 23 lines

Put into Makefile.moddir_rules the common instructions used to
generate loadable and embedded module lists.

Individual Makefiles now are a lot simpler, possibly as simple as this:

   -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
   MODULE_PREFIX=cdr_
   all: _all
   include $(ASTTOPDIR)/Makefile.moddir_rules

and also more flexible because in a single directory we can combine
various types of modules (app_, cdr_, func_, ... ) by simply
listing them in the MODULE_PREFIX variable.

The individual Makefiles can also create list of modules to be
excluded by listing them in the variablel MODULE_EXCLUDE (see an
example in channels/Makefile).

With this change it becomes trivial to integrate a directory with
locally created/modified sources into the main build.



................
r92083 | rizzo | 2007-12-10 00:18:07 -0400 (Mon, 10 Dec 2007) | 7 lines

Fix the detection of modules installed from this build.

You can now add the path of local module subdirs from the command line with
  make LOCAL_MOD_SUBDIRS= ....



................
r92084 | rizzo | 2007-12-10 00:38:49 -0400 (Mon, 10 Dec 2007) | 3 lines

add a bit of info on the build infrastructure


................
r92103 | rizzo | 2007-12-10 04:35:35 -0400 (Mon, 10 Dec 2007) | 2 lines

simplify this file

................
r92104 | rizzo | 2007-12-10 04:40:59 -0400 (Mon, 10 Dec 2007) | 12 lines

remove relative paths and use ASTTOPDIR instead.

Give a default value to ASTTOPDIR if unset so we can at least
do a 'make clean' without too much trouble.

The proper fix, however, is to partition the top level
Makefile in a 'setup' and a 'main' part, in a way that the
'setup' part can be included from subdirs' Makefiles and
allow targets to be built without going through the
top level Makefile.


................
r92122 | rizzo | 2007-12-10 05:00:44 -0400 (Mon, 10 Dec 2007) | 2 lines

simplify/cleanup the scripts

................
r92140 | oej | 2007-12-10 09:29:57 -0400 (Mon, 10 Dec 2007) | 8 lines

Add a few extra headers in the voicemail users listing in
manager 1.1. Update documentation too.

(closes issue ASTERISK-10996)
Reported by: caio1982
Patches:
     extra_vm_manager_info1.diff uploaded by caio1982 (license 22)

................
r92159 | oej | 2007-12-10 10:10:24 -0400 (Mon, 10 Dec 2007) | 24 lines

Merged revisions 92158 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r92158 | oej | 2007-12-10 15:04:44 +0100 (M?�95?Y?�94?un, 10 Dec 2007) | 16 lines

Avoid reinvite race situations with two Asterisks trying
to reinvite each other in 1.4 and trunk.

This patch implements support for the 491 error code that
Asterisk 1.4 generates on situations where we get an
incoming INVITE and already has one in progress.

Thanks to mavetju for reporting and to Raj Jain for an
excellent explanation of the problem.

Patch by myself. Tested with 8 Asterisk servers connected
to each other in a training network.

Closes issue ASTERISK-10105


........

................
r92160 | oej | 2007-12-10 10:18:21 -0400 (Mon, 10 Dec 2007) | 2 lines

Removing some LOG_DEBUG items

................
r92199 | file | 2007-12-10 12:07:33 -0400 (Mon, 10 Dec 2007) | 4 lines

Only send a SIGHUP if the pid is greater than -1, otherwise all PIDs greater than -1 will get the SIGHUP... and that is bad.
(closes issue ASTERISK-10962)
Reported by: alanmcmillan

................
r92201 | file | 2007-12-10 12:15:06 -0400 (Mon, 10 Dec 2007) | 11 lines

Blocked revisions 92200 via svnmerge

........
r92200 | file | 2007-12-10 12:13:43 -0400 (Mon, 10 Dec 2007) | 4 lines

It is possible for nativeformats to contain more then one codec, so print out multiple ones.
(closes issue ASTERISK-10877)
Reported by: ovi

........

................
r92203 | mmichelson | 2007-12-10 12:30:46 -0400 (Mon, 10 Dec 2007) | 15 lines

Merged revisions 92202 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r92202 | mmichelson | 2007-12-10 10:29:44 -0600 (Mon, 10 Dec 2007) | 7 lines

If there are no members in a queue, then the loop where the datastore for detecting
duplicate dialed numbers will be skipped, meaning the datastore isn't created. This means
that when we try to free it, there's a crash. This stops that crash from occurring.

(closes issue ASTERISK-10998, reported by slavon, patched by eliel)


........

................
r92205 | file | 2007-12-10 12:37:35 -0400 (Mon, 10 Dec 2007) | 14 lines

Merged revisions 92204 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r92204 | file | 2007-12-10 12:36:15 -0400 (Mon, 10 Dec 2007) | 6 lines

Add G729A as another possible payload name for G729. Some devices use this instead of G729, which is perfectly normal since the payload number itself is defined and can't be used by anything else so the name doesn't matter that much.
(closes issue ASTERISK-10985)
Reported by: revolution
Patches:
     rtp.diff uploaded by revolution (license 346)

........

................
r92206 | file | 2007-12-10 12:48:18 -0400 (Mon, 10 Dec 2007) | 4 lines

Add ast_atomic_fetchadd_int_slow to check_expr for platforms that need it.
(closes issue ASTERISK-10986)
Reported by: snuffy

................
r92243 | dbailey | 2007-12-10 16:18:25 -0400 (Mon, 10 Dec 2007) | 2 lines

Add CLI commands to dynamically set hw and sw gains

................
r92267 | oej | 2007-12-11 05:26:25 -0400 (Tue, 11 Dec 2007) | 2 lines

Doxygen updates

................
r92285 | oej | 2007-12-11 10:17:29 -0400 (Tue, 11 Dec 2007) | 2 lines

A lot of doxygen updates

................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=92303