[MERGED] osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint
Harald Welte has submitted this change and it was merged. Change subject: mcgp: let the MGW allocate the MGCP endpoint .. mcgp: let the MGW allocate the MGCP endpoint osmo-msc still uses endpoints that are allocated locally by the MGCP-Client. Since osmo-mgw now supports the more comfortable, dynamic variant we should make use of it. - Replace the endpoint numer allocation by the client with a wildcarded CRCX. Use the endpoint that is assigned by the MGW. Related: OS#2710 Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13 --- M include/osmocom/msc/msc_mgcp.h M src/libmsc/msc_mgcp.c 2 files changed, 35 insertions(+), 25 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/include/osmocom/msc/msc_mgcp.h b/include/osmocom/msc/msc_mgcp.h index ac3283c..3c4bc62 100644 --- a/include/osmocom/msc/msc_mgcp.h +++ b/include/osmocom/msc/msc_mgcp.h @@ -31,10 +31,15 @@ /* FSM instance, which handles the connection switching procedure */ struct osmo_fsm_inst *fsm; - /* RTP endpoint number. This number identifies the endpoint + /* RTP endpoint string. This string identifies the endpoint * on the MGW on which the RAN and CN connection is created. This -* endpoint number is assigned and released automatically. */ - uint16_t rtp_endpoint; +* endpoint number is assigned by the MGW. */ + char rtp_endpoint[MGCP_ENDPOINT_MAXLEN]; + + /* Call id of the current call. Will be derived from the callref +* of the transaction that is valid during the first CRCX. (The +* callref may change throughout the call) */ + unsigned int call_id; /* Set to true, when the context information is no longer needed */ bool free_ctx; diff --git a/src/libmsc/msc_mgcp.c b/src/libmsc/msc_mgcp.c index 541ff0a..8e874d8 100644 --- a/src/libmsc/msc_mgcp.c +++ b/src/libmsc/msc_mgcp.c @@ -51,7 +51,7 @@ #define MGCP_ASS_TIMEOUT 10/* in seconds */ #define MGCP_ASS_TIMEOUT_TIMER_NR 4 -#define MGCP_ENDPOINT_FORMAT "%x@mgw" +#define ENDPOINT_ID "rtpbridge/*@mgw" /* Some internal cause codes to indicate fault condition inside the FSM */ enum msc_mgcp_cause_code { @@ -218,9 +218,6 @@ * there is no meaningful action we can take now other than * giving up. */ - /* At least release the occupied endpoint ID */ - mgcp_client_release_endpoint(mgcp_ctx->rtp_endpoint, mgcp); - /* Cancel the transaction that timed out */ mgcp_client_cancel(mgcp, mgcp_ctx->mgw_pending_trans); @@ -271,8 +268,6 @@ mgcp = mgcp_ctx->mgcp; OSMO_ASSERT(mgcp); - mgcp_ctx->rtp_endpoint = mgcp_client_next_endpoint(mgcp); - LOGPFSML(fi, LOGL_DEBUG, "CRCX/RAN: creating connection for the RAN side on MGW endpoint:0x%x...\n", mgcp_ctx->rtp_endpoint); @@ -280,14 +275,15 @@ mgcp_msg = (struct mgcp_msg) { .verb = MGCP_VERB_CRCX, .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_MODE), - .call_id = mgcp_ctx->rtp_endpoint, + .call_id = mgcp_ctx->call_id, .conn_mode = MGCP_CONN_LOOPBACK }; - if (snprintf(mgcp_msg.endpoint, MGCP_ENDPOINT_MAXLEN, MGCP_ENDPOINT_FORMAT, mgcp_ctx->rtp_endpoint) >= + if (osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)) >= MGCP_ENDPOINT_MAXLEN) { handle_error(mgcp_ctx, MGCP_ERR_TOOLONG, true); return; } + msg = mgcp_msg_gen(mgcp, _msg); OSMO_ASSERT(msg); @@ -323,9 +319,11 @@ return; } - /* memorize connection identifier */ + /* memorize connection identifier and specific endpoint id */ osmo_strlcpy(mgcp_ctx->conn_id_ran, r->head.conn_id, sizeof(mgcp_ctx->conn_id_ran)); LOGPFSML(mgcp_ctx->fsm, LOGL_DEBUG, "CRCX/RAN: MGW responded with CI: %s\n", mgcp_ctx->conn_id_ran); + osmo_strlcpy(mgcp_ctx->rtp_endpoint, r->head.endpoint, sizeof(mgcp_ctx->rtp_endpoint)); + LOGPFSML(mgcp_ctx->fsm, LOGL_DEBUG, "CRCX/RAN: MGW assigned endpoint: %s\n", mgcp_ctx->rtp_endpoint); rc = mgcp_response_parse_params(r); if (rc) { @@ -373,14 +371,15 @@ mgcp_msg = (struct mgcp_msg) { .verb = MGCP_VERB_CRCX, .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_MODE), - .call_id = mgcp_ctx->rtp_endpoint, + .call_id = mgcp_ctx->call_id, .conn_mode = MGCP_CONN_LOOPBACK }; - if (snprintf(mgcp_msg.endpoint, MGCP_ENDPOINT_MAXLEN, MGCP_ENDPOINT_FORMAT, mgcp_ctx->rtp_endpoint) >= + if (osmo_strlcpy(mgcp_msg.endpoint,
osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint
Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/6319 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13 Gerrit-PatchSet: 2 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: dexterGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Stefan Sperling Gerrit-Reviewer: dexter Gerrit-HasComments: No
osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint
Patch Set 2: Code-Review-1 I would love to merge this, but without an updsate to the tests its not possible to merge. -- To view, visit https://gerrit.osmocom.org/6319 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13 Gerrit-PatchSet: 2 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: dexterGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Stefan Sperling Gerrit-Reviewer: dexter Gerrit-HasComments: No
osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint
Patch Set 2: (1 comment) https://gerrit.osmocom.org/#/c/6319/2/src/libmsc/msc_mgcp.c File src/libmsc/msc_mgcp.c: Line 252: MGCP_ENDPOINT_MAXLEN) { While this code is correct because sizeof(mgcp_msg.endpoint) and MGCP_ENDPOINT_MAXLEN have the same value, I would stick to the idiom: if (strlcpy(dst, src, dstsize) >= dstsize) So I'd use the exact same value for the dstsize argument and the truncation check, either sizeof(mgcp_msg.endpoint) or MGCP_ENDPOINT_MAXLEN, but would avoid mixing them. The reason is just that this is a common idiom people auditing code will be looking for. Not obviously using the same value raises a red flag in a reviewer's mind. See also the EXAMPLES section in http://man.openbsd.org/strlcpy -- To view, visit https://gerrit.osmocom.org/6319 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13 Gerrit-PatchSet: 2 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: dexterGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Stefan Sperling Gerrit-Reviewer: dexter Gerrit-HasComments: Yes
[PATCH] osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6319 to look at the new patch set (#2). mcgp: let the MGW allocate the MGCP endpoint osmo-msc still uses endpoints that are allocated locally by the MGCP-Client. Since osmo-mgw now supports the more comfortable, dynamic variant we should make use of it. - Replace the endpoint numer allocation by the client with a wildcarded CRCX. Use the endpoint that is assigned by the MGW. Related: OS#2710 Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13 --- M include/osmocom/msc/msc_mgcp.h M src/libmsc/msc_mgcp.c 2 files changed, 35 insertions(+), 25 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/19/6319/2 diff --git a/include/osmocom/msc/msc_mgcp.h b/include/osmocom/msc/msc_mgcp.h index ac3283c..3c4bc62 100644 --- a/include/osmocom/msc/msc_mgcp.h +++ b/include/osmocom/msc/msc_mgcp.h @@ -31,10 +31,15 @@ /* FSM instance, which handles the connection switching procedure */ struct osmo_fsm_inst *fsm; - /* RTP endpoint number. This number identifies the endpoint + /* RTP endpoint string. This string identifies the endpoint * on the MGW on which the RAN and CN connection is created. This -* endpoint number is assigned and released automatically. */ - uint16_t rtp_endpoint; +* endpoint number is assigned by the MGW. */ + char rtp_endpoint[MGCP_ENDPOINT_MAXLEN]; + + /* Call id of the current call. Will be derived from the callref +* of the transaction that is valid during the first CRCX. (The +* callref may change throughout the call) */ + unsigned int call_id; /* Set to true, when the context information is no longer needed */ bool free_ctx; diff --git a/src/libmsc/msc_mgcp.c b/src/libmsc/msc_mgcp.c index 2bc186e..f5e40d2 100644 --- a/src/libmsc/msc_mgcp.c +++ b/src/libmsc/msc_mgcp.c @@ -51,7 +51,7 @@ #define MGCP_ASS_TIMEOUT 10/* in seconds */ #define MGCP_ASS_TIMEOUT_TIMER_NR 4 -#define MGCP_ENDPOINT_FORMAT "%x@mgw" +#define ENDPOINT_ID "rtpbridge/*@mgw" /* Some internal cause codes to indicate fault condition inside the FSM */ enum msc_mgcp_cause_code { @@ -187,9 +187,6 @@ * there is no meaningful action we can take now other than * giving up. */ - /* At least release the occupied endpoint ID */ - mgcp_client_release_endpoint(mgcp_ctx->rtp_endpoint, mgcp); - /* Cancel the transaction that timed out */ mgcp_client_cancel(mgcp, mgcp_ctx->mgw_pending_trans); @@ -241,8 +238,6 @@ mgcp = mgcp_ctx->mgcp; OSMO_ASSERT(mgcp); - mgcp_ctx->rtp_endpoint = mgcp_client_next_endpoint(mgcp); - LOGPFSML(fi, LOGL_DEBUG, "CRCX/RAN: creating connection for the RAN side on MGW endpoint:0x%x...\n", mgcp_ctx->rtp_endpoint); @@ -250,14 +245,15 @@ mgcp_msg = (struct mgcp_msg) { .verb = MGCP_VERB_CRCX, .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_MODE), - .call_id = mgcp_ctx->rtp_endpoint, + .call_id = mgcp_ctx->call_id, .conn_mode = MGCP_CONN_LOOPBACK }; - if (snprintf(mgcp_msg.endpoint, MGCP_ENDPOINT_MAXLEN, MGCP_ENDPOINT_FORMAT, mgcp_ctx->rtp_endpoint) >= + if (osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)) >= MGCP_ENDPOINT_MAXLEN) { handle_error(mgcp_ctx, MGCP_ERR_NOMEM); return; } + msg = mgcp_msg_gen(mgcp, _msg); OSMO_ASSERT(msg); @@ -293,9 +289,11 @@ return; } - /* memorize connection identifier */ + /* memorize connection identifier and specific endpoint id */ osmo_strlcpy(mgcp_ctx->conn_id_ran, r->head.conn_id, sizeof(mgcp_ctx->conn_id_ran)); LOGPFSML(mgcp_ctx->fsm, LOGL_DEBUG, "CRCX/RAN: MGW responded with CI: %s\n", mgcp_ctx->conn_id_ran); + osmo_strlcpy(mgcp_ctx->rtp_endpoint, r->head.endpoint, sizeof(mgcp_ctx->rtp_endpoint)); + LOGPFSML(mgcp_ctx->fsm, LOGL_DEBUG, "CRCX/RAN: MGW assigned endpoint: %s\n", mgcp_ctx->rtp_endpoint); rc = mgcp_response_parse_params(r); if (rc) { @@ -343,14 +341,15 @@ mgcp_msg = (struct mgcp_msg) { .verb = MGCP_VERB_CRCX, .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_MODE), - .call_id = mgcp_ctx->rtp_endpoint, + .call_id = mgcp_ctx->call_id, .conn_mode = MGCP_CONN_LOOPBACK }; - if (snprintf(mgcp_msg.endpoint, MGCP_ENDPOINT_MAXLEN, MGCP_ENDPOINT_FORMAT, mgcp_ctx->rtp_endpoint) >= + if (osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)) >=
osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint
Patch Set 1: (3 comments) https://gerrit.osmocom.org/#/c/6319/1//COMMIT_MSG Commit Message: Line 18: OS#2710 in order to be easily picked up by robots, please put this on the same line. Also drop the blank line between this and the Change-Id. https://gerrit.osmocom.org/#/c/6319/1/src/libmsc/msc_mgcp.c File src/libmsc/msc_mgcp.c: Line 237: .call_id = 12345, wait, what? If it's correct, explain in a code comment? Line 240: osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)); > This change removes a check for truncation. Is this intended? (fine difference that it's osmo_strlcpy(), but it does follow the BSD strlcpy signature, so I agree with stsp that truncation still deserves a handle_error(); and probably that case also deserves a unit test of sorts?) -- To view, visit https://gerrit.osmocom.org/6319 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13 Gerrit-PatchSet: 1 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: dexterGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Stefan Sperling Gerrit-Reviewer: dexter Gerrit-HasComments: Yes
osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint
Patch Set 1: (5 comments) https://gerrit.osmocom.org/#/c/6319/1/src/libmsc/msc_mgcp.c File src/libmsc/msc_mgcp.c: Line 240: osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)); This change removes a check for truncation. Is this intended? You could keep the >= MGCP_ENDPOINT_MAXLEN check as it is, because snprintf and strlcpy have the same semantics in this regard. Line 332: osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)); Another removed truncation check. Line 606: osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)); Same. Line 683: osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)); Same. Line 888: osmo_strlcpy(mgcp_ctx->rtp_endpoint, ENDPOINT_ID, sizeof(mgcp_ctx->rtp_endpoint)); Check for truncation here? -- To view, visit https://gerrit.osmocom.org/6319 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13 Gerrit-PatchSet: 1 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: dexterGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Stefan Sperling Gerrit-Reviewer: dexter Gerrit-HasComments: Yes
osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint
Patch Set 1: > do we have a TTCN-3 test case for this in OsmoMSC yet, so we can > make sure the feature works as expected? If not, please provide > one (or indicate what is missing in terms of infrastructure to > write one). There is no test for this yet. If we apply the patch we possibly need to change the existing MSC tests because the behavior on the MGCP side changes. From what I can see so far only the CRCX is actually different. The TTCN3 part must expect a wildcarded CRCX and then return a specific endpoint. The rest of the code should then use this endpoint, so from the CRCX on everything should stay the same. The new code uses rtpbridge/*@mgw as endpoint scheme, thats also a difference between the old and the new way. -- To view, visit https://gerrit.osmocom.org/6319 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13 Gerrit-PatchSet: 1 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: dexterGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: dexter Gerrit-HasComments: No
osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint
Patch Set 1: do we have a TTCN-3 test case for this in OsmoMSC yet, so we can make sure the feature works as expected? If not, please provide one (or indicate what is missing in terms of infrastructure to write one). -- To view, visit https://gerrit.osmocom.org/6319 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13 Gerrit-PatchSet: 1 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: dexterGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol Gerrit-HasComments: No
[PATCH] osmo-msc[master]: mcgp: let the MGW allocate the MGCP endpoint
Review at https://gerrit.osmocom.org/6319 mcgp: let the MGW allocate the MGCP endpoint osmo-msc still uses endpoints that are allocated locally by the MGCP-Client. Since osmo-mgw now supports the more comfortable, dynamic variant we should make use of it. - Replace the endpoint numer allocation by the client with a wildcarded CRCX. Use the endpoint that is assigned by the MGW. Related: OS#2710 Change-Id: Iee3e446b6689626516f01c521abe3d4603cd3e13 --- M include/osmocom/msc/msc_mgcp.h M src/libmsc/msc_mgcp.c 2 files changed, 23 insertions(+), 44 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/19/6319/1 diff --git a/include/osmocom/msc/msc_mgcp.h b/include/osmocom/msc/msc_mgcp.h index ac3283c..05f2fd9 100644 --- a/include/osmocom/msc/msc_mgcp.h +++ b/include/osmocom/msc/msc_mgcp.h @@ -31,10 +31,10 @@ /* FSM instance, which handles the connection switching procedure */ struct osmo_fsm_inst *fsm; - /* RTP endpoint number. This number identifies the endpoint + /* RTP endpoint string. This string identifies the endpoint * on the MGW on which the RAN and CN connection is created. This -* endpoint number is assigned and released automatically. */ - uint16_t rtp_endpoint; +* endpoint number is assigned by the MGW. */ + char rtp_endpoint[MGCP_ENDPOINT_MAXLEN]; /* Set to true, when the context information is no longer needed */ bool free_ctx; diff --git a/src/libmsc/msc_mgcp.c b/src/libmsc/msc_mgcp.c index bd60c13..85e9d2e 100644 --- a/src/libmsc/msc_mgcp.c +++ b/src/libmsc/msc_mgcp.c @@ -51,7 +51,7 @@ #define MGCP_ASS_TIMEOUT 10/* in seconds */ #define MGCP_ASS_TIMEOUT_TIMER_NR 4 -#define MGCP_ENDPOINT_FORMAT "%x@mgw" +#define ENDPOINT_ID "rtpbridge/*@mgw" /* Some internal cause codes to indicate fault condition inside the FSM */ enum msc_mgcp_cause_code { @@ -176,9 +176,6 @@ * there is no meaningful action we can take now other than * giving up. */ - /* At least release the occupied endpoint ID */ - mgcp_client_release_endpoint(mgcp_ctx->rtp_endpoint, mgcp); - /* Cancel the transaction that timed out */ mgcp_client_cancel(mgcp, mgcp_ctx->mgw_pending_trans); @@ -230,8 +227,6 @@ mgcp = mgcp_ctx->mgcp; OSMO_ASSERT(mgcp); - mgcp_ctx->rtp_endpoint = mgcp_client_next_endpoint(mgcp); - LOGPFSML(fi, LOGL_DEBUG, "CRCX/RAN: creating connection for the RAN side on MGW endpoint:0x%x...\n", mgcp_ctx->rtp_endpoint); @@ -239,14 +234,11 @@ mgcp_msg = (struct mgcp_msg) { .verb = MGCP_VERB_CRCX, .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_MODE), - .call_id = mgcp_ctx->rtp_endpoint, + .call_id = 12345, .conn_mode = MGCP_CONN_LOOPBACK }; - if (snprintf(mgcp_msg.endpoint, MGCP_ENDPOINT_MAXLEN, MGCP_ENDPOINT_FORMAT, mgcp_ctx->rtp_endpoint) >= - MGCP_ENDPOINT_MAXLEN) { - handle_error(mgcp_ctx, MGCP_ERR_NOMEM); - return; - } + osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)); + msg = mgcp_msg_gen(mgcp, _msg); OSMO_ASSERT(msg); @@ -282,9 +274,11 @@ return; } - /* memorize connection identifier */ + /* memorize connection identifier and specific endpoint id */ osmo_strlcpy(mgcp_ctx->conn_id_ran, r->head.conn_id, sizeof(mgcp_ctx->conn_id_ran)); LOGPFSML(mgcp_ctx->fsm, LOGL_DEBUG, "CRCX/RAN: MGW responded with CI: %s\n", mgcp_ctx->conn_id_ran); + osmo_strlcpy(mgcp_ctx->rtp_endpoint, r->head.endpoint, sizeof(mgcp_ctx->rtp_endpoint)); + LOGPFSML(mgcp_ctx->fsm, LOGL_DEBUG, "CRCX/RAN: MGW assigned endpoint: %s\n", mgcp_ctx->rtp_endpoint); rc = mgcp_response_parse_params(r); if (rc) { @@ -332,14 +326,11 @@ mgcp_msg = (struct mgcp_msg) { .verb = MGCP_VERB_CRCX, .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_MODE), - .call_id = mgcp_ctx->rtp_endpoint, + .call_id = 12345, .conn_mode = MGCP_CONN_LOOPBACK }; - if (snprintf(mgcp_msg.endpoint, MGCP_ENDPOINT_MAXLEN, MGCP_ENDPOINT_FORMAT, mgcp_ctx->rtp_endpoint) >= - MGCP_ENDPOINT_MAXLEN) { - handle_error(mgcp_ctx, MGCP_ERR_NOMEM); - return; - } + osmo_strlcpy(mgcp_msg.endpoint, mgcp_ctx->rtp_endpoint, sizeof(mgcp_msg.endpoint)); + msg = mgcp_msg_gen(mgcp, _msg); OSMO_ASSERT(msg); @@ -493,17 +484,14 @@ .presence = (MGCP_MSG_PRESENCE_ENDPOINT | MGCP_MSG_PRESENCE_CALL_ID | MGCP_MSG_PRESENCE_CONN_ID | MGCP_MSG_PRESENCE_CONN_MODE |