mod_gsmopen: convert reported RSSI from AT+CSQ to dBm.
Add to gsmopen_dump and events.
This commit is contained in:
parent
13a595a15e
commit
4aa7c98d5a
|
@ -445,6 +445,7 @@ struct private_object {
|
||||||
int roaming_registered;
|
int roaming_registered;
|
||||||
int not_registered;
|
int not_registered;
|
||||||
int got_signal;
|
int got_signal;
|
||||||
|
int signal_strength;
|
||||||
char imei[128];
|
char imei[128];
|
||||||
int requesting_imei;
|
int requesting_imei;
|
||||||
char imsi[128];
|
char imsi[128];
|
||||||
|
|
|
@ -996,6 +996,12 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
|
||||||
tech_pvt->got_signal = 2;
|
tech_pvt->got_signal = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (signal_quality == 99) {
|
||||||
|
tech_pvt->signal_strength = 0;
|
||||||
|
} else {
|
||||||
|
tech_pvt->signal_strength = (signal_quality * 2) - 113; /* RSSI [dBm] = reported_value * 2 - 113dB */
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2420,6 +2420,8 @@ SWITCH_STANDARD_API(gsmopen_dump_function)
|
||||||
}
|
}
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
||||||
stream->write_function(stream, "got_signal = %s\n", value);
|
stream->write_function(stream, "got_signal = %s\n", value);
|
||||||
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->signal_strength);
|
||||||
|
stream->write_function(stream, "signal_strength = %s\n", value);
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
||||||
stream->write_function(stream, "running = %s\n", value);
|
stream->write_function(stream, "running = %s\n", value);
|
||||||
stream->write_function(stream, "subscriber_number = %s\n", tech_pvt->subscriber_number);
|
stream->write_function(stream, "subscriber_number = %s\n", tech_pvt->subscriber_number);
|
||||||
|
@ -2483,6 +2485,8 @@ SWITCH_STANDARD_API(gsmopen_dump_function)
|
||||||
}
|
}
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
||||||
stream->write_function(stream, "got_signal = %s\n", value);
|
stream->write_function(stream, "got_signal = %s\n", value);
|
||||||
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->signal_strength);
|
||||||
|
stream->write_function(stream, "signal_strength = %s\n", value);
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
||||||
stream->write_function(stream, "running = %s\n", value);
|
stream->write_function(stream, "running = %s\n", value);
|
||||||
stream->write_function(stream, "subscriber_number = %s\n", tech_pvt->subscriber_number);
|
stream->write_function(stream, "subscriber_number = %s\n", tech_pvt->subscriber_number);
|
||||||
|
@ -2817,6 +2821,8 @@ int dump_event_full(private_t *tech_pvt, int is_alarm, int alarm_code, const cha
|
||||||
}
|
}
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->got_signal);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "got_signal", value);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "got_signal", value);
|
||||||
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->signal_strength);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "signal_strength", value);
|
||||||
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
snprintf(value, sizeof(value) - 1, "%d", tech_pvt->running);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "running", value);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "running", value);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subscriber_number", tech_pvt->subscriber_number);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subscriber_number", tech_pvt->subscriber_number);
|
||||||
|
|
Loading…
Reference in New Issue