Change cause on call limit rejection

Hi,

The scenario is: I’m calling through Asterisk, which is searching through a few peers for some free resources to pass my call further. There is also call-limit set on some peers, which are searched. When peers reject the call because of no free resources, they give 503 Service unavailable = cause 34, but when call-limit on them is reached, I get 480 Temporarily Unavailable (Call limit) = cause 19, which I would also like to change to 503/34. Is it somehow possible to change 480 response on call-limit to 503? The version of Asterisk is 11.7.0-rc1.

Pass the right code to Hangup(). See cause2sip in the source code for the translation, although they are just ISDN cause codes.

I’m not sure if it is possible just by just passing for example 34 to Hangup() when 19 occurs, as I’m not able to distinguish, if cause 19 is returned because of call-limit, or it is “real” cause 19 as in definition (no answer from user B after long alert), right?..

In chan_sip.c under cause2sip I can see various ISDN-SIP mappings, but no one seems to match the case I need:

case AST_CAUSE_NO_ANSWER: /* 19 */ case AST_CAUSE_UNREGISTERED: /* 20 */ return "480 Temporarily unavailable";
as I receive “480 Temporarily unavailable (Call limit)”, not just “480 Temporarily unavailable”. There is just one occurence of “480 Temporarily Unavailable (Call limit)” in this file, under this section:

/* Check number of concurrent calls -vs- incoming limit HERE */ ast_debug(1, "Checking SIP call limits for device %s\n", p->username); if ((res = update_call_counter(p, INC_CALL_LIMIT))) { if (res < 0) { ast_log(LOG_NOTICE, "Failed to place call for device %s, too many calls\n", p->username); transmit_response_reliable(p, "480 Temporarily Unavailable (Call limit) ", req); sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); p->invitestate = INV_COMPLETED; call_limit_cause = 1; res = AUTH_SESSION_LIMIT; } goto request_invite_cleanup; }
Maybe I should put “503 Service Unavailable” here? :smile: