<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On Thu, Aug 29, 2013 at 9:07 AM, Gareth Blades <span dir="ltr">&lt;<a href="mailto:mailinglist+asterisk@dns99.co.uk" target="_blank">mailinglist+asterisk@dns99.co.uk</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div>On 29/08/13 14:42, Olivier wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Thanks for your very helpful reply.<br>
<br>
1.My system prints out:<br>
CLI&gt; core show application Hangup<br>
<br>
  -= Info about application &#39;Hangup&#39; =-<br>
<br>
[Synopsis]<br>
Hang up the calling channel.<br>
<br>
[Description]<br>
This application will hang up the calling channel.<br>
<br>
[Syntax]<br>
Hangup([causecode])<br>
<br>
[Arguments]<br>
causecode<br>
    If a &lt;causecode&gt; is given the channel&#39;s hangup cause will be set<br>
    to the given value.<br>
<br>
[See Also]<br>
Answer(), Busy(), Congestion()<br>
<br>
How could we improve this Arguments section so that other Asterisk admins can find available &lt;causecode&gt; values ?<br>
<br>
</blockquote>
<br></div>
Have a look in the source code in channels/chan_sip.c and you will see :-<br>
<br>
const char *hangup_cause2sip(int cause)<br>
{<br>
        switch (cause) {<br>
                case AST_CAUSE_UNALLOCATED:             /* 1 */<br>
                case AST_CAUSE_NO_ROUTE_<u></u>DESTINATION:    /* 3 IAX2: Can&#39;t find extension in context */<br>
                case AST_CAUSE_NO_ROUTE_TRANSIT_<u></u>NET:    /* 2 */<br>
                        return &quot;404 Not Found&quot;;<br>
                case AST_CAUSE_CONGESTION:              /* 34 */<br>
                case AST_CAUSE_SWITCH_CONGESTION:       /* 42 */<br>
                        return &quot;503 Service Unavailable&quot;;<br>
                case AST_CAUSE_NO_USER_RESPONSE:        /* 18 */<br>
                        return &quot;408 Request Timeout&quot;;<br>
                case AST_CAUSE_NO_ANSWER:               /* 19 */<br>
                case AST_CAUSE_UNREGISTERED:        /* 20 */<br>
                        return &quot;480 Temporarily unavailable&quot;;<br>
                case AST_CAUSE_CALL_REJECTED:           /* 21 */<br>
                        return &quot;403 Forbidden&quot;;<br>
                case AST_CAUSE_NUMBER_CHANGED:          /* 22 */<br>
                        return &quot;410 Gone&quot;;<br>
                case AST_CAUSE_NORMAL_UNSPECIFIED:      /* 31 */<br>
                        return &quot;480 Temporarily unavailable&quot;;<br>
                case AST_CAUSE_INVALID_NUMBER_<u></u>FORMAT:<br>
                        return &quot;484 Address incomplete&quot;;<br>
                case AST_CAUSE_USER_BUSY:<br>
                        return &quot;486 Busy here&quot;;<br>
                case AST_CAUSE_FAILURE:<br>
                        return &quot;500 Server internal failure&quot;;<br>
                case AST_CAUSE_FACILITY_REJECTED:       /* 29 */<br>
                        return &quot;501 Not Implemented&quot;;<br>
                case AST_CAUSE_CHAN_NOT_<u></u>IMPLEMENTED:<br>
                        return &quot;503 Service Unavailable&quot;;<br>
                /* Used in chan_iax2 */<br>
                case AST_CAUSE_DESTINATION_OUT_OF_<u></u>ORDER:<br>
                        return &quot;502 Bad Gateway&quot;;<br>
                case AST_CAUSE_BEARERCAPABILITY_<u></u>NOTAVAIL:       /* Can&#39;t find codec to connect to host */<br>
                        return &quot;488 Not Acceptable Here&quot;;<br>
                case AST_CAUSE_INTERWORKING:    /* Unspecified Interworking issues */<br>
                        return &quot;500 Network error&quot;;<br>
<br>
                case AST_CAUSE_NOTDEFINED:<br>
                default:<br>
                        ast_debug(1, &quot;AST hangup cause %d (no match found in SIP)\n&quot;, cause);<br>
                        return NULL;<br>
        }<br>
<br>
For any given hangup cause you can change the sip response there. For a list of the hangup numbers and the internal variable name look in include/asterisk/causes.h<br>
<br>
So if you change chan_sip.c and add the following just before the &#39;AST_CAUSE_NOTDEFINED&#39; line and recompile and reinstall you should in theory be able to do a Hangup(44) to achieve what you want.<br>
<br>
                case AST_CAUSE_REQUESTED_CHAN_<u></u>UNAVAIL:    /* 44 */<br>
                        return &quot;480 Temporarily Unavailable (Call limit)&quot;;<br>
<br>
Thats only in theory. I havent tested it myself and I am not an asterisk developer.<div><div><br></div></div></blockquote><div><br></div><div style>Also, a table of all of the hangup cause mappings is on the Asterisk wiki:</div>
<div style><br></div><div style><a href="https://wiki.asterisk.org/wiki/display/AST/Hangup+Cause+Mappings">https://wiki.asterisk.org/wiki/display/AST/Hangup+Cause+Mappings</a><br></div><div> </div></div>-- <br><div dir="ltr">
<div>
Matthew Jordan<br></div><div>Digium, Inc. | Engineering Manager</div><div>445 Jan Davis Drive NW - Huntsville, AL 35806 - USA</div><div>Check us out at: <a href="http://digium.com" target="_blank">http://digium.com</a> &amp; <a href="http://asterisk.org" target="_blank">http://asterisk.org</a></div>

</div>
</div></div>