aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/mgcp/mgcp_protocol.c
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-25 23:02:17 +0800
commite3d16bb77530f2b3f08fdaf9640dd98bd9e730fa (patch)
treec59435fe3fdb0cfe30d278d21a3c746907d35308 /openbsc/src/mgcp/mgcp_protocol.c
parent74076934fb3ffb4c5cfa6be9710b0416b89328dc (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.
Diffstat (limited to 'openbsc/src/mgcp/mgcp_protocol.c')
-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 998476dec..6d5713c13 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)