FS-11824 [sofia-sip,mod_sofia,core] Added cause codes that map to SIP 600,603,604,606,607

This commit is contained in:
Chris Rienzo 2019-04-30 23:26:41 +00:00 committed by Mike Jerris
parent 552d3d8b02
commit 0a6d87edfe
7 changed files with 36 additions and 1 deletions

View File

@ -104,6 +104,7 @@ char const
sip_603_Decline[] = "Decline",
sip_604_Does_not_exist_anywhere[] = "Does Not Exist Anywhere",
sip_606_Not_acceptable[] = "Not Acceptable",
sip_607_Unwanted[] = "Unwanted",
sip_687_Dialog_terminated[] = "Dialog Terminated"
;
@ -191,6 +192,7 @@ char const *sip_status_phrase(int status)
case 603: return sip_603_Decline;
case 604: return sip_604_Does_not_exist_anywhere;
case 606: return sip_606_Not_acceptable;
case 607: return sip_607_Unwanted;
case 687: return sip_687_Dialog_terminated;
}

View File

@ -1422,6 +1422,15 @@ int sip_response_terminates_dialog(int response_code,
*/
*return_graceful_terminate_usage = 0;
return 0;
case 607: /** @par 607 Unwanted
This response is similar to 603, except it informs the caller
that the call is unwanted and may be blacklisted. Added by
RFC-8197
*/
*return_graceful_terminate_usage = 0;
return 0;
}
/* Do not change graceful_terminate */

View File

@ -169,6 +169,8 @@ SOFIAPUBFUN char const *sip_status_phrase(int status);
#define SIP_604_DOES_NOT_EXIST_ANYWHERE 604, sip_604_Does_not_exist_anywhere
/** 606 Not Acceptable @HIDE */
#define SIP_606_NOT_ACCEPTABLE 606, sip_606_Not_acceptable
/** 607 Unwanted @HIDE */
#define SIP_607_UNWANTED 607, sip_607_Unwanted
/** 687 Dialog terminated @HIDE */
#define SIP_687_DIALOG_TERMINATED 687, sip_687_Dialog_terminated
@ -238,6 +240,7 @@ SOFIAPUBVAR char const sip_600_Busy_everywhere[];
SOFIAPUBVAR char const sip_603_Decline[];
SOFIAPUBVAR char const sip_604_Does_not_exist_anywhere[];
SOFIAPUBVAR char const sip_606_Not_acceptable[];
SOFIAPUBVAR char const sip_607_Unwanted[];
SOFIAPUBVAR char const sip_687_Dialog_terminated[];
SOFIA_END_DECLS

View File

@ -1511,6 +1511,7 @@ static int response_phrase_test(void)
{ SIP_603_DECLINE },
{ SIP_604_DOES_NOT_EXIST_ANYWHERE },
{ SIP_606_NOT_ACCEPTABLE },
{ SIP_607_UNWANTED },
{ 0, NULL }
};
int i;

View File

@ -2175,7 +2175,12 @@ typedef enum {
SWITCH_CAUSE_INVALID_PROFILE = 611,
SWITCH_CAUSE_NO_PICKUP = 612,
SWITCH_CAUSE_SRTP_READ_ERROR = 613,
SWITCH_CAUSE_BOWOUT = 614
SWITCH_CAUSE_BOWOUT = 614,
SWITCH_CAUSE_BUSY_EVERYWHERE = 615,
SWITCH_CAUSE_DECLINE = 616,
SWITCH_CAUSE_DOES_NOT_EXIST_ANYWHERE = 617,
SWITCH_CAUSE_NOT_ACCEPTABLE = 618,
SWITCH_CAUSE_UNWANTED = 619
} switch_call_cause_t;
typedef enum {

View File

@ -340,6 +340,17 @@ static int hangup_cause_to_sip(switch_call_cause_t cause)
return 487;
case SWITCH_CAUSE_EXCHANGE_ROUTING_ERROR:
return 483;
/* Custom mappings not part of RFC */
case SWITCH_CAUSE_BUSY_EVERYWHERE:
return 600;
case SWITCH_CAUSE_DECLINE:
return 603;
case SWITCH_CAUSE_DOES_NOT_EXIST_ANYWHERE:
return 604;
case SWITCH_CAUSE_NOT_ACCEPTABLE:
return 606;
case SWITCH_CAUSE_UNWANTED:
return 607;
default:
return 480;
}

View File

@ -125,6 +125,10 @@ static struct switch_cause_table CAUSE_CHART[] = {
{"NO_PICKUP", SWITCH_CAUSE_NO_PICKUP},
{"SRTP_READ_ERROR", SWITCH_CAUSE_SRTP_READ_ERROR},
{"BOWOUT", SWITCH_CAUSE_BOWOUT},
{"BUSY_EVERYWHERE", SWITCH_CAUSE_BUSY_EVERYWHERE},
{"DECLINE", SWITCH_CAUSE_DECLINE},
{"DOES_NOT_EXIST_ANYWHERE", SWITCH_CAUSE_DOES_NOT_EXIST_ANYWHERE},
{"UNWANTED", SWITCH_CAUSE_UNWANTED},
{NULL, 0}
};