mgcp-cli: Allow submitting X-Osmux on CRCX request
Change-Id: I73b4c62baf39050da81d65553cbea07bc51163de
This commit is contained in:
parent
fa810e8ccd
commit
900cd6518a
|
@ -24,4 +24,5 @@
|
|||
# If any interfaces have been removed or changed since the last public release, a=0.
|
||||
#
|
||||
#library what description / commit summary line
|
||||
libosmo-mgcp-client add struct members AMR SDP/fmtp parameter generation
|
||||
libosmo-mgcp-client add struct members AMR SDP/fmtp parameter generation
|
||||
libosmo-mgcp-client add struct members Osmux use+cid fields to struct mgcp_msg and mgcp_conn_peer
|
||||
|
|
|
@ -50,6 +50,7 @@ enum mgcp_connection_mode {
|
|||
};
|
||||
|
||||
#define MGCP_X_OSMO_IGN_HEADER "X-Osmo-IGN:"
|
||||
#define MGCP_X_OSMO_OSMUX_HEADER "X-Osmux:"
|
||||
|
||||
/* Values should be bitwise-OR-able */
|
||||
enum mgcp_x_osmo_ign {
|
||||
|
|
|
@ -95,6 +95,7 @@ enum mgcp_verb {
|
|||
#define MGCP_MSG_PRESENCE_AUDIO_IP 0x0008
|
||||
#define MGCP_MSG_PRESENCE_AUDIO_PORT 0x0010
|
||||
#define MGCP_MSG_PRESENCE_CONN_MODE 0x0020
|
||||
#define MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID 0x4000
|
||||
#define MGCP_MSG_PRESENCE_X_OSMO_IGN 0x8000
|
||||
|
||||
struct mgcp_msg {
|
||||
|
@ -113,6 +114,8 @@ struct mgcp_msg {
|
|||
struct ptmap ptmap[MGCP_MAX_CODECS];
|
||||
unsigned int ptmap_len;
|
||||
uint32_t x_osmo_ign;
|
||||
bool x_osmo_osmux_use;
|
||||
int x_osmo_osmux_cid; /* -1 is wildcard */
|
||||
bool param_present;
|
||||
struct mgcp_codec_param param;
|
||||
};
|
||||
|
|
|
@ -48,6 +48,11 @@ struct mgcp_conn_peer {
|
|||
* name than the BSC. An OsmoMGW will then ignore these and not fail on mismatches. */
|
||||
uint32_t x_osmo_ign;
|
||||
|
||||
/*! send 'X-Osmux: %d' header (or "*" as wildcard). */
|
||||
bool x_osmo_osmux_use;
|
||||
/*! -1 means send wildcard. */
|
||||
int x_osmo_osmux_cid;
|
||||
|
||||
/*! If left MGCP_CONN_NONE, use MGCP_CONN_RECV_ONLY or MGCP_CONN_RECV_SEND, depending on whether an audio RTP
|
||||
* address is set. If != MGCP_CONN_NONE, force this conn mode. */
|
||||
enum mgcp_connection_mode conn_mode;
|
||||
|
|
|
@ -1104,6 +1104,7 @@ struct msgb *mgcp_msg_gen(struct mgcp_client *mgcp, struct mgcp_msg *mgcp_msg)
|
|||
int rc = 0;
|
||||
int rc_sdp;
|
||||
bool use_sdp = false;
|
||||
char buf[32];
|
||||
|
||||
msg->l2h = msg->data;
|
||||
msg->cb[MSGB_CB_MGCP_TRANS_ID] = trans_id;
|
||||
|
@ -1207,6 +1208,15 @@ struct msgb *mgcp_msg_gen(struct mgcp_client *mgcp, struct mgcp_msg *mgcp_msg)
|
|||
msgb_printf(msg, MGCP_X_OSMO_IGN_HEADER "%s\r\n",
|
||||
mgcp_msg->x_osmo_ign & MGCP_X_OSMO_IGN_CALLID ? " C": "");
|
||||
|
||||
/* Add X-Osmo-Osmux */
|
||||
if ((mgcp_msg->presence & MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID)) {
|
||||
snprintf(buf, sizeof(buf), " %d", mgcp_msg->x_osmo_osmux_cid);
|
||||
rc +=
|
||||
msgb_printf(msg, MGCP_X_OSMO_OSMUX_HEADER "%s\r\n",
|
||||
mgcp_msg->x_osmo_osmux_cid == -1 ? " *": buf);
|
||||
}
|
||||
|
||||
|
||||
/* Add session description protocol (SDP) */
|
||||
if (use_sdp
|
||||
&& (mgcp_msg->verb == MGCP_VERB_CRCX
|
||||
|
|
|
@ -126,6 +126,11 @@ static void make_crcx_msg(struct mgcp_msg *mgcp_msg, struct mgcp_conn_peer *info
|
|||
mgcp_msg->x_osmo_ign = info->x_osmo_ign;
|
||||
mgcp_msg->presence |= MGCP_MSG_PRESENCE_X_OSMO_IGN;
|
||||
}
|
||||
|
||||
if (info->x_osmo_osmux_use) {
|
||||
mgcp_msg->x_osmo_osmux_cid = info->x_osmo_osmux_cid;
|
||||
mgcp_msg->presence |= MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID;
|
||||
}
|
||||
}
|
||||
|
||||
static void add_audio(struct mgcp_msg *mgcp_msg, struct mgcp_conn_peer *info)
|
||||
|
|
|
@ -157,6 +157,7 @@ void test_mgcp_msg(void)
|
|||
.ptmap[0].pt = 96,
|
||||
.ptmap_len = 1,
|
||||
.x_osmo_ign = MGCP_X_OSMO_IGN_CALLID,
|
||||
.x_osmo_osmux_cid = -1, /* wildcard */
|
||||
};
|
||||
|
||||
if (mgcp)
|
||||
|
@ -254,6 +255,27 @@ void test_mgcp_msg(void)
|
|||
msg = mgcp_msg_gen(mgcp, &mgcp_msg);
|
||||
printf("%s\n", (char *)msg->data);
|
||||
|
||||
printf("Generate X-Osmo-Osmux message:\n");
|
||||
msg = mgcp_msg_gen(mgcp, &mgcp_msg);
|
||||
mgcp_msg.verb = MGCP_VERB_CRCX;
|
||||
mgcp_msg.presence =
|
||||
(MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID |
|
||||
MGCP_MSG_PRESENCE_CONN_ID | MGCP_MSG_PRESENCE_CONN_MODE
|
||||
| MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID);
|
||||
msg = mgcp_msg_gen(mgcp, &mgcp_msg);
|
||||
printf("%s\n", (char *)msg->data);
|
||||
|
||||
printf("Generate X-Osmo-Osmux message (fixed CID 2):\n");
|
||||
msg = mgcp_msg_gen(mgcp, &mgcp_msg);
|
||||
mgcp_msg.verb = MGCP_VERB_CRCX;
|
||||
mgcp_msg.x_osmo_osmux_cid = 2;
|
||||
mgcp_msg.presence =
|
||||
(MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID |
|
||||
MGCP_MSG_PRESENCE_CONN_ID | MGCP_MSG_PRESENCE_CONN_MODE
|
||||
| MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID);
|
||||
msg = mgcp_msg_gen(mgcp, &mgcp_msg);
|
||||
printf("%s\n", (char *)msg->data);
|
||||
|
||||
printf("Overfolow test:\n");
|
||||
mgcp_msg.verb = MGCP_VERB_MDCX;
|
||||
mgcp_msg.presence =
|
||||
|
|
|
@ -84,6 +84,22 @@ L: p:20, a:GSM, nt:IN
|
|||
M: sendrecv
|
||||
X-Osmo-IGN: C
|
||||
|
||||
Generate X-Osmo-Osmux message:
|
||||
CRCX 13 23@mgw MGCP 1.0
|
||||
C: 2f
|
||||
I: 11
|
||||
L: p:20, a:GSM, nt:IN
|
||||
M: sendrecv
|
||||
X-Osmux: *
|
||||
|
||||
Generate X-Osmo-Osmux message (fixed CID 2):
|
||||
CRCX 15 23@mgw MGCP 1.0
|
||||
C: 2f
|
||||
I: 11
|
||||
L: p:20, a:GSM, nt:IN
|
||||
M: sendrecv
|
||||
X-Osmux: 2
|
||||
|
||||
Overfolow test:
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue