[layer23] Fixed call reference for incomming calls. (mobile terminated)
authorAndreas.Eversberg <jolly@eversberg.eu>
Thu, 15 Jul 2010 12:22:24 +0000 (12:22 +0000)
committerAndreas.Eversberg <jolly@eversberg.eu>
Thu, 15 Jul 2010 12:22:24 +0000 (12:22 +0000)
src/host/layer23/src/gsm48_mm.c
src/host/layer23/src/mnccms.c
src/host/layer23/src/transaction.c

index 58bd86c..c1e8fe7 100644 (file)
@@ -1281,12 +1281,12 @@ static const char *gsm48_mmxx_state_names[] = {
        "REESTPEND"
 };
 
-uint32_t mm_conn_new_ref = 1;
+uint32_t mm_conn_new_ref = 0x80000001;
 
 /* new MM connection state */
 static void new_conn_state(struct gsm48_mm_conn *conn, int state)
 {
-       LOGP(DMM, LOGL_INFO, "(ref %d) new state %s -> %s\n", conn->ref,
+       LOGP(DMM, LOGL_INFO, "(ref %x) new state %s -> %s\n", conn->ref,
                gsm48_mmxx_state_names[conn->state],
                gsm48_mmxx_state_names[state]);
        conn->state = state;
@@ -3241,7 +3241,7 @@ static int gsm48_mm_data(struct osmocom_ms *ms, struct msgb *msg)
        conn = mm_conn_by_ref(mm, mmh->ref);
        if (!conn) {
                LOGP(DMM, LOGL_INFO, "MMXX_DATA_REQ with unknown (already "
-                       "released) ref=%d, sending MMXX_REL_IND\n", mmh->ref);
+                       "released) ref=%x, sending MMXX_REL_IND\n", mmh->ref);
                switch(msg_type & GSM48_MMXX_MASK) {
                case GSM48_MMCC_CLASS:
                        mmh->msg_type = GSM48_MMCC_REL_IND;
@@ -3544,7 +3544,7 @@ int gsm48_mmxx_downmsg(struct osmocom_ms *ms, struct msgb *msg)
        if (mm->state == GSM48_MM_ST_MM_IDLE)
                LOGP(DMM, LOGL_INFO, "-> substate %s\n",
                        gsm48_mm_substate_names[mm->substate]);
-       LOGP(DMM, LOGL_INFO, "-> callref %d, transaction_id %d\n",
+       LOGP(DMM, LOGL_INFO, "-> callref %x, transaction_id %d\n",
                mmh->ref, mmh->transaction_id);
 
        /* Find function for current state and message */
index 57830db..ec2625d 100644 (file)
@@ -33,7 +33,7 @@
 #include <osmocom/vty.h>
 
 void *l23_ctx;
-static int new_callref = 1;
+static uint32_t new_callref = 1;
 static LLIST_HEAD(call_list);
 
 /*
@@ -101,7 +101,7 @@ int mncc_recv_mobile(struct osmocom_ms *ms, int msg_type, void *arg)
        /* call does not exist */
        if (!call && msg_type != MNCC_SETUP_IND) {
                LOGP(DMNCC, LOGL_INFO, "Rejecting incomming call "
-                       "(callref %d)\n", data->callref);
+                       "(callref %x)\n", data->callref);
                if (msg_type == MNCC_REL_IND || msg_type == MNCC_REL_CNF)
                        return 0;
                cause = GSM48_CC_CAUSE_INCOMPAT_DEST;
@@ -119,7 +119,7 @@ int mncc_recv_mobile(struct osmocom_ms *ms, int msg_type, void *arg)
                call = talloc_zero(l23_ctx, struct gsm_call);
                if (!call)
                        return -ENOMEM;
-               call->callref = new_callref++;
+               call->callref = data->callref;
                llist_add_tail(&call->entry, &call_list);
        }
 
@@ -221,17 +221,19 @@ int mncc_recv_mobile(struct osmocom_ms *ms, int msg_type, void *arg)
                }
                /* presentation allowed if present == 0 */
                if (data->calling.present || !data->calling.number[0])
-                       vty_notify(ms, "Incomming call\n");
+                       vty_notify(ms, "Incomming call (callref %x)\n",
+                               call->callref);
                else if (data->calling.type == 1)
-                       vty_notify(ms, "Incomming call from +%s\n",
-                               data->calling.number);
+                       vty_notify(ms, "Incomming call from +%s (callref %x)\n",
+                               data->calling.number, call->callref);
                else if (data->calling.type == 2)
-                       vty_notify(ms, "Incomming call from 0-%s\n",
-                               data->calling.number);
+                       vty_notify(ms, "Incomming call from 0-%s (callref "
+                               "%x)\n", data->calling.number, call->callref);
                else
-                       vty_notify(ms, "Incomming call from %s\n",
-                               data->calling.number);
-               LOGP(DMNCC, LOGL_INFO, "Incomming call\n");
+                       vty_notify(ms, "Incomming call from %s (callref %x)\n",
+                               data->calling.number, call->callref);
+               LOGP(DMNCC, LOGL_INFO, "Incomming call (callref %x)\n",
+                       call->callref);
                memset(&mncc, 0, sizeof(struct gsm_mncc));
                mncc.callref = call->callref;
                mncc_send(ms, MNCC_CALL_CONF_REQ, &mncc);
index fbce57b..59ec17b 100644 (file)
@@ -69,8 +69,8 @@ struct gsm_trans *trans_alloc(struct osmocom_ms *ms,
        if (!trans)
                return NULL;
 
-       DEBUGP(DCC, "ms %s allocetes transaction (proto %d trans_id %d "
-               "callref %d mem %p)\n", ms->name, protocol, trans_id, callref,
+       DEBUGP(DCC, "ms %s allocates transaction (proto %d trans_id %d "
+               "callref %x mem %p)\n", ms->name, protocol, trans_id, callref,
                trans);
 
        trans->ms = ms;