p_g_lcr_gsm = gsm_ms;
break;
}
- gsm_ms = gsm_ms->gsm_ms_next;
+ gsm_ms = gsm_ms->gsm_next;
}
p_g_dtmf_state = DTMF_ST_IDLE;
struct gsm_mncc *proceeding, *frame;
struct interface *interface;
- interface = getinterfacebyname(p_g_interface_name);
+ interface = getinterfacebyname(p_interface_name);
if (!interface) {
- PERROR("Cannot find interface %s.\n", p_g_interface_name);
+ PERROR("Cannot find interface %s.\n", p_interface_name);
return;
}
/* process given callref */
- gsm_trace_header(p_g_interface_name, this, 0, DIRECTION_IN);
+ gsm_trace_header(p_interface_name, this, 0, DIRECTION_IN);
add_trace("callref", "new", "0x%x", callref);
if (p_g_callref) {
/* release in case the ID is already in use */
add_trace("error", NULL, "callref already in use");
+reject:
end_trace();
mncc = create_mncc(MNCC_REJ_REQ, callref);
- gsm_trace_header(p_g_interface_name, this, MNCC_REJ_REQ, DIRECTION_OUT);
+ gsm_trace_header(p_interface_name, this, MNCC_REJ_REQ, DIRECTION_OUT);
mncc->fields |= MNCC_F_CAUSE;
mncc->cause.coding = 3;
mncc->cause.location = 1;
trigger_work(&p_g_delete);
return;
}
+ if (callref < 0x40000000) {
+ /* release in case the ID is invalid */
+ add_trace("error", NULL, "callref invalid, not of MS type");
+ goto reject;
+ }
+
p_g_callref = callref;
end_trace();
- gsm_trace_header(p_g_interface_name, this, MNCC_SETUP_IND, DIRECTION_IN);
+ gsm_trace_header(p_interface_name, this, MNCC_SETUP_IND, DIRECTION_IN);
/* caller information */
p_callerinfo.ntype = INFO_NTYPE_NOTPRESENT;
if (mncc->fields & MNCC_F_CALLING) {
add_trace("calling", "screen", "%d", mncc->calling.screen);
add_trace("calling", "number", "%s", mncc->calling.number);
}
- SCPY(p_callerinfo.interface, p_g_interface_name);
+ SCPY(p_callerinfo.interface, p_interface_name);
/* dialing information */
if (mncc->fields & MNCC_F_CALLED) {
SCAT(p_dialinginfo.id, mncc->called.number);
epointlist_new(epoint->ep_serial);
/* modify lchan to GSM codec V1 */
- modify_lchan(RTP_PT_GSM_FULL);
+ modify_lchan(MEDIA_TYPE_GSM);
/* send call proceeding */
- gsm_trace_header(p_g_interface_name, this, MNCC_CALL_CONF_REQ, DIRECTION_OUT);
+ gsm_trace_header(p_interface_name, this, MNCC_CALL_CONF_REQ, DIRECTION_OUT);
proceeding = create_mncc(MNCC_CALL_CONF_REQ, p_g_callref);
/* bearer capability (mandatory, if not present in setup message) */
if (!(mncc->fields & MNCC_F_BEARER_CAP)) {
new_state(PORT_STATE_IN_PROCEEDING);
if (p_g_tones && !p_g_tch_connected) { /* only if ... */
- gsm_trace_header(p_g_interface_name, this, MNCC_FRAME_RECV, DIRECTION_OUT);
+ gsm_trace_header(p_interface_name, this, MNCC_FRAME_RECV, DIRECTION_OUT);
end_trace();
frame = create_mncc(MNCC_FRAME_RECV, p_g_callref);
send_and_free_mncc(p_g_lcr_gsm, frame->msg_type, frame);
/*
* MS sends message to port
*/
-int message_ms(struct lcr_gsm *gsm_ms, int msg_type, void *arg)
+int message_ms(class Pgsm_ms *pgsm_ms, struct lcr_gsm *gsm_ms, int msg_type, void *arg)
{
struct gsm_mncc *mncc = (struct gsm_mncc *)arg;
unsigned int callref = mncc->callref;
- class Port *port;
- class Pgsm_ms *pgsm_ms = NULL;
char name[64];
-// struct mISDNport *mISDNport;
/* Special messages */
switch (msg_type) {
}
- /* find callref */
- callref = mncc->callref;
- port = port_first;
- while(port) {
- if ((port->p_type & PORT_CLASS_GSM_MASK) == PORT_CLASS_GSM_MS) {
- pgsm_ms = (class Pgsm_ms *)port;
- if (pgsm_ms->p_g_callref == callref) {
- break;
- }
- }
- port = port->next;
- }
-
if (msg_type == GSM_TCHF_FRAME
|| msg_type == GSM_BAD_FRAME) {
- if (port)
+ if (pgsm_ms)
pgsm_ms->frame_receive(arg);
return 0;
}
- if (!port) {
+ if (!pgsm_ms) {
struct interface *interface;
if (msg_type != MNCC_SETUP_IND)
/* no instance */
if (!p_g_lcr_gsm || p_g_lcr_gsm->mncc_lfd.fd < 0) {
- gsm_trace_header(p_g_interface_name, this, MNCC_SETUP_REQ, DIRECTION_OUT);
+ gsm_trace_header(p_interface_name, this, MNCC_SETUP_REQ, DIRECTION_OUT);
add_trace("failure", NULL, "MS %s instance is unavailable", p_g_ms_name);
end_trace();
message = message_create(p_serial, epoint_id, PORT_TO_EPOINT, MESSAGE_RELEASE);
/* no number */
if (!p_dialinginfo.id[0]) {
- gsm_trace_header(p_g_interface_name, this, MNCC_SETUP_REQ, DIRECTION_OUT);
+ gsm_trace_header(p_interface_name, this, MNCC_SETUP_REQ, DIRECTION_OUT);
add_trace("failure", NULL, "No dialed subscriber given.");
end_trace();
message = message_create(p_serial, epoint_id, PORT_TO_EPOINT, MESSAGE_RELEASE);
epointlist_new(epoint_id);
/* creating l3id */
- gsm_trace_header(p_g_interface_name, this, 0, DIRECTION_OUT);
+ gsm_trace_header(p_interface_name, this, 0, DIRECTION_OUT);
p_g_callref = new_callref++;
add_trace("callref", "new", "0x%x", p_g_callref);
end_trace();
- gsm_trace_header(p_g_interface_name, this, MNCC_SETUP_REQ, DIRECTION_OUT);
+ gsm_trace_header(p_interface_name, this, MNCC_SETUP_REQ, DIRECTION_OUT);
mncc = create_mncc(MNCC_SETUP_REQ, p_g_callref);
if (!strncasecmp(p_dialinginfo.id, "emerg", 5)) {
mncc->emergency = 1;
p_g_dtmf_state = DTMF_ST_IDLE;
return;
}
- gsm_trace_header(p_g_interface_name, this, MNCC_START_DTMF_REQ, DIRECTION_OUT);
+ gsm_trace_header(p_interface_name, this, MNCC_START_DTMF_REQ, DIRECTION_OUT);
dtmf = create_mncc(MNCC_START_DTMF_REQ, p_g_callref);
dtmf->keypad = p_g_dtmf[p_g_dtmf_index++];
p_g_dtmf_state = DTMF_ST_START;
PDEBUG(DEBUG_GSM, "DTMF is on\n");
break;
case DTMF_ST_MARK:
- gsm_trace_header(p_g_interface_name, this, MNCC_STOP_DTMF_REQ, DIRECTION_OUT);
+ gsm_trace_header(p_interface_name, this, MNCC_STOP_DTMF_REQ, DIRECTION_OUT);
dtmf = create_mncc(MNCC_STOP_DTMF_REQ, p_g_callref);
p_g_dtmf_state = DTMF_ST_STOP;
end_trace();
struct lcr_gsm *gsm_ms = gsm_ms_first, **gsm_ms_p = &gsm_ms_first;
while (gsm_ms) {
- gsm_ms_p = &gsm_ms->gsm_ms_next;
- gsm_ms = gsm_ms->gsm_ms_next;
+ gsm_ms_p = &gsm_ms->gsm_next;
+ gsm_ms = gsm_ms->gsm_next;
}
PDEBUG(DEBUG_GSM, "GSM: interface for MS '%s' is created\n", interface->gsm_ms_name);
int gsm_ms_delete(const char *name)
{
struct lcr_gsm *gsm_ms = gsm_ms_first, **gsm_ms_p = &gsm_ms_first;
-// class Port *port;
-// class Pgsm_ms *pgsm_ms = NULL;
PDEBUG(DEBUG_GSM, "GSM: interface for MS '%s' is deleted\n", name);
while (gsm_ms) {
if (gsm_ms->type == LCR_GSM_TYPE_MS && !strcmp(gsm_ms->name, name))
break;
- gsm_ms_p = &gsm_ms->gsm_ms_next;
- gsm_ms = gsm_ms->gsm_ms_next;
+ gsm_ms_p = &gsm_ms->gsm_next;
+ gsm_ms = gsm_ms->gsm_next;
}
if (!gsm_ms)
return 0;
-/* not needed, because:
- * - shutdown of interface will destry port instances locally
- * - closing of socket will make remote socket destroy calls locally
- */
-#if 0
- port = port_first;
- while(port) {
- if ((port->p_type & PORT_CLASS_GSM_MASK) == PORT_CLASS_GSM_MS) {
- pgsm_ms = (class Pgsm_ms *)port;
- if (pgsm_ms->p_g_lcr_gsm == gsm_ms && pgsm_ms->p_g_callref) {
- struct gsm_mncc *rej;
-
- rej = create_mncc(MNCC_REL_REQ, pgsm_ms->p_g_callref);
- rej->fields |= MNCC_F_CAUSE;
- rej->cause.coding = 3;
- rej->cause.location = 1;
- rej->cause.value = 27;
- gsm_trace_header(NULL, NULL, MNCC_REJ_REQ, DIRECTION_OUT);
- add_trace("cause", "coding", "%d", rej->cause.coding);
- add_trace("cause", "location", "%d", rej->cause.location);
- add_trace("cause", "value", "%d", rej->cause.value);
- end_trace();
- send_and_free_mncc(gsm_ms, rej->msg_type, rej);
- pgsm_ms->new_state(PORT_STATE_RELEASE);
- trigger_work(&pgsm_ms->p_g_delete);
- }
- }
- }
-#endif
-
if (gsm_ms->mncc_lfd.fd > -1) {
close(gsm_ms->mncc_lfd.fd);
unregister_fd(&gsm_ms->mncc_lfd);
del_timer(&gsm_ms->socket_retry);
/* remove instance from list */
- *gsm_ms_p = gsm_ms->gsm_ms_next;
+ *gsm_ms_p = gsm_ms->gsm_next;
FREE(gsm_ms, sizeof(struct lcr_gsm));
return 0;