[Home]

Summary:ASTERISK-02960: Report IAX2 Frame_Text to send Hangup Cause from Zap channel
Reporter:dimi (dimi)Labels:
Date Opened:2004-12-10 07:02:03.000-0600Date Closed:2004-12-30 15:18:41.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20041210__iax2_causecodes__2.diff.txt
( 1) Tilghman_20041209__iax2_hangupcause.diff.txt
Description:My scenario is interconnect two * box and receive the Hangup Cause from the * end point (TDM PRI), after some test i see that i cant receive the right Cause ID, i have look inside the Iax2.c but im not a c developer so i decide to try the SendTEXT application but without lucky because i cant receive the Text from the Source * box. Example:

A Server (source Call)
[extension.conf]
exten=>_X.,1,Dial(IAX2/text:1234@bserver/${EXTEN}
exten=>_X.,2,NoOp(${HANGUPCAUSE})
exten=>_X.,3,Hangup

B Server (Termination Call)
[extension.conf]
exten=>_X.,1,Dial(Zap/g0)
exten=>_X.,2,NoOP(${HANGUPCAUSE})
exten=>_X.,3,SendTEXT(hangupcause=${HANGUPCAUSE})
exten=>_X.,4,Hangup

Thanks to Tilghman i received a patch to try fix this problem, but for the moment i cant able to receive the Hangup cause also using this patch & SendText. I'm looking for a possible solution, perhaps there are a problem of ovveriding variable in iax2.c using the patch.. but im looking :-)

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

I have used two box with Stable 1.0.2 with BriStuff-0.2.0-RC2 but i think is the same on unmodified version
Comments:By: dimi (dimi) 2004-12-10 07:39:46.000-0600

i have discored the problem :-) I have patched the Server A with Tilghman patch
(not on the server B..) and i have remove the line that ovveride the Receive Send Text
from server B:
from chan_iax2.c on server A
--------------------
+++ Line 5503
case IAX_COMMAND_HANGUP:
                               iaxs[fr.callno]->alreadygone = 1;
                               ast_log(LOG_DEBUG, "Immediately destroying %d, having received hangup\n", fr.callno);

                               /* Set hangup cause */
+++                                //      if (ies.cause)
+++                                //             iaxs[fr.callno]->owner->hangupcause = atoi(ies.cause);

                               /* Send ack immediately, before we destroy */
                               send_command_immediate(iaxs[fr.callno], AST_FRAME_IAX, IAX_COMMAND_ACK, fr.ts, NULL, 0,fr.iseqno);
                               iax2_destroy_nolock(fr.callno);
                               break;
----------------------------------------------------------------------------
After this hack the SendText from B server is able to send the HangupCause to
server A :-)
How i can replace my stupid hack with a good line of code?

edited on: 12-10-04 07:40

By: Mark Spencer (markster) 2004-12-10 23:59:00.000-0600

actually, you know what...  we could carry hangup cause *after* the trailing 0 of the cause string and thus not break backwards compatibility.  The cause could come from include/asterisk/causes.h

By: dimi (dimi) 2004-12-14 05:27:35.000-0600

Tilghman have provide a new patch to transport the HangupCause in a better way. This patch is based on CVS HEAD and seems have problem with Stable branch i have found this problem:
> After patch Today CVS when i try compile it i have the following error:
> -------------
> A_PRI   -DIAX_TRUNKING   -DCRYPTO -fPIC    -c -o chan_iax2.o chan_iax2.c
> chan_iax2.c: In function `attempt_transmit':
> chan_iax2.c:1472: error: `AST_CAUSE_DESTINATION_OUT_OF_ORDER' undeclared
> (first use in this function)

Tilghman reply to this problem:
CVS STABLE does not have the cause codes <asterisk/causes.h> included, while
CVS HEAD does.  Please try a clean checkout of CVS HEAD (IOW, no tag).

I have tested in CVS HEAD 13/12/2004 but seems dont return the right Hangup Cause provide from the remote Server. Some help how can i debug this problem?
Thanks

By: logitel (logitel) 2004-12-14 18:39:06.000-0600

Why not make this more generic and transfer a set of local channel variables to the remote * via iax during callsetup / disconnect.
I think this should be implemented as a extension to IAX2 protocol.

Any comments anyone on this ?

By: dimi (dimi) 2004-12-15 05:01:43.000-0600

Dear logitel if you need to send some Variable from remote server you ca use the first patch of Tilghman directly in * stable, this patch use SendText on Remote * box to transport the Value of Variable but in this case this variable is post on "hangupcause" global variable, if you are able to manage C code (is not my case :-( ) you can modify it to send in a new Local Variable.

By: Mark Spencer (markster) 2004-12-28 15:58:08.000-0600

Tilghman's patch for the q.931 cause code in IAX has already been merged.  Thanks!