[asterisk-users] ${HANGUPCAUSE} is always 0 in the h extension

Zhang Shukun bitzsk at gmail.com
Tue May 11 04:25:42 CDT 2010


this is dialplan:

exten => 123,1,Dial(SIP/1000,10,L(10000))
exten => 123,2,NoOp(HANGUPCAUSE is ${HANGUPCAUSE})

this is the log which hangup by caller:
== Using SIP RTP CoS mark 5
    -- Executing [123 at 95040:1] Dial("SIP/1001-00000031",
"SIP/1000,10,L(10000)") in new stack
    -- Setting call duration limit to 10.000 seconds.
  == Using SIP RTP CoS mark 5
    -- Called 1000
    -- SIP/1000-00000032 is ringing
    -- SIP/1000-00000032 answered SIP/1001-00000031
    -- Executing [h at 95040:1] Playback("SIP/1001-00000031",
"vm-goodbye") in new stack
[May 11 17:23:16] WARNING[4258]: file.c:750 ast_readaudio_callback:
Failed to write frame
    -- <SIP/1001-00000031> Playing 'vm-goodbye.gsm' (language 'en')
[May 11 17:23:16] WARNING[4258]: app_playback.c:471 playback_exec:
ast_streamfile failed on SIP/1001-00000031 for vm-goodbye
    -- Executing [h at 95040:2] NoOp("SIP/1001-00000031", "HANGUPCAUSE is
16") in new stack
  == Spawn extension (95040, 123, 1) exited non-zero on 'SIP/1001-00000031'



this is the log which hangup by callee:

   == Using SIP RTP CoS mark 5
    -- Executing [123 at 95040:1] Dial("SIP/1001-00000033",
"SIP/1000,10,L(10000)") in new stack
    -- Setting call duration limit to 10.000 seconds.
  == Using SIP RTP CoS mark 5
    -- Called 1000
    -- SIP/1000-00000034 is ringing
    -- SIP/1000-00000034 answered SIP/1001-00000033
    -- Executing [h at 95040:1] Playback("SIP/1001-00000033",
"vm-goodbye") in new stack
    -- <SIP/1001-00000033> Playing 'vm-goodbye.gsm' (language 'en')
    -- Executing [h at 95040:2] NoOp("SIP/1001-00000033", "HANGUPCAUSE is
16") in new stack
  == Spawn extension (95040, 123, 1) exited non-zero on 'SIP/1001-00000033'


2010/5/11 Vardan <hvardan71 at gmail.com>:
> Can you show your dialplan part for that call and log also please
>
> Thanks
>
> Zhang Shukun wrote:
>> thank you for reply.
>>
>> but hangupcause cant different whether caller hangup or callee hangup?
>>
>> above two situation both return 16.
>>
>> 2010/5/11 Vardan<hvardan71 at gmail.com>:
>>> Asterisk variable hangupcause
>>> Page Contents
>>>
>>>      * Asterisk variable Hangupcause
>>>            o Recommended SIP<->  ISDN Cause codes (from RFC3398):
>>>            o PRI Hangup Codes
>>>            o Version notes
>>>            o Tip
>>>            o Examples
>>>                  + Example 1
>>>                  + Example 2
>>>                  + Example 3: Macro for handling hangupcause
>>>                  + Example 4: Set the hangup cause text to a variable
>>>            o See also
>>>
>>>
>>> Asterisk variable Hangupcause
>>> Hangupcause is the latest PRI hangup return code on a zap channel
>>> connected to a PRI interface. Note that this also works on SIP channels,
>>> maybe other channels as well.
>>> Tip: The packet isdnutils contains a utility called isdncause that
>>> provides a textual explanation of the error number that you feed it with
>>> (watch the entry format).
>>>
>>> Previous to CVS 2004-08-12:
>>>
>>>   From causes.h:
>>>   #define AST_CAUSE_NOTDEFINED    0
>>>   #define AST_CAUSE_NORMAL        1
>>>   #define AST_CAUSE_BUSY          2
>>>   #define AST_CAUSE_FAILURE       3
>>>   #define AST_CAUSE_CONGESTION    4
>>>   #define AST_CAUSE_UNALLOCATED   5
>>>
>>>
>>> For CVS head releases after 2004-08-12:
>>>
>>>   /* Causes for disconnection (from Q.931) */
>>>   #define AST_CAUSE_UNALLOCATED 1
>>>   #define AST_CAUSE_NO_ROUTE_TRANSIT_NET 2
>>>   #define AST_CAUSE_NO_ROUTE_DESTINATION 3
>>>   #define AST_CAUSE_CHANNEL_UNACCEPTABLE 6
>>>   #define AST_CAUSE_CALL_AWARDED_DELIVERED 7
>>>   #define AST_CAUSE_NORMAL_CLEARING 16
>>>   #define AST_CAUSE_USER_BUSY 17
>>>   #define AST_CAUSE_NO_USER_RESPONSE 18
>>>   #define AST_CAUSE_NO_ANSWER 19
>>>   #define AST_CAUSE_CALL_REJECTED 21
>>>   #define AST_CAUSE_NUMBER_CHANGED 22
>>>   #define AST_CAUSE_DESTINATION_OUT_OF_ORDER 27
>>>   #define AST_CAUSE_INVALID_NUMBER_FORMAT 28
>>>   #define AST_CAUSE_FACILITY_REJECTED 29
>>>   #define AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY 30
>>>   #define AST_CAUSE_NORMAL_UNSPECIFIED 31
>>>   #define AST_CAUSE_NORMAL_CIRCUIT_CONGESTION 34
>>>   #define AST_CAUSE_NETWORK_OUT_OF_ORDER 38
>>>   #define AST_CAUSE_NORMAL_TEMPORARY_FAILURE 41
>>>   #define AST_CAUSE_SWITCH_CONGESTION 42
>>>   #define AST_CAUSE_ACCESS_INFO_DISCARDED 43
>>>   #define AST_CAUSE_REQUESTED_CHAN_UNAVAIL 44
>>>   #define AST_CAUSE_PRE_EMPTED 45
>>>   #define AST_CAUSE_FACILITY_NOT_SUBSCRIBED   50
>>>   #define AST_CAUSE_OUTGOING_CALL_BARRED      52
>>>   #define AST_CAUSE_INCOMING_CALL_BARRED      54
>>>   #define AST_CAUSE_BEARERCAPABILITY_NOTAUTH 57
>>>   #define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL     58
>>>   #define AST_CAUSE_BEARERCAPABILITY_NOTIMPL 65
>>>   #define AST_CAUSE_CHAN_NOT_IMPLEMENTED      66
>>>   #define AST_CAUSE_FACILITY_NOT_IMPLEMENTED      69
>>>   #define AST_CAUSE_INVALID_CALL_REFERENCE 81
>>>   #define AST_CAUSE_INCOMPATIBLE_DESTINATION 88
>>>   #define AST_CAUSE_INVALID_MSG_UNSPECIFIED   95
>>>   #define AST_CAUSE_MANDATORY_IE_MISSING 96
>>>   #define AST_CAUSE_MESSAGE_TYPE_NONEXIST 97
>>>   #define AST_CAUSE_WRONG_MESSAGE 98
>>>   #define AST_CAUSE_IE_NONEXIST 99
>>>   #define AST_CAUSE_INVALID_IE_CONTENTS 100
>>>   #define AST_CAUSE_WRONG_CALL_STATE 101
>>>   #define AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE 102
>>>   #define AST_CAUSE_MANDATORY_IE_LENGTH_ERROR 103
>>>   #define AST_CAUSE_PROTOCOL_ERROR 111
>>>   #define AST_CAUSE_INTERWORKING 127
>>>   /* Special Asterisk aliases */
>>>   #define AST_CAUSE_BUSY  AST_CAUSE_USER_BUSY
>>>   #define AST_CAUSE_FAILURE  AST_CAUSE_NETWORK_OUT_OF_ORDER
>>>   #define AST_CAUSE_NORMAL  AST_CAUSE_NORMAL_CLEARING
>>>   #define AST_CAUSE_NOANSWER   AST_CAUSE_NO_ANSWER
>>>   #define AST_CAUSE_CONGESTION   AST_CAUSE_NORMAL_CIRCUIT_CONGESTION
>>>   #define AST_CAUSE_NOTDEFINED  0
>>>
>>>
>>>
>>> Note: This does not work in 0.7.1 (maybe other versions) See:
>>> http://bugs.digium.com/bug_view_page.php?bug_id=0000890
>>>
>>> Recommended SIP<->  ISDN Cause codes (from RFC3398):
>>>
>>>    ISUP Cause value                        SIP response
>>>    ----------------                        ------------
>>>    1  unallocated number                   404 Not Found
>>>    2  no route to network                  404 Not found
>>>    3  no route to destination              404 Not found
>>>    16 normal call clearing                 --- (*)
>>>    17 user busy                            486 Busy here
>>>    18 no user responding                   408 Request Timeout
>>>    19 no answer from the user              480 Temporarily unavailable
>>>    20 subscriber absent                    480 Temporarily unavailable
>>>    21 call rejected                        403 Forbidden (+)
>>>    22 number changed (w/o diagnostic)      410 Gone
>>>    22 number changed (w/ diagnostic)       301 Moved Permanently
>>>    23 redirection to new destination       410 Gone
>>>    26 non-selected user clearing           404 Not Found (=)
>>>    27 destination out of order             502 Bad Gateway
>>>    28 address incomplete                   484 Address incomplete
>>>
>>>
>>> Zhang Shukun wrote:
>>>> hi , all
>>>>
>>>>       i want to wtite hangupcause to cdr, but both caller hangup and
>>>> callee hangup result in hangupcause code 16.
>>>>
>>>> how would i know whether caller or callee or system error hangup the phone?
>>>>
>>>> please help.
>>>>
>>>> thanks!
>>>>
>>>> 2010/4/22 Alejandro Recarey<alexrecarey at gmail.com>:
>>>>>> However, as I can see by the verbose command, ${HANGUPCAUSE} is always
>>>>>> 0. I thought it was a channel variable that contained the hangupcause?
>>>>>
>>>>> Just an update, if the call is established, then there is a
>>>>> hangupcause received.
>>>>>
>>>>> The above problem only happens if the caller hangs up before pickup.
>>>>>
>>>>> This is usualy a cause 16, not 0.
>>>>>
>>>>> Alex
>>>>>
>>>>> --
>>>>> _____________________________________________________________________
>>>>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>>>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>>>>                 http://www.asterisk.org/hello
>>>>>
>>>>> asterisk-users mailing list
>>>>> To UNSUBSCRIBE or update options visit:
>>>>>     http://lists.digium.com/mailman/listinfo/asterisk-users
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> _____________________________________________________________________
>>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>>                http://www.asterisk.org/hello
>>>
>>> asterisk-users mailing list
>>> To UNSUBSCRIBE or update options visit:
>>>    http://lists.digium.com/mailman/listinfo/asterisk-users
>>>
>>
>>
>>
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
Thanks for your supporting,
have a nice day.
Sucan



More information about the asterisk-users mailing list