On 29/08/13 14:42, Olivier wrote:
Thanks for your very helpful reply.

1.My system prints out:
CLI> core show application Hangup

  -= Info about application 'Hangup' =-

[Synopsis]
Hang up the calling channel.

[Description]
This application will hang up the calling channel.

[Syntax]
Hangup([causecode])

[Arguments]
causecode
    If a <causecode> is given the channel's hangup cause will be set
    to the given value.

[See Also]
Answer(), Busy(), Congestion()

How could we improve this Arguments section so that other Asterisk admins can find available <causecode> values ?


Have a look in the source code in channels/chan_sip.c and you will see :-

const char *hangup_cause2sip(int cause)
{
        switch (cause) {
                case AST_CAUSE_UNALLOCATED:             /* 1 */
case AST_CAUSE_NO_ROUTE_DESTINATION: /* 3 IAX2: Can't find extension in context */
                case AST_CAUSE_NO_ROUTE_TRANSIT_NET:    /* 2 */
                        return "404 Not Found";
                case AST_CAUSE_CONGESTION:              /* 34 */
                case AST_CAUSE_SWITCH_CONGESTION:       /* 42 */
                        return "503 Service Unavailable";
                case AST_CAUSE_NO_USER_RESPONSE:        /* 18 */
                        return "408 Request Timeout";
                case AST_CAUSE_NO_ANSWER:               /* 19 */
                case AST_CAUSE_UNREGISTERED:        /* 20 */
                        return "480 Temporarily unavailable";
                case AST_CAUSE_CALL_REJECTED:           /* 21 */
                        return "403 Forbidden";
                case AST_CAUSE_NUMBER_CHANGED:          /* 22 */
                        return "410 Gone";
                case AST_CAUSE_NORMAL_UNSPECIFIED:      /* 31 */
                        return "480 Temporarily unavailable";
                case AST_CAUSE_INVALID_NUMBER_FORMAT:
                        return "484 Address incomplete";
                case AST_CAUSE_USER_BUSY:
                        return "486 Busy here";
                case AST_CAUSE_FAILURE:
                        return "500 Server internal failure";
                case AST_CAUSE_FACILITY_REJECTED:       /* 29 */
                        return "501 Not Implemented";
                case AST_CAUSE_CHAN_NOT_IMPLEMENTED:
                        return "503 Service Unavailable";
                /* Used in chan_iax2 */
                case AST_CAUSE_DESTINATION_OUT_OF_ORDER:
                        return "502 Bad Gateway";
case AST_CAUSE_BEARERCAPABILITY_NOTAVAIL: /* Can't find codec to connect to host */
                        return "488 Not Acceptable Here";
case AST_CAUSE_INTERWORKING: /* Unspecified Interworking issues */
                        return "500 Network error";

                case AST_CAUSE_NOTDEFINED:
                default:
ast_debug(1, "AST hangup cause %d (no match found in SIP)\n", cause);
                        return NULL;
        }

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

So if you change chan_sip.c and add the following just before the 'AST_CAUSE_NOTDEFINED' line and recompile and reinstall you should in theory be able to do a Hangup(44) to achieve what you want.

                case AST_CAUSE_REQUESTED_CHAN_UNAVAIL:    /* 44 */
                        return "480 Temporarily Unavailable (Call limit)";

Thats only in theory. I havent tested it myself and I am not an asterisk developer.

--
_____________________________________________________________________
-- 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

Reply via email to