Replaced MNCC by OSMO-CC
This commit is contained in:
@@ -32,6 +32,7 @@ amps_LDADD = \
|
||||
$(top_builddir)/src/liboptions/liboptions.a \
|
||||
$(top_builddir)/src/libdebug/libdebug.a \
|
||||
$(top_builddir)/src/libmobile/libmobile.a \
|
||||
$(top_builddir)/src/libosmocc/libosmocc.a \
|
||||
$(top_builddir)/src/libdisplay/libdisplay.a \
|
||||
$(top_builddir)/src/libcompandor/libcompandor.a \
|
||||
$(top_builddir)/src/libgoertzel/libgoertzel.a \
|
||||
@@ -42,7 +43,6 @@ amps_LDADD = \
|
||||
$(top_builddir)/src/libfm/libfm.a \
|
||||
$(top_builddir)/src/libfilter/libfilter.a \
|
||||
$(top_builddir)/src/libwave/libwave.a \
|
||||
$(top_builddir)/src/libmncc/libmncc.a \
|
||||
$(top_builddir)/src/libsample/libsample.a \
|
||||
$(top_builddir)/src/libg711/libg711.a \
|
||||
-lm
|
||||
|
@@ -45,7 +45,8 @@
|
||||
#include "../libsample/sample.h"
|
||||
#include "../libdebug/debug.h"
|
||||
#include "../libmobile/call.h"
|
||||
#include "../libmncc/cause.h"
|
||||
#include "../libmobile/cause.h"
|
||||
#include "../libosmocc/message.h"
|
||||
#include "amps.h"
|
||||
#include "dsp.h"
|
||||
#include "frame.h"
|
||||
@@ -63,10 +64,6 @@
|
||||
#define ALERT_TO 60.0 /* max time to wait for answer */
|
||||
#define RELEASE_TIMER 5.0 /* max time to send release messages */
|
||||
|
||||
/* Call reference for calls from mobile station to network
|
||||
This offset of 0x400000000 is required for MNCC interface. */
|
||||
static int new_callref = 0x40000000;
|
||||
|
||||
/* Convert channel number to frequency number of base station.
|
||||
Set 'uplink' to 1 to get frequency of mobile station. */
|
||||
double amps_channel2freq(int channel, int uplink)
|
||||
@@ -599,7 +596,7 @@ int amps_create(const char *kanal, enum amps_chan_type chan_type, const char *au
|
||||
uint32_t min1;
|
||||
uint16_t min2;
|
||||
amps_number2min("1234567890", &min1, &min2);
|
||||
transaction_t __attribute__((__unused__)) *trans = create_transaction(amps, TRANS_CALL_MO_ASSIGN, min1, min2, 0, 0, 0, amps->sender.kanal);
|
||||
transaction_t __attribute__((__unused__)) *trans = create_transaction(amps, TRANS_CALL_MO_ASSIGN, min1, min2, 0, 0, 0, 0, amps->sender.kanal);
|
||||
// amps_new_state(amps, STATE_BUSY);
|
||||
#endif
|
||||
|
||||
@@ -820,7 +817,7 @@ _register:
|
||||
PDEBUG_CHAN(DAMPS, DEBUG_INFO, " -> Home country: %s\n", country);
|
||||
if (national_number)
|
||||
PDEBUG_CHAN(DAMPS, DEBUG_INFO, " -> Home number: %s\n", national_number);
|
||||
trans = create_transaction(amps, TRANS_REGISTER_ACK, min1, min2, msg_type, ordq, order, 0);
|
||||
trans = create_transaction(amps, TRANS_REGISTER_ACK, min1, min2, esn, msg_type, ordq, order, 0);
|
||||
if (!trans) {
|
||||
PDEBUG(DAMPS, DEBUG_ERROR, "Failed to create transaction\n");
|
||||
return;
|
||||
@@ -847,7 +844,7 @@ _register:
|
||||
PDEBUG(DAMPS, DEBUG_NOTICE, "No free channel, rejecting call\n");
|
||||
reject:
|
||||
if (!trans) {
|
||||
trans = create_transaction(amps, TRANS_CALL_REJECT, min1, min2, 0, 0, 3, 0);
|
||||
trans = create_transaction(amps, TRANS_CALL_REJECT, min1, min2, esn, 0, 0, 3, 0);
|
||||
if (!trans) {
|
||||
PDEBUG(DAMPS, DEBUG_ERROR, "Failed to create transaction\n");
|
||||
return;
|
||||
@@ -862,7 +859,7 @@ reject:
|
||||
return;
|
||||
}
|
||||
if (!trans) {
|
||||
trans = create_transaction(amps, TRANS_CALL_MO_ASSIGN, min1, min2, 0, 0, 0, atoi(vc->sender.kanal));
|
||||
trans = create_transaction(amps, TRANS_CALL_MO_ASSIGN, min1, min2, esn, 0, 0, 0, atoi(vc->sender.kanal));
|
||||
strncpy(trans->dialing, dialing, sizeof(trans->dialing) - 1);
|
||||
if (!trans) {
|
||||
PDEBUG(DAMPS, DEBUG_ERROR, "Failed to create transaction\n");
|
||||
@@ -957,7 +954,7 @@ inval:
|
||||
PDEBUG_CHAN(DAMPS, DEBUG_INFO, "Call to mobile station, paging station id '%s'\n", dialing);
|
||||
|
||||
/* 6. trying to page mobile station */
|
||||
trans = create_transaction(amps, TRANS_PAGE, min1, min2, 0, 0, 0, 0);
|
||||
trans = create_transaction(amps, TRANS_PAGE, min1, min2, 0, 0, 0, 0, 0);
|
||||
if (!trans) {
|
||||
PDEBUG(DAMPS, DEBUG_ERROR, "Failed to create transaction\n");
|
||||
return -CAUSE_TEMPFAIL;
|
||||
@@ -1120,8 +1117,6 @@ static amps_t *assign_voice_channel(transaction_t *trans)
|
||||
{
|
||||
amps_t *amps = trans->amps, *vc;
|
||||
const char *callerid = amps_min2number(trans->min1, trans->min2);
|
||||
int callref = ++new_callref;
|
||||
int rc;
|
||||
|
||||
vc = search_channel(trans->chan);
|
||||
if (!vc) {
|
||||
@@ -1146,15 +1141,11 @@ static amps_t *assign_voice_channel(transaction_t *trans)
|
||||
amps_flush_other_transactions(vc, trans);
|
||||
|
||||
if (!trans->callref) {
|
||||
char esn_text[16];
|
||||
sprintf(esn_text, "%u", trans->esn);
|
||||
/* setup call */
|
||||
PDEBUG(DAMPS, DEBUG_INFO, "Setup call to network.\n");
|
||||
rc = call_up_setup(callref, callerid, trans->dialing);
|
||||
if (rc < 0) {
|
||||
PDEBUG(DAMPS, DEBUG_NOTICE, "Call rejected (cause %d), releasing.\n", rc);
|
||||
amps_release(trans, 0);
|
||||
return NULL;
|
||||
}
|
||||
trans->callref = callref;
|
||||
trans->callref = call_up_setup(callerid, trans->dialing, OSMO_CC_NETWORK_AMPS_ESN, esn_text);
|
||||
}
|
||||
|
||||
return vc;
|
||||
|
@@ -227,7 +227,7 @@ static int handle_options(int short_option, int argi, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main_amps_tacs(int argc, char *argv[])
|
||||
int main_amps_tacs(const char *name, int argc, char *argv[])
|
||||
{
|
||||
int rc, argi;
|
||||
const char *station_id = "";
|
||||
@@ -392,7 +392,7 @@ int main_amps_tacs(int argc, char *argv[])
|
||||
printf("Base station on channel %s ready (%s), please tune transmitter to %.4f MHz and receiver to %.4f MHz. (%.3f MHz offset)\n", kanal[i], chan_type_long_name(chan_type[i]), amps_channel2freq(atoi(kanal[i]), 0) / 1e6, amps_channel2freq(atoi(kanal[i]), 1) / 1e6, amps_channel2freq(atoi(kanal[i]), 2) / 1e6);
|
||||
}
|
||||
|
||||
main_mobile(&quit, latency, interval, NULL, station_id, 10);
|
||||
main_mobile(name, &quit, latency, interval, NULL, station_id, 10);
|
||||
|
||||
fail:
|
||||
/* destroy transceiver instance */
|
||||
|
@@ -17,5 +17,5 @@ int main(int argc, char *argv[])
|
||||
init_invalidnumber();
|
||||
init_congestion();
|
||||
|
||||
return main_amps_tacs(argc, argv);
|
||||
return main_amps_tacs("amps", argc, argv);
|
||||
}
|
||||
|
@@ -2,5 +2,5 @@
|
||||
extern const int tacs;
|
||||
extern const int jtacs;
|
||||
|
||||
int main_amps_tacs(int argc, char *argv[]);
|
||||
int main_amps_tacs(const char *name, int argc, char *argv[]);
|
||||
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include "../libsample/sample.h"
|
||||
#include "../libdebug/debug.h"
|
||||
#include "../libmobile/call.h"
|
||||
#include "../libmncc/cause.h"
|
||||
#include "../libmobile/cause.h"
|
||||
#include "amps.h"
|
||||
//#include "database.h"
|
||||
|
||||
@@ -103,7 +103,7 @@ const char *trans_short_state_name(int state)
|
||||
}
|
||||
|
||||
/* create transaction */
|
||||
transaction_t *create_transaction(amps_t *amps, enum amps_trans_state state, uint32_t min1, uint16_t min2, uint8_t msg_type, uint8_t ordq, uint8_t order, uint16_t chan)
|
||||
transaction_t *create_transaction(amps_t *amps, enum amps_trans_state state, uint32_t min1, uint16_t min2, uint32_t esn, uint8_t msg_type, uint8_t ordq, uint8_t order, uint16_t chan)
|
||||
{
|
||||
sender_t *sender;
|
||||
transaction_t *trans = NULL;
|
||||
@@ -140,6 +140,7 @@ transaction_t *create_transaction(amps_t *amps, enum amps_trans_state state, uin
|
||||
trans_new_state(trans, state);
|
||||
trans->min1 = min1;
|
||||
trans->min2 = min2;
|
||||
trans->esn = esn;
|
||||
trans->msg_type = msg_type;
|
||||
trans->ordq = ordq;
|
||||
trans->order = order;
|
||||
|
@@ -26,6 +26,7 @@ typedef struct transaction {
|
||||
int page_retry; /* current number of paging (re)try */
|
||||
uint32_t min1; /* current station ID (2 values) */
|
||||
uint16_t min2;
|
||||
uint32_t esn; /* ESN */
|
||||
uint8_t msg_type; /* message type (3 values) */
|
||||
uint8_t ordq;
|
||||
uint8_t order;
|
||||
@@ -37,7 +38,7 @@ typedef struct transaction {
|
||||
int dtx; /* if set, DTX is used with this call */
|
||||
} transaction_t;
|
||||
|
||||
transaction_t *create_transaction(amps_t *amps, enum amps_trans_state trans_state, uint32_t min1, uint16_t min2, uint8_t msg_type, uint8_t ordq, uint8_t order, uint16_t chan);
|
||||
transaction_t *create_transaction(amps_t *amps, enum amps_trans_state trans_state, uint32_t min1, uint16_t min2, uint32_t esn, uint8_t msg_type, uint8_t ordq, uint8_t order, uint16_t chan);
|
||||
void destroy_transaction(transaction_t *trans);
|
||||
void link_transaction(transaction_t *trans, amps_t *amps);
|
||||
void unlink_transaction(transaction_t *trans);
|
||||
|
Reference in New Issue
Block a user