[asterisk-dev] SIP disconnect code

Greg Varga gvarga at bvcompuworks.com
Mon Jul 21 12:25:17 CDT 2008


Tim Ringenbach wrote:
> On Sat, Jul 19, 2008 at 5:46 PM, Carles Pina i Estany <carles at pina.cat> wrote:
>   
>> hangup_sip2cause function could give the same HANGUPCAUSE for more
>> than one SIP disconnect reason, like in the trunk version 481 and 482
>> SIP codes will return AST_CAUSE_INTERWORKING (defined in
>> include/asterisk/causes.h, Q.931 disconnect codes).
>>
>> Because sometimes I need to know the SIP disconnect code, I don't see
>> any reason that we don't have a SIPHANGUPCAUSE with the SIP reason (404,
>> 604, etc.) so I'm thinking to implement and send the patch.
>>
>>     
>
> I would be interested in this, and I wouldln't mind having the message
> set in another variable too.
>
> Someone mentioned it wouldn't make sense if multiple outbound channels
> were called at once. What does asterisk do with HANGUPCAUSE now if
> there are multiple outbound calls?
>
> I disagree with the idea that it violates the protocol neutral design.
> IMO, one needs to provider both a HANGUPCAUSE and a
> TECHxxxHANGUPCAUSE. Then you can recommend that things rely on
> HANGUPCAUSE, but the power to access exactly what happened isn't lost
> and can be used for those special cases that need it.
>
> --Tim
>   

I agree, we have the problem already with the HANGUPCAUSE not being for 
all channels dialed.

You can implement a fix by either using functions, or by using hash's 
(associated array) to hold the information of each dialed channel. 
Something like:


Return a list of dialed extensions:
Funtion: HANGUPLIST
Hash: HASHKEYS(HANGUPCAUSE) and HASHKEYS(HANGUPCAUSETEXT)

Return the hangup cause code:
Function: HANGUPCAUSE(<channel>)
Hash: HASH(HANGUPCAUSE|<channel>)

Return the hangup cause free form text:
Function: HANGUPCAUSETEXT(<channel>)
Hash: HASH(HANGUPCAUSETEXT|<channel>)

Personally I think the Function is better... You can also implement it 
so that if you don't pass the <channel> that it will act as the old 
HANGUPCAUSE does, and gets just one code from the list.

--Greg

-- 
----------------------------------------------------------------------
Greg Varga
Systems Engineer & Architecture

[ LPIC-1&2 | CCNA | MCSE | MCSA | VCP-3 ]
[ VoIP Specialist | Virtualization Specialist ]

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

This communication contains confidential information intended only 
for the person to whom it is addressed.  Any unauthorized disclosure, 
copying, other distribution of this communication or taking any action 
on its contents is strictly prohibited. If you have received this 
message in error, please notify immediately and delete this message 
without reading, copying or forwarding it to anyone.





More information about the asterisk-dev mailing list