[asterisk-users] How to reply with 480 Call-limit to incoming SIP call ?
Matthew Jordan
mjordan at digium.com
Fri Aug 30 07:36:15 CDT 2013
On Thu, Aug 29, 2013 at 9:07 AM, Gareth Blades <
mailinglist+asterisk at dns99.co.uk> wrote:
> 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.
>
>
Also, a table of all of the hangup cause mappings is on the Asterisk wiki:
https://wiki.asterisk.org/wiki/display/AST/Hangup+Cause+Mappings
--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130830/8ccdf8e8/attachment.htm>
More information about the asterisk-users
mailing list