From ec8ba33b23ca098ed9d88613615bd044b1526321 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 24 Mar 2016 18:48:45 +0100 Subject: [PATCH] mncc: In case of an unexpected REL.IND inform the other leg about it I had modified my code to do nothing after having sent the PROCEEDING message. First the MS will issue a DISCONNECT.IND (which I ignored) and then there will be REL.IND. Let's inform the other leg about this event and let's assume the call will then be terminated. --- src/call.c | 12 ++++++++++++ src/call.h | 1 + src/mncc.c | 8 +++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/call.c b/src/call.c index d9ca66e..48281a1 100644 --- a/src/call.c +++ b/src/call.c @@ -78,3 +78,15 @@ struct call *sip_call_mncc_create(void) llist_add(&call->entry, &g_call_list); return call; } + +struct call_leg *call_leg_other(struct call_leg *leg) +{ + if (leg->call->initial == leg) + return leg->call->remote; + if (leg->call->remote == leg) + return leg->call->initial; + + LOGP(DAPP, LOGL_NOTICE, "leg(0x%p) not belonging to call(%u)\n", + leg, leg->call->id); + return NULL; +} diff --git a/src/call.h b/src/call.h index dc82f97..102c366 100644 --- a/src/call.h +++ b/src/call.h @@ -81,6 +81,7 @@ struct mncc_call_leg { extern struct llist_head g_call_list; void calls_init(void); +struct call_leg *call_leg_other(struct call_leg *leg); void call_leg_release(struct call_leg *leg); diff --git a/src/mncc.c b/src/mncc.c index a44ecad..406f32d 100644 --- a/src/mncc.c +++ b/src/mncc.c @@ -315,8 +315,14 @@ static void check_rel_ind(struct mncc_connection *conn, char *buf, int rc) if (leg->base.in_release) stop_cmd_timer(leg, MNCC_REL_IND); + else { + struct call_leg *other_leg; + other_leg = call_leg_other(&leg->base); + if (other_leg) + other_leg->release_call(other_leg); + } LOGP(DMNCC, LOGL_DEBUG, "leg(%u) was released.\n", data->callref); - call_leg_release(leg); + call_leg_release(&leg->base); } static void check_hello(struct mncc_connection *conn, char *buf, int rc)