From 3779fd30346734e0a26ee192ec7297c68ef48a62 Mon Sep 17 00:00:00 2001 From: Dennis Grunert Date: Wed, 10 Jan 2024 17:57:50 +0100 Subject: [PATCH] Handling of unknown facility indications from terminals --- src/isdn/dss1.c | 131 +++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 64 deletions(-) diff --git a/src/isdn/dss1.c b/src/isdn/dss1.c index 1272d4c..491e963 100644 --- a/src/isdn/dss1.c +++ b/src/isdn/dss1.c @@ -1323,80 +1323,83 @@ void facility_ind(call_t *call, uint32_t pid, struct l3_msg *l3m) set_3pty = 0; break; default: - ; + LOGP(DDSS1, LOGL_DEBUG, "Facility Operation=%x of Component=%x not implemented\n", fac.u.inv.operationValue, fac.comp); + break; } break; default: - ; + LOGP(DDSS1, LOGL_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 { + LOGP(DDSS1, LOGL_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 { - LOGP(DDSS1, LOGL_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); + } } }