Handling of unknown facility indications from terminals

This commit is contained in:
Dennis Grunert 2024-01-10 17:57:50 +01:00
parent 80864347f3
commit 932f64877d
1 changed files with 67 additions and 64 deletions

View File

@ -1324,80 +1324,83 @@ void facility_ind(call_t *call, uint32_t pid, struct l3_msg *l3m)
set_3pty = 0;
break;
default:
;
PDEBUG(DDSS1, DEBUG_DEBUG, "Facility Operation=%x of Component=%x not implemented\n", fac.u.inv.operationValue, fac.comp);
break;
}
break;
default:
;
PDEBUG(DDSS1, DEBUG_DEBUG, "Facility Operation=%x of Component=%x not implemented\n", fac.u.inv.operationValue, fac.comp);
break;
}
/* find other terminal on hold */
other = call->isdn_ep->call_list;
while (other) {
// printf("check: call=%p other=%p call_ces=%x other_ces=%x other_hold=%d\n", call, other, call->l3_ces, other->l3_ces, other->hold);
if (other != call
&& other->l3_ces == call->l3_ces) {
/* if we got facility on active call */
if (other->hold && !call->hold)
break;
/* if we got facility on active call */
if (!other->hold && call->hold)
break;
if(set_3pty >= 0) {
/* find other terminal on hold */
other = call->isdn_ep->call_list;
while (other) {
// printf("check: call=%p other=%p call_ces=%x other_ces=%x other_hold=%d\n", call, other, call->l3_ces, other->l3_ces, other->hold);
if (other != call
&& other->l3_ces == call->l3_ces) {
/* if we got facility on active call */
if (other->hold && !call->hold)
break;
/* if we got facility on active call */
if (!other->hold && call->hold)
break;
}
other = other->next;
}
if (other) {
other->conference_3pty = call->conference_3pty = set_3pty;
/* process local briding capability */
bridge_socket_client_update(call, 0);
bridge_socket_client_update(other, 0);
jitter_reset(&call->conf_dejitter);
jitter_reset(&call->tx_dejitter);
jitter_reset(&other->conf_dejitter);
jitter_reset(&other->tx_dejitter);
} else {
PDEBUG(DDSS1, DEBUG_NOTICE, "Phone requests conference, but no call on hold!\n");
notify = 0;
}
other = other->next;
}
if (set_3pty >= 0 && other) {
other->conference_3pty = call->conference_3pty = set_3pty;
/* process local briding capability */
bridge_socket_client_update(call, 0);
bridge_socket_client_update(other, 0);
jitter_reset(&call->conf_dejitter);
jitter_reset(&call->tx_dejitter);
jitter_reset(&other->conf_dejitter);
jitter_reset(&other->tx_dejitter);
} else {
PDEBUG(DDSS1, DEBUG_NOTICE, "Phone requests conference, but no call on hold!\n");
notify = 0;
}
/* encode 3PTY facility */
memset(&fac, 0, sizeof(fac));
fac.Valid = 1;
if (notify) {
fac.comp = CompReturnResult;
fac.u.retResult.invokeId = invokeid;
fac.u.retResult.operationValuePresent = 1;
if (notify == OSMO_CC_NOTIFY_CONFERENCE_ESTABLISHED)
fac.u.retResult.operationValue = Fac_Begin3PTY;
if (notify == OSMO_CC_NOTIFY_CONFERENCE_DISCONNECTED)
fac.u.retResult.operationValue = Fac_End3PTY;
} else {
fac.comp = CompReturnError;
fac.u.retError.invokeId = invokeid;
fac.u.retError.errorValue = FacError_Gen_InvalidCallState;
}
encodeFac(fac_ie, &fac);
/* encode 3PTY facility */
memset(&fac, 0, sizeof(fac));
fac.Valid = 1;
if (notify) {
fac.comp = CompReturnResult;
fac.u.retResult.invokeId = invokeid;
fac.u.retResult.operationValuePresent = 1;
if (notify == OSMO_CC_NOTIFY_CONFERENCE_ESTABLISHED)
fac.u.retResult.operationValue = Fac_Begin3PTY;
if (notify == OSMO_CC_NOTIFY_CONFERENCE_DISCONNECTED)
fac.u.retResult.operationValue = Fac_End3PTY;
} else {
fac.comp = CompReturnError;
fac.u.retError.invokeId = invokeid;
fac.u.retError.errorValue = FacError_Gen_InvalidCallState;
}
encodeFac(fac_ie, &fac);
/* sending facility */
l3m = create_l3msg();
enc_ie_facility(l3m, fac_ie + 2, fac_ie[1]);
call->isdn_ep->ml3->to_layer3(call->isdn_ep->ml3, MT_FACILITY, call->l3_pid, l3m);
/* sending facility */
l3m = create_l3msg();
enc_ie_facility(l3m, fac_ie + 2, fac_ie[1]);
call->isdn_ep->ml3->to_layer3(call->isdn_ep->ml3, MT_FACILITY, call->l3_pid, l3m);
if (notify) {
/* create osmo-cc message */
msg = osmo_cc_new_msg(OSMO_CC_MSG_NOTIFY_IND);
/* notify the facility */
osmo_cc_add_ie_notify(msg, notify);
/* send message to osmo-cc */
osmo_cc_ll_msg(&call->isdn_ep->cc_ep, call->cc_callref, msg);
if (notify) {
/* create osmo-cc message */
msg = osmo_cc_new_msg(OSMO_CC_MSG_NOTIFY_IND);
/* notify the facility */
osmo_cc_add_ie_notify(msg, notify);
/* send message to osmo-cc */
osmo_cc_ll_msg(&call->isdn_ep->cc_ep, call->cc_callref, msg);
/* create osmo-cc message */
msg = osmo_cc_new_msg(OSMO_CC_MSG_NOTIFY_IND);
/* notify the facility */
osmo_cc_add_ie_notify(msg, notify);
/* send message to osmo-cc */
osmo_cc_ll_msg(&other->isdn_ep->cc_ep, call->cc_callref, msg);
/* create osmo-cc message */
msg = osmo_cc_new_msg(OSMO_CC_MSG_NOTIFY_IND);
/* notify the facility */
osmo_cc_add_ie_notify(msg, notify);
/* send message to osmo-cc */
osmo_cc_ll_msg(&other->isdn_ep->cc_ep, call->cc_callref, msg);
}
}
}