Add CC metering information to osmo-cc message
This commit is contained in:
parent
f9013904f4
commit
88fc70d781
|
@ -68,6 +68,7 @@ enum osmo_cc_ie_type {
|
|||
OSMO_CC_IE_PROGRESS = 0x32,
|
||||
OSMO_CC_IE_NOTIFY = 0x33,
|
||||
OSMO_CC_IE_DISPLAY = 0x34,
|
||||
OSMO_CC_IE_METERING = 0x35,
|
||||
OSMO_CC_IE_CAUSE = 0x41,
|
||||
OSMO_CC_IE_BEARER = 0x51,
|
||||
OSMO_CC_IE_SDP = 0x52,
|
||||
|
@ -439,6 +440,11 @@ struct osmo_cc_ie_display {
|
|||
char text[0];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct osmo_cc_ie_metering {
|
||||
uint16_t connect_units;
|
||||
uint16_t unit_period_decisecs;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct osmo_cc_ie_sdp {
|
||||
char sdp[0];
|
||||
} __attribute__((packed));
|
||||
|
@ -513,6 +519,8 @@ int osmo_cc_get_ie_cause(osmo_cc_msg_t *msg, int ie_repeat, uint8_t *location, u
|
|||
uint16_t *sip_cause, uint8_t *socket_cause);
|
||||
void osmo_cc_add_ie_display(osmo_cc_msg_t *msg, const char *text);
|
||||
int osmo_cc_get_ie_display(osmo_cc_msg_t *msg, int ie_repeat, char *text, size_t text_size);
|
||||
void osmo_cc_add_ie_metering(osmo_cc_msg_t *msg, uint16_t connect_units, uint16_t unit_period_decisecs);
|
||||
int osmo_cc_get_ie_metering(osmo_cc_msg_t *msg, int ie_repeat, uint16_t *connect_units, uint16_t *unit_period_decisecs);
|
||||
void osmo_cc_add_ie_sdp(osmo_cc_msg_t *msg, const char *sdp);
|
||||
int osmo_cc_get_ie_sdp(osmo_cc_msg_t *msg, int ie_repeat, char *sdp, size_t sdp_size);
|
||||
void osmo_cc_add_ie_socket_address(osmo_cc_msg_t *msg, const char *address);
|
||||
|
|
|
@ -98,6 +98,7 @@ static const char *osmo_cc_ie_name[OSMO_CC_IE_NUM] = {
|
|||
[OSMO_CC_IE_PROGRESS] = "IE_PROGRESS",
|
||||
[OSMO_CC_IE_NOTIFY] = "IE_NOTIFY",
|
||||
[OSMO_CC_IE_DISPLAY] = "IE_DISPLAY",
|
||||
[OSMO_CC_IE_METERING] = "IE_METERING",
|
||||
[OSMO_CC_IE_CAUSE] = "IE_CAUSE",
|
||||
[OSMO_CC_IE_BEARER] = "IE_BEARER",
|
||||
[OSMO_CC_IE_SDP] = "IE_SDP",
|
||||
|
@ -444,7 +445,7 @@ void osmo_cc_debug_ie(osmo_cc_msg_t *msg, int level)
|
|||
int ie_repeat[256];
|
||||
uint8_t type, plan, present, screen, coding, capability, mode, progress, reason,
|
||||
duration_ms, pause_ms, dtmf_mode, location, notify, isdn_cause, socket_cause;
|
||||
uint16_t sip_cause;
|
||||
uint16_t sip_cause, metering_connect_units, metering_unit_time_decisecs;
|
||||
uint32_t unique;
|
||||
char string[65536];
|
||||
int i;
|
||||
|
@ -607,6 +608,14 @@ void osmo_cc_debug_ie(osmo_cc_msg_t *msg, int level)
|
|||
break;
|
||||
LOGP(DLCC, level, " %s info='%s'\n", osmo_cc_ie_value2name(ie->type), string);
|
||||
break;
|
||||
case OSMO_CC_IE_METERING:
|
||||
rc = osmo_cc_get_ie_metering(msg, ie_repeat[ie->type], &metering_connect_units,
|
||||
&metering_unit_time_decisecs);
|
||||
if (rc < 0)
|
||||
break;
|
||||
LOGP(DLCC, level, " %s connect_units=%d unit_time_decisecs=%d (1/10 sec)\n",
|
||||
osmo_cc_ie_value2name(ie->type), metering_connect_units, metering_unit_time_decisecs);
|
||||
break;
|
||||
case OSMO_CC_IE_SDP:
|
||||
rc = osmo_cc_get_ie_sdp(msg, ie_repeat[ie->type], string, sizeof(string));
|
||||
if (rc < 0)
|
||||
|
@ -1279,6 +1288,33 @@ int osmo_cc_get_ie_display(osmo_cc_msg_t *msg, int ie_repeat, char *text, size_t
|
|||
return rc;
|
||||
}
|
||||
|
||||
/* helper to encode METERING information */
|
||||
void osmo_cc_add_ie_metering(osmo_cc_msg_t *msg, uint16_t connect_units, uint16_t unit_period_decisecs)
|
||||
{
|
||||
struct osmo_cc_ie_metering *ie_metering;
|
||||
|
||||
ie_metering = osmo_cc_add_ie(msg, OSMO_CC_IE_METERING, sizeof(*ie_metering));
|
||||
ie_metering->connect_units = htons(connect_units);
|
||||
ie_metering->unit_period_decisecs = htons(unit_period_decisecs);
|
||||
}
|
||||
|
||||
/* helper to decode METERING information */
|
||||
int osmo_cc_get_ie_metering(osmo_cc_msg_t *msg, int ie_repeat, uint16_t *connect_units, uint16_t *unit_period_decisecs)
|
||||
{
|
||||
struct osmo_cc_ie_metering *ie_metering;
|
||||
int rc;
|
||||
|
||||
rc = osmo_cc_get_ie_data(msg, OSMO_CC_IE_METERING, ie_repeat, sizeof(*ie_metering),
|
||||
(const void **)&ie_metering);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
*connect_units = ntohs(ie_metering->connect_units);
|
||||
*unit_period_decisecs = ntohs(ie_metering->unit_period_decisecs);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* helper to encode SDP */
|
||||
void osmo_cc_add_ie_sdp(osmo_cc_msg_t *msg, const char *sdp)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue