Re: [asterisk-users] AGI Script Returning 4

2021-01-30 Thread Steve Edwards

On 1/30/21 1:18 PM, Alexander Perkins wrote:

the PHP-AGI script fails after it is executed and simply returns 
'returning 4'.


On Sat, 30 Jan 2021, Michal Rybarik wrote:

I think this can happen by hanging up the call by one party, when SIGHUP 
is sent to AGI script. PHP will exit on SIGHUP. It can be resolved by 
initializing signal handler in PHP script (pcntl_signal) for SIGHUP and 
doing nothing in it (return).


From res_agi.c:

enum agi_result {
AGI_RESULT_FAILURE = -1,
AGI_RESULT_SUCCESS,
AGI_RESULT_SUCCESS_FAST,
AGI_RESULT_SUCCESS_ASYNC,
AGI_RESULT_NOTFOUND,
AGI_RESULT_HANGUP,
};

so, AGI_RESULT_HANGUP == 4.

When Asterisk detects the hangup on the channel, it sends a SIGHUP to your 
AGI.


I always set a signal handler on SIGHUP and do what makes sense to my 
application: maybe some cleanup or syslog() before return() or exit(). 
Almost always exit().


--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
https://www.linkedin.com/in/steve-edwards-4244281

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] AGI Script Returning 4

2021-01-30 Thread Michal Rybarik
Dňa 30. 1. 2021 o 20:18 Alexander Perkins napísal(a):
> HI All.  I have a really strange issue that I'm two months into
> troubleshooting; however, I cannot figure it out.  I have an AGI
> Script (PHP) that runs every time a call comes into my Asterisk box. 
> Most of the time, it runs without any issue.  However, every now and
> then, the PHP-AGI script fails after it is executed and simply returns
> 'returning 4'.  I verify the PHP script begins to run.  However, it
> appears to just stop.  I have placed try/catch statements everywhere,
> but it does not seem to hit them.  
>
> Just to verify, this is the same script running over and over with the
> same parameter.  
>
> Any ideas/suggestions as of what can be happening?


I think this can happen by hanging up the call by one party, when SIGHUP
is sent to AGI script. PHP will exit on SIGHUP. It can be resolved by
initializing signal handler in PHP script (pcntl_signal) for SIGHUP and
doing nothing in it (return).

-- 
Regards,
Michal Rybarik


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] AGI Script Returning 4

2021-01-30 Thread Jeff LaCoursiere

Out of RAM/swap?

j

On 1/30/21 1:18 PM, Alexander Perkins wrote:
HI All.  I have a really strange issue that I'm two months into 
troubleshooting; however, I cannot figure it out.  I have an AGI 
Script (PHP) that runs every time a call comes into my Asterisk box.  
Most of the time, it runs without any issue. However, every now and 
then, the PHP-AGI script fails after it is executed and simply returns 
'returning 4'.  I verify the PHP script begins to run.  However, it 
appears to just stop.  I have placed try/catch statements everywhere, 
but it does not seem to hit them.


Just to verify, this is the same script running over and over with the 
same parameter.


Any ideas/suggestions as of what can be happening?

Thanks,
Alex



--

*Jeff LaCoursiere*
STRATUSTALK, INC. / CTO

Phone:  *+1 703.496.4990 x108*
Mobile: *+1 815.546.6599*
Email:  *j...@stratustalk.com* 
Website:*https://www.stratustalk.com*
Address:*One Freedom Square
13th Floor
Reston, VA 20190*

 
 




-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] AGI Script Returning 4

2021-01-30 Thread Alexander Perkins
HI All.  I have a really strange issue that I'm two months into
troubleshooting; however, I cannot figure it out.  I have an AGI Script
(PHP) that runs every time a call comes into my Asterisk box.  Most of the
time, it runs without any issue.  However, every now and then, the PHP-AGI
script fails after it is executed and simply returns 'returning 4'.  I
verify the PHP script begins to run.  However, it appears to just stop.  I
have placed try/catch statements everywhere, but it does not seem to hit
them.

Just to verify, this is the same script running over and over with the same
parameter.

Any ideas/suggestions as of what can be happening?

Thanks,
Alex
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Asterisk 16.14.0 pjsip transport-tls cert parsing error

2021-01-30 Thread Michael Maier


On 29.01.21 at 22:33 Ruisheng Peng wrote:

Thanks for the detailed explanation Michael.

I stop the current asterisk process (started by systemd), and restart it as
asterisk:

[asterisk@voip1 ~]$ strace -f -o /home/asterisk/strace.log asterisk -fmq
-vvv -C /etc/asterisk/asterisk.conf


from the log there was no attempt to even open the cert file.  I edited
/etc/asterisk/pjsip.conf to add a "method = tlsv1" line to the
transport-tls section. Rerun the strace command, and here the part re cert
files:

8189  stat("/home/asterisk/certs/asterisk.crt", {st_mode=S_IFREG|0640,
st_size=1

212, ...}) = 0

8189  geteuid() = 1002

8189  getegid() = 1002

8189  getuid()  = 1002

8189  getgid()  = 1002

8189  access("/home/asterisk/certs/asterisk.crt", R_OK) = 0

8189  stat("/home/asterisk/certs/asterisk.key", {st_mode=S_IFREG|0640,
st_size=8

91, ...}) = 0

8189  geteuid() = 1002

8189  getegid() = 1002

8189  getuid()  = 1002

8189  getgid()  = 1002

8189  access("/home/asterisk/certs/asterisk.key", R_OK) = 0

8189  socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 16

8189  setsockopt(16, SOL_SOCKET, 0x /* SO_??? */, [1], 4) = -1
ENOPROTOOPT (


I'm missing the "open" (or "openat") and the following "read" call - weren't there 
any or didn't you post them? These are the important calls! They will show, if the 
file is used at all or not (and possibly the reason, why it is not used - EACCESS 
e.g.).



Thanks
Michael

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
 https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users