[Home]

Summary:ASTERISK-04306: Unable to complete attended transfer when running from startup script
Reporter:Peter Valkov (_petew_)Labels:
Date Opened:2005-05-31 11:48:48Date Closed:2011-06-07 14:10:33
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_features
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) failure-as-non-root.txt
( 1) max-verbose-canreinvite-failure.txt
( 2) max-verbose-non-root-failure.txt
( 3) max-verbose-root-success.txt
( 4) strace-non-root.txt
( 5) strace-root.txt
( 6) success-as-root.txt
( 7) success-command-line-non-root.txt
Description:I followed instructions on http://voip-info.org/tiki-index.php?page=Asterisk+non-root to run asterisk as non root and I have problems with attended transfer.

When I try attended transfer with asterisk running as non root user the final step fails i.e.

A calls B
B press transfer sequence and speaks with C
B hangs up
A start to speak with C (but both sides have no audio)

I'm using /asterisk/contrib/init.d/rc.redhat.asterisk as init.d script.
Interesting part is if run the astersik from command line...

# asterisk -U asterisk -G asterisk -vvvgc

...everything works as expected. It looks like privilege problem but I can't resolve the problem myself.

****** ADDITIONAL INFORMATION ******

http://voip-info.org/tiki-index.php?page=Asterisk+non-root
Comments:By: Michael Jerris (mikej) 2005-05-31 12:07:09

What channel\codecs?  Can you provide some debug and verbose output please?

By: Russell Bryant (russell) 2005-05-31 20:45:11

I very seriously doubt that this could have anything to do with running asterisk as non-root.

I'm willing to bet money that you are using SIP.  Yes?  Is there NAT involved?  Have you used a traffic analyzer to verify that the phones are actually sending media?

Also, please provide a 'sip debug' for this call.

By: Russell Bryant (russell) 2005-05-31 20:47:18

Wait a second ... I totally missed that last part of your report.  That is _bizarre_.

By: Peter Valkov (_petew_) 2005-06-01 00:14:21

I'll try to be more descriptive.

Equipment and software used:

- Welltech Wellgate 3504A (4FXS H323)
- GnuGK 2.2.2
- XLite Soft phone (SIP)
- JSPhone (SIP)

All this in same local network 192.168.0.0/255.255.0.0 no NAT involved.
I posted 3 files with sip debug and h323 debug... description folows. I'm using chan_h323 as channel driver for H323.

success-as-root.txt - running as root using rc.init script
success-command-line-non-root.txt - running as non root but from command line (# asterisk -U asterisk -G asterisk

-vvvgc)
failure-as-non-root.txt - running as non-root using rc.init script

Wellgate 35o4A (192.168.8.4) is iniciator of the call (A in example of my previuos post)
XLite (192.168.0.70) in the middle (B in the example)
SJPhone (192.168.0.23) is the end party (C in the example)

The only difference I can notice between running as non-root from rc.init script and command line is that when I use script there is about 20 treads running asterisk in the other case there is only one.

Here is the dump from ps xa|grep asterisk

running with rc.init script
===========================
8851 pts/0    S      0:00 /bin/sh /usr/sbin/safe_asterisk -U asterisk -G asterisk
8853 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8854 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8856 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8857 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8858 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8860 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8861 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8862 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8864 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8865 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8866 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8867 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8868 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8869 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8870 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8871 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8872 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8873 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8874 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8875 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8876 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c
8877 pts/0    S      0:00 asterisk -U asterisk -G asterisk -vvvg -c

running from command line
=========================
8769 tty1     Sl+    0:00 asterisk -U asterisk -G asterisk -vvvgc

By: Pash (opa__) 2005-06-01 02:27:01

it sounds like no access to /dev/zap*

show pls
strace -oqq -eopen -s200 -f asterisk;
grep /dev/zap qq

as root and as no root

By: Peter Valkov (_petew_) 2005-06-01 05:15:49

May be i'm doing something wrong but in both cases i'm getting error...

Asterisk already running on /var/run/asterisk/asterisk.ctl.  Use 'asterisk -r' to connect.

...and the content of the output file is the same and there is no /dev/zap at all.

here is the dump:
=================
4039  open("/etc/ld.so.cache", O_RDONLY) = 3
4039  open("/lib/libdl.so.2", O_RDONLY) = 3
4039  open("/lib/tls/libpthread.so.0", O_RDONLY) = 3
4039  open("/lib/libncurses.so.5", O_RDONLY) = 3
4039  open("/lib/tls/libm.so.6", O_RDONLY) = 3
4039  open("/lib/libresolv.so.2", O_RDONLY) = 3
4039  open("/usr/lib/libssl.so.0.9.7", O_RDONLY) = 3
4039  open("/lib/tls/libc.so.6", O_RDONLY) = 3
4039  open("/usr/lib/libcrypto.so.0.9.7", O_RDONLY) = 3
4039  open("/etc/asterisk/asterisk.conf", O_RDONLY) = 3
4039  open("/etc/asterisk/extconfig.conf", O_RDONLY) = 3
4039  open("/etc/localtime", O_RDONLY)  = 4


According to http://voip-info.org/tiki-index.php?page=Asterisk+non-root the /dev/zap

chown --recursive asterisk:asterisk /dev/zap
chmod --recursive u=rwX,g=rX,o= /dev/zap

I double check it
ll /dev/z*
drwxr-x---  2 asterisk asterisk      120 Jun  1 12:49 zap/
/dev/zap:
total 0
crw-r-----  1 asterisk asterisk 196, 254 Jun  1 12:49 channel
crw-r-----  1 asterisk asterisk 196,   0 Jun  1 12:49 ctl
crw-r-----  1 asterisk asterisk 196, 255 Jun  1 12:49 pseudo
crw-r-----  1 asterisk asterisk 196, 253 Jun  1 12:49 timer

By: Pash (opa__) 2005-06-01 12:05:51

>May be i'm doing something wrong but in both cases i'm getting error...
>Asterisk already running on /var/run/asterisk/asterisk.ctl. Use 'asterisk -r' to connect.

Yes. You did something wrong. You did started asterisk w/o stop previous. It has no usefull informational.

but with such chmod transfer must work, if /dev/zap are used.

so run asterisk from script and by hand and check with strace for diff in access.

By: Peter Valkov (_petew_) 2005-06-02 01:03:08

This time I did it right using command
# strace -o<output-file-name> -eopen -s200 -f /etc/init.d/asterisk start

But as opa__ expected with this chmod for /dev/zap there is no difference in both cases. The only "Permission denied" message I get is for /root/.asterisk_history which is irelevant for this case.

I'm uploading two files with full strace output:
strace-root.txt      - running as root
strace-non-root.txt  - running as asterisk

Hope someone can find something suspicious

[root@asterisk ~]# grep /dev/zap strace-root.txt
9457  open("/dev/zap/pseudo", O_RDONLY) = 9
9457  open("/dev/zap/timer", O_RDWR)    = 15
9490  open("/dev/zap/timer", O_RDWR)    = 43
9493  open("/dev/zap/timer", O_RDWR)    = 46
9493  open("/dev/zap/timer", O_RDWR)    = 49
9493  open("/dev/zap/timer", O_RDWR)    = 50
9501  open("/dev/zap/timer", O_RDWR)    = 53
9493  open("/dev/zap/timer", O_RDWR)    = 47

[root@asterisk ~]# grep /dev/zap strace-non-root.txt
9541  open("/dev/zap/pseudo", O_RDONLY) = 9
9541  open("/dev/zap/timer", O_RDWR)    = 15
9570  open("/dev/zap/timer", O_RDWR)    = 43
9573  open("/dev/zap/timer", O_RDWR)    = 46
9573  open("/dev/zap/timer", O_RDWR)    = 49
9573  open("/dev/zap/timer", O_RDWR)    = 50
9578  open("/dev/zap/timer", O_RDWR)    = 53
9573  open("/dev/zap/timer", O_RDWR)    = 47

[root@asterisk ~]# grep denied strace-non-root.txt
9541  open("/root/.asterisk_history", O_RDONLY) = -1 EACCES (Permission denied)
9541  open("/root/.asterisk_history", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 EACCES (Permission denied)



By: Kevin P. Fleming (kpfleming) 2005-06-02 14:37:21

OK, we need some help here to find out what is going on... strace does not really tell us what we need.

If the peers involved in this transfer are SIP, then we need complete "set verbose 255", "set debug 255" and "sip debug" traces from a failed call attempt. Also, it is important to try to reproduce this problem with canreinvite for the SIP peers set to both 'no' and 'yes'.

By: Peter Valkov (_petew_) 2005-06-03 04:03:36

Three new files uploaded. All contain CLI output with debug and verbose set to 255

max-verbose-non-root-failure.txt - running as non-root canreinvite default

max-verbose-canreinvite-failure.txt - running as non-root with canreinvite set to yes

max-verbose-root-success.txt - running as root canreinvite default

By: Michael Jerris (mikej) 2005-07-25 21:51:36

Is this only an issue if you talk to it with the other end being H323?  Can you test with a different phone (sip hard or softphone) and with one of the other h323 drivers to see if it is still an issue?

By: Michael Jerris (mikej) 2005-08-18 07:18:26

suspended due to no response.  Please re-open when you can respond to questions.

By: Michael Jerris (mikej) 2005-09-05 08:29:29

From an e-mail to me:  But, as reported in 4416, this happens only if I start asterisk with "service asterisk start", while if I run it from the console it does work!

So I examined both /etc/init.d/asterisk and /usr/sbin/safe_asterisk, comparing differences between them and manual usage.

So I got it.

Just remove "export LD_ASSUME_KERNEL=2.4.1" from the /etc/init.d/asterisk file and restart via usual "service asterisk start" and I can hear the sound after the attended transfer!

Hope this helps...

Regards,
Danilo



By: Russell Bryant (russell) 2005-09-05 11:40:14

I'm not sure where that init script came from, but the one that is currently in the asterisk source tree does not set that variable.