From 089a012b06122689b950905d36ce0dfa52c665fe Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sat, 20 Mar 2021 11:24:57 +0100 Subject: [PATCH] libmobile: Do not send 'proceeding', if call gets answered right after 'setup' --- src/libmobile/call.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/libmobile/call.c b/src/libmobile/call.c index 3ea1631..f7db1f8 100644 --- a/src/libmobile/call.c +++ b/src/libmobile/call.c @@ -451,7 +451,7 @@ static void indicate_alerting(int callref) osmo_cc_ll_msg(ep, callref, msg); } -static void indicate_answer(int callref, const char *connectid) +static void indicate_answer(int callref, const char *sdp, const char *connectid) { osmo_cc_msg_t *msg; @@ -460,6 +460,10 @@ static void indicate_answer(int callref, const char *connectid) if (connectid && connectid[0]) osmo_cc_add_ie_calling(msg, OSMO_CC_TYPE_SUBSCRIBER, OSMO_CC_PLAN_TELEPHONY, OSMO_CC_PRESENT_ALLOWED, OSMO_CC_SCREEN_NETWORK, connectid); + /* sdp */ + if (sdp) + osmo_cc_add_ie_sdp(msg, sdp); + PDEBUG(DCALL, DEBUG_INFO, "Indicate OSMO-CC answer towards fixed network\n"); osmo_cc_ll_msg(ep, callref, msg); } @@ -543,7 +547,7 @@ void call_up_answer(int callref, const char *connect_id) PDEBUG(DCALL, DEBUG_INFO, "Call has been answered by '%s'\n", connect_id); if (!connect_on_setup) - indicate_answer(callref, connect_id); + indicate_answer(callref, NULL, connect_id); set_pattern_process(callref, PATTERN_NONE); new_state_process(callref, PROCESS_CONNECT); } @@ -734,28 +738,24 @@ void ll_msg_cb(osmo_cc_endpoint_t __attribute__((unused)) *ep, uint32_t callref, if (rc < 0) number[0] = '\0'; PDEBUG(DCALL, DEBUG_INFO, "Received OSMO-CC call from fixed network '%s' to mobile '%s'\n", caller_id, number); - indicate_proceeding(callref, sdp); + if (!connect_on_setup) + indicate_proceeding(callref, sdp); + else { + PDEBUG(DCALL, DEBUG_DEBUG, "Early connecting after setup\n"); + indicate_answer(callref, sdp, number); + } PDEBUG(DCALL, DEBUG_INFO, "Outgoing call from '%s' to '%s'\n", caller_id, number); rc = call_down_setup(callref, caller_id, caller_type, number); if (rc < 0) { PDEBUG(DCALL, DEBUG_NOTICE, "Call rejected, cause %d\n", -rc); - if (connect_on_setup) { - PDEBUG(DCALL, DEBUG_DEBUG, "Early connecting after setup\n"); - indicate_answer(callref, number); - } else { + if (!connect_on_setup) { PDEBUG(DCALL, DEBUG_INFO, "Disconnecting OSMO-CC call towards fixed network (cause=%d)\n", -rc); indicate_disconnect_release(callref, -rc, OSMO_CC_MSG_DISC_IND); } disconnect_process(callref, -rc); break; } - - if (connect_on_setup) { - PDEBUG(DCALL, DEBUG_DEBUG, "Early connecting after setup\n"); - indicate_answer(callref, number); - break; - } break; } case OSMO_CC_MSG_SETUP_ACK_REQ: