forked from Mirrors/sngrep
Add callstate (and color) for busy and diverted calls.
Diverted calls were shown as in call and busy calls as rejected.
This commit is contained in:
parent
93246b8bfc
commit
39c2484651
|
@ -165,5 +165,9 @@ sip_attr_color_state(const char *value)
|
||||||
return COLOR_PAIR(CP_RED_ON_DEF);
|
return COLOR_PAIR(CP_RED_ON_DEF);
|
||||||
if (!strcmp(value, call_state_to_str(SIP_CALLSTATE_REJECTED)))
|
if (!strcmp(value, call_state_to_str(SIP_CALLSTATE_REJECTED)))
|
||||||
return COLOR_PAIR(CP_RED_ON_DEF);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,9 +218,15 @@ call_update_state(sip_call_t *call, sip_msg_t *msg)
|
||||||
} else if (reqresp == SIP_METHOD_CANCEL) {
|
} else if (reqresp == SIP_METHOD_CANCEL) {
|
||||||
// Alice is not in the mood
|
// Alice is not in the mood
|
||||||
call->state = SIP_CALLSTATE_CANCELLED;
|
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) {
|
} else if (reqresp > 400 && call->invitecseq == msg->cseq) {
|
||||||
// Bob is not in the mood
|
// Bob is not in the mood
|
||||||
call->state = SIP_CALLSTATE_REJECTED;
|
call->state = SIP_CALLSTATE_REJECTED;
|
||||||
|
} else if (reqresp > 300) {
|
||||||
|
// Bob has diversion
|
||||||
|
call->state = SIP_CALLSTATE_DIVERTED;
|
||||||
}
|
}
|
||||||
} else if (call->state == SIP_CALLSTATE_INCALL) {
|
} else if (call->state == SIP_CALLSTATE_INCALL) {
|
||||||
if (reqresp == SIP_METHOD_BYE) {
|
if (reqresp == SIP_METHOD_BYE) {
|
||||||
|
@ -306,6 +312,10 @@ call_state_to_str(int state)
|
||||||
return "CANCELLED";
|
return "CANCELLED";
|
||||||
case SIP_CALLSTATE_REJECTED:
|
case SIP_CALLSTATE_REJECTED:
|
||||||
return "REJECTED";
|
return "REJECTED";
|
||||||
|
case SIP_CALLSTATE_BUSY:
|
||||||
|
return "BUSY";
|
||||||
|
case SIP_CALLSTATE_DIVERTED:
|
||||||
|
return "DIVERTED";
|
||||||
case SIP_CALLSTATE_COMPLETED:
|
case SIP_CALLSTATE_COMPLETED:
|
||||||
return "COMPLETED";
|
return "COMPLETED";
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,8 @@ enum call_state
|
||||||
SIP_CALLSTATE_INCALL,
|
SIP_CALLSTATE_INCALL,
|
||||||
SIP_CALLSTATE_CANCELLED,
|
SIP_CALLSTATE_CANCELLED,
|
||||||
SIP_CALLSTATE_REJECTED,
|
SIP_CALLSTATE_REJECTED,
|
||||||
|
SIP_CALLSTATE_DIVERTED,
|
||||||
|
SIP_CALLSTATE_BUSY,
|
||||||
SIP_CALLSTATE_COMPLETED
|
SIP_CALLSTATE_COMPLETED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue