[Home]

Summary:ASTERISK-02690: [patch]Allow AGI script to get HANGUPCAUSE variable
Reporter:olivier (olivier)Labels:
Date Opened:2004-10-27 12:07:55Date Closed:2008-01-15 15:17:58.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_dial
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_dial.c.diff.txt
( 1) app_dial.c.diff.txt
( 2) app_dial.c.diff.txt
Description:Allow AGI script to get HANGUPCAUSE variable.
Before HANGUPCAUSE can just be get via Dialplan.



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

Just a little patch but usefull for instance for Least Cost Routing with several PRI telcos.

Disclaimer faxed.
Comments:By: twisted (twisted) 2004-11-14 21:08:54.000-0600

is this still current?  Also, markster, if this is current, what is the possibility in this making it into cvs-head?

By: olivier (olivier) 2004-11-16 05:42:57.000-0600

app_dial.c have changed since i've submited this patch.
Here new patch for current CVS-HEAD

By: twisted (twisted) 2004-12-01 00:53:39.000-0600

Does this still apply to CVS-HEAD?  I don't have a testing machine to play with ATM, but if it still applies, i'll mark it ready for final consideration.

By: olivier (olivier) 2004-12-01 03:46:58.000-0600

No, CVS-HEAD app_dial.c have changed an other time :-)
So here the new patch for current CVS-HEAD.
Tested today on a 8E1 asterisk servers

By: Olle Johansson (oej) 2004-12-12 15:51:54.000-0600

Does this still apply to CVS head? Is the problem you are fixing still there?

By: Clod Patry (junky) 2004-12-14 08:19:00.000-0600

Just tried with CVS-HEAD-12/13/04-09:27:05 and the patch was successfully applied.

By: Clod Patry (junky) 2004-12-14 11:50:30.000-0600

this is a small output:
Tue Dec 14 12:02:12 2004 1103043731.8 EXEC DIAL Zap/g1/5556663
Tue Dec 14 12:02:29 2004 1103043731.8 res=200 result=-1

Tue Dec 14 12:02:29 2004 1103043731.8 PASS (200 result=-1)
Tue Dec 14 12:02:29 2004 1103043731.8 GET VARIABLE HANGUPCAUSE
Tue Dec 14 12:02:29 2004 1103043731.8 res=200 result=1 (0)

with the 1, i know it means that variable has been set, but why the value is 0 exactly?
The asterisk has called 5556663 and the person at that number has hangup, if that could help.

By: olivier (olivier) 2004-12-15 04:04:40.000-0600

Yes patch is still apply the current CVS-HEAD (checked today) and this feature was not yet added to the current CVS-HEAD

You can find all the isdn cause code here :
http://networking.ringofsaturn.com/RemoteAccess/isdncausecodes.php

On my * server when the remote hang up, my telco send a normal call clearing (HANGUPCAUSE=16)

Here the PRI dump in that case :

Message type: RELEASE (77)
> [08 02 81 90]
> Cause (len= 4) [ Ext: 1  Coding: CCITT (ITU) standard (0) 0: 0   Location: Private network serving the local user (1)
>                  Ext: 1  Cause: Normal Clearing (16), class = Normal Event (1) ]

I use this patch for ZAP(PRI)-->ZAP(PRI) (my AGI check the HANGUPCAUSE to know if i should send the call to an other telco and to put the HANGUPCAUSE in cdrs)

It doesn't work for IAX --> ZAP(PRI). (pb on the IAX side)

edited on: 12-15-04 04:05

By: Clod Patry (junky) 2004-12-15 06:38:04.000-0600

like i was getting a 0, and the remote calller has hangup (i was supposed to get 16), i'll try with a PRI debug to see if i'm still getting a "0".

Btw, i used that situation:
SIP <---> Zap (PRI) (if that could help).
Do you think SIP has the same behavior as the IAX2?

By: Clod Patry (junky) 2004-12-20 23:05:58.000-0600

i remade the test and the remote party has hanguped.
this is my pri debug span X:
> Message type: RELEASE (77)
> [08 02 81 90]
> Cause (len= 4) [ Ext: 1  Coding: CCITT (ITU) standard (0) 0: 0   Location: Private network serving the local user (1)
>                  Ext: 1  Cause: Normal Clearing (16), class = Normal Event (1) ]
   -- Hungup 'Zap/1-1'

and this is my agi debug:
AGI Rx << GET VARIABLE HANGUPCAUSE
AGI Tx >> 200 result=1 (0)

so my GET VARIABLE should returns 200 result=1 (16) no?

with your example, can you provide an agi debug?

Thanks.

I just made a little test:
i've added ast_verbose(VERBOSE_PREFIX_3 "HC%d",chan->hangupcause); before your last line of patch. And at my surprise, I was getting "HC0" in my CLI, which means chan->hangupcause was setted to 0. I'm trying to find why exactly.

edited on: 12-20-04 23:54

By: Paul Cadach (pcadach) 2004-12-22 21:21:19.000-0600

Is hangupcause==0 was compatibility workaround?

By: Clod Patry (junky) 2004-12-22 21:37:54.000-0600

not sure to understand your question. Can you reformulate it in other words please?

It's like the member hangupcause in the struct channel isn't set, but i'm still getting a hangupcause=16 from telco.

By: Mark Spencer (markster) 2004-12-22 21:51:08.000-0600

Fixed properly in CVS by letting AGI know about "builtin" variables...

By: Russell Bryant (russell) 2004-12-24 14:23:43.000-0600

not in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:17:58.000-0600

Repository: asterisk
Revision: 4538

U   trunk/include/asterisk/pbx.h
U   trunk/pbx.c
U   trunk/res/res_agi.c

------------------------------------------------------------------------
r4538 | markster | 2008-01-15 15:17:57 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix AGI to know about "builtin" variables, too (bug ASTERISK-2690)

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

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