diff --git a/src/sip_attr.c b/src/sip_attr.c index cba43f6..a8e0f5b 100644 --- a/src/sip_attr.c +++ b/src/sip_attr.c @@ -165,5 +165,9 @@ sip_attr_color_state(const char *value) return COLOR_PAIR(CP_RED_ON_DEF); if (!strcmp(value, call_state_to_str(SIP_CALLSTATE_REJECTED))) return COLOR_PAIR(CP_RED_ON_DEF); + if (!strcmp(value, call_state_to_str(SIP_CALLSTATE_BUSY))) + return COLOR_PAIR(CP_MAGENTA_ON_DEF); + if (!strcmp(value, call_state_to_str(SIP_CALLSTATE_DIVERTED))) + return COLOR_PAIR(CP_CYAN_ON_DEF); return 0; } diff --git a/src/sip_call.c b/src/sip_call.c index 1017f1e..dffa380 100644 --- a/src/sip_call.c +++ b/src/sip_call.c @@ -218,9 +218,15 @@ call_update_state(sip_call_t *call, sip_msg_t *msg) } else if (reqresp == SIP_METHOD_CANCEL) { // Alice is not in the mood call->state = SIP_CALLSTATE_CANCELLED; + } else if ((reqresp == 480) || (reqresp == 486)) { + // Bob is busy + call->state = SIP_CALLSTATE_BUSY; } else if (reqresp > 400 && call->invitecseq == msg->cseq) { // Bob is not in the mood call->state = SIP_CALLSTATE_REJECTED; + } else if (reqresp > 300) { + // Bob has diversion + call->state = SIP_CALLSTATE_DIVERTED; } } else if (call->state == SIP_CALLSTATE_INCALL) { if (reqresp == SIP_METHOD_BYE) { @@ -306,6 +312,10 @@ call_state_to_str(int state) return "CANCELLED"; case SIP_CALLSTATE_REJECTED: return "REJECTED"; + case SIP_CALLSTATE_BUSY: + return "BUSY"; + case SIP_CALLSTATE_DIVERTED: + return "DIVERTED"; case SIP_CALLSTATE_COMPLETED: return "COMPLETED"; } diff --git a/src/sip_call.h b/src/sip_call.h index f1e90b3..664eefa 100644 --- a/src/sip_call.h +++ b/src/sip_call.h @@ -47,6 +47,8 @@ enum call_state SIP_CALLSTATE_INCALL, SIP_CALLSTATE_CANCELLED, SIP_CALLSTATE_REJECTED, + SIP_CALLSTATE_DIVERTED, + SIP_CALLSTATE_BUSY, SIP_CALLSTATE_COMPLETED };