aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-22 11:58:13 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-22 12:13:44 +0800
commit89a378e9aa017a9b76dbb8d8539cb1abe93dda8a (patch)
tree857528a77400d8ff570fdf6a9437bd37286e0ea3
parent4a78c7b25030208e778782c12a34922aaa9ba5fe (diff)
[mgcp] Protocol extension to not generate answers.
For the NAT we want to send requests in a send and forget way and we are not interested in seeing the answers, so tell the gateway to not answer them.
-rw-r--r--openbsc/src/mgcp/mgcp_protocol.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/openbsc/src/mgcp/mgcp_protocol.c b/openbsc/src/mgcp/mgcp_protocol.c
index 998476de..6d5713c1 100644
--- a/openbsc/src/mgcp/mgcp_protocol.c
+++ b/openbsc/src/mgcp/mgcp_protocol.c
@@ -485,6 +485,7 @@ static struct msgb *handle_modify_con(struct mgcp_config *cfg, struct msgb *msg)
const char *trans_id;
struct mgcp_endpoint *endp;
int error_code = 500;
+ int silent = 0;
found = mgcp_analyze_header(cfg, msg, data_ptrs, ARRAY_SIZE(data_ptrs), &trans_id, &endp);
if (found != 0)
@@ -517,6 +518,9 @@ static struct msgb *handle_modify_con(struct mgcp_config *cfg, struct msgb *msg)
goto error3;
}
break;
+ case 'Z':
+ silent = strcmp("noanswer", (const char *)&msg->l3h[line_start + 3]) == 0;
+ break;
case '\0':
/* SDP file begins */
break;
@@ -562,6 +566,8 @@ static struct msgb *handle_modify_con(struct mgcp_config *cfg, struct msgb *msg)
case MGCP_POLICY_REJECT:
LOGP(DMGCP, LOGL_NOTICE, "MDCX rejected by policy on 0x%x\n",
ENDPOINT_NUMBER(endp));
+ if (silent)
+ goto out_silent;
return create_response(500, "MDCX", trans_id);
break;
case MGCP_POLICY_DEFER:
@@ -579,6 +585,9 @@ static struct msgb *handle_modify_con(struct mgcp_config *cfg, struct msgb *msg)
ENDPOINT_NUMBER(endp), inet_ntoa(endp->remote), ntohs(endp->net_rtp));
if (cfg->change_cb)
cfg->change_cb(cfg, ENDPOINT_NUMBER(endp), MGCP_ENDP_MDCX, endp->rtp_port);
+ if (silent)
+ goto out_silent;
+
return create_response_with_sdp(endp, "MDCX", trans_id);
error:
@@ -589,6 +598,10 @@ error:
error3:
return create_response(error_code, "MDCX", trans_id);
+
+
+out_silent:
+ return NULL;
}
static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg)
@@ -598,6 +611,7 @@ static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg)
const char *trans_id;
struct mgcp_endpoint *endp;
int error_code = 500;
+ int silent = 0;
found = mgcp_analyze_header(cfg, msg, data_ptrs, ARRAY_SIZE(data_ptrs), &trans_id, &endp);
if (found != 0)
@@ -619,6 +633,9 @@ static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg)
if (verify_ci(endp, (const char *)&msg->l3h[line_start + 3]) != 0)
goto error3;
break;
+ case 'Z':
+ silent = strcmp("noanswer", (const char *)&msg->l3h[line_start + 3]) == 0;
+ break;
}
default:
LOGP(DMGCP, LOGL_NOTICE, "Unhandled option: '%c'/%d on 0x%x\n",
@@ -634,6 +651,8 @@ static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg)
case MGCP_POLICY_REJECT:
LOGP(DMGCP, LOGL_NOTICE, "DLCX rejected by policy on 0x%x\n",
ENDPOINT_NUMBER(endp));
+ if (silent)
+ goto out_silent;
return create_response(500, "DLCX", trans_id);
break;
case MGCP_POLICY_DEFER:
@@ -653,6 +672,8 @@ static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg)
if (cfg->change_cb)
cfg->change_cb(cfg, ENDPOINT_NUMBER(endp), MGCP_ENDP_DLCX, endp->rtp_port);
+ if (silent)
+ goto out_silent;
return create_response(250, "DLCX", trans_id);
error:
@@ -663,6 +684,9 @@ error:
error3:
return create_response(error_code, "DLCX", trans_id);
+
+out_silent:
+ return NULL;
}
static struct msgb *handle_rsip(struct mgcp_config *cfg, struct msgb *msg)