keith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-sip-connector/+/14996


Change subject: Add support for MNCC HOLD/RETRIEVE
......................................................................

Add support for MNCC HOLD/RETRIEVE

Handle MO hold and retrieve and pass this to the SIP side.

Handle the 200 from the SIP side in response to our HOLD-ing re-INVITE.

With this commit we now handle MO hold and therefore also handle
call-waiting and swapping.

Change-Id: Ife7bdab20cde92b7ce550215bab28b36a0f302e9
---
M src/mncc.c
M src/sip.c
2 files changed, 37 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sip-connector 
refs/changes/96/14996/1

diff --git a/src/mncc.c b/src/mncc.c
index ab2bed6..3f93126 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -669,14 +669,39 @@
 {
        const struct gsm_mncc *data;
        struct mncc_call_leg *leg;
+       struct call_leg *other_leg;

        leg = find_leg(conn, buf, rc, &data);
        if (!leg)
                return;

        LOGP(DMNCC, LOGL_DEBUG,
-               "leg(%u) is req hold. rejecting.\n", leg->callref);
-       mncc_send(leg->conn, MNCC_HOLD_REJ, leg->callref);
+               "leg(%u) is req hold.\n", leg->callref);
+       other_leg = call_leg_other(&leg->base);
+       other_leg->hold_call(other_leg);
+       mncc_send(leg->conn, MNCC_HOLD_CNF, leg->callref);
+       leg->state = MNCC_CC_HOLD;
+}
+
+static void check_retrieve_ind(struct mncc_connection *conn, const char *buf, 
int rc)
+{
+       const struct gsm_mncc *data;
+       struct mncc_call_leg *leg;
+       struct call_leg *other_leg;
+
+       leg = find_leg(conn, buf, rc, &data);
+       if (!leg)
+               return;
+
+       LOGP(DMNCC, LOGL_DEBUG,
+               "leg(%u) is req unhold.\n", leg->callref);
+       other_leg = call_leg_other(&leg->base);
+       other_leg->retrieve_call(other_leg);
+       mncc_send(leg->conn, MNCC_RETRIEVE_CNF, leg->callref);
+       // In case of call waiting/swap, At this point we need to tell the BTS 
to send audio to
+       // the port of the original call
+       leg->state = MNCC_CC_CONNECTED;
+       send_rtp_connect(leg, other_leg);
 }

 static void check_stp_cnf(struct mncc_connection *conn, const char *buf, int 
rc)
@@ -919,6 +944,9 @@
        case MNCC_HOLD_IND:
                check_hold_ind(conn, buf, rc);
                break;
+       case MNCC_RETRIEVE_IND:
+               check_retrieve_ind(conn, buf, rc);
+               break;
        case MNCC_START_DTMF_IND:
                check_dtmf_start(conn, buf, rc);
                break;
diff --git a/src/sip.c b/src/sip.c
index 6507486..236c332 100644
--- a/src/sip.c
+++ b/src/sip.c
@@ -287,8 +287,13 @@

                if (status == 180 || status == 183)
                        call_progress(leg, sip, status);
-               else if (status == 200)
-                       call_connect(leg, sip);
+               else if (status == 200) {
+                       struct sip_call_leg *leg = sip_find_leg(nh);
+                       if (leg)
+                               nua_ack(leg->nua_handle, TAG_END());
+                       else
+                               call_connect(leg, sip);
+               }
                else if (status >= 300) {
                        struct call_leg *other = call_leg_other(&leg->base);


--
To view, visit https://gerrit.osmocom.org/c/osmo-sip-connector/+/14996
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: Ife7bdab20cde92b7ce550215bab28b36a0f302e9
Gerrit-Change-Number: 14996
Gerrit-PatchSet: 1
Gerrit-Owner: keith <ke...@rhizomatica.org>
Gerrit-MessageType: newchange

Reply via email to