#include <string.h>
#include <stdlib.h>
-#include <osmocore/msgb.h>
-#include <osmocore/utils.h>
-#include <osmocore/gsm48.h>
-#include <osmocore/talloc.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/utils.h>
+#include <osmocom/gsm/gsm48.h>
+#include <osmocom/core/talloc.h>
#include <osmocom/bb/common/logging.h>
#include <osmocom/bb/common/osmocom_data.h>
void mncc_set_cause(struct gsm_mncc *data, int loc, int val)
{
data->fields |= MNCC_F_CAUSE;
+ data->cause.coding = 0x3;
data->cause.location = loc;
data->cause.value = val;
}
return gsm48_cc_tx_status(trans, GSM48_CC_CAUSE_RESP_STATUS_INQ);
}
+static int gsm48_cc_rx_status(struct gsm_trans *trans, struct msgb *msg)
+{
+ struct gsm48_hdr *gh = msgb_l3(msg);
+ unsigned int payload_len = msgb_l3len(msg) - sizeof(*gh);
+ struct gsm_mncc_cause cause;
+
+ if (payload_len < 1 || payload_len < gh->data[0] + 1) {
+ LOGP(DCC, LOGL_NOTICE, "Short read of status message "
+ "error.\n");
+ return -EINVAL;
+ }
+ gsm48_decode_cause(&cause, gh->data);
+
+ LOGP(DCC, LOGL_INFO, "received STATUS (cause %d)\n", cause.value);
+
+ return 0;
+}
+
/*
* process handlers (mobile originating call establish)
*/
*/
gsm48_start_cc_timer(trans, 0x303, GSM48_T303_MS);
- if (!setup->emergency) {
- /* bearer capability */
+ /* bearer capability (optional for emergency calls only) */
+ if (setup->fields & MNCC_F_BEARER_CAP)
gsm48_encode_bearer_cap(nmsg, 0, &setup->bearer_cap);
+ if (!setup->emergency) {
/* facility */
if (setup->fields & MNCC_F_FACILITY)
gsm48_encode_facility(nmsg, 0, &setup->facility);
struct tlv_parsed tp;
struct gsm_mncc alerting;
- LOGP(DCC, LOGL_INFO, "sending ALERTING\n");
+ LOGP(DCC, LOGL_INFO, "received ALERTING\n");
gsm48_stop_cc_timer(trans);
/* no T301 in MS call control */
gsm48_decode_facility(&alerting.facility,
TLVP_VAL(&tp, GSM48_IE_FACILITY)-1);
}
-
/* progress */
if (TLVP_PRESENT(&tp, GSM48_IE_PROGR_IND)) {
alerting.fields |= MNCC_F_PROGRESS;
struct tlv_parsed tp;
struct gsm_mncc setup;
- LOGP(DCC, LOGL_INFO, "sending SETUP\n");
+ LOGP(DCC, LOGL_INFO, "received SETUP\n");
memset(&setup, 0, sizeof(struct gsm_mncc));
setup.callref = trans->callref;
{SBIT(GSM_CSTATE_INITIATED) | SBIT(GSM_CSTATE_MO_CALL_PROC) |
SBIT(GSM_CSTATE_CALL_DELIVERED), /* 5.2.1.4.1 */
- MNCC_PROGRESS_REQ, gsm48_cc_rx_progress},
+ GSM48_MT_CC_PROGRESS, gsm48_cc_rx_progress},
{SBIT(GSM_CSTATE_INITIATED) |
SBIT(GSM_CSTATE_MO_CALL_PROC), /* 5.2.1.5 */
{ALL_STATES, /* 8.4 */
GSM48_MT_CC_STATUS_ENQ, gsm48_cc_rx_status_enq},
+ {ALL_STATES,
+ GSM48_MT_CC_STATUS, gsm48_cc_rx_status},
+
{ALL_STATES, /* 5.5.7.2 */
GSM48_MT_CC_START_DTMF_ACK, gsm48_cc_rx_start_dtmf_ack},