[mgcp] Add an option to allow using reallocing an endpoint

For some mode of operation it can be acceptable to reallocate
an already allocated endpoint. This can be the case when we
only deal with one call agent that is keeping track of the
endpoint but slightly confused.
This commit is contained in:
Holger Hans Peter Freyther
2010-04-07 10:51:27 +02:00
parent 1b5b3bbfdb
commit 3a6b1a41fb
2 changed files with 11 additions and 2 deletions

View File

@@ -104,6 +104,9 @@ struct mgcp_config {
unsigned int number_endpoints;
struct mgcp_endpoint *endpoints;
/* spec handling */
int force_realloc;
/* callback functionality */
mgcp_change change_cb;
mgcp_policy policy_cb;

View File

@@ -386,8 +386,14 @@ static struct msgb *handle_create_con(struct mgcp_config *cfg, struct msgb *msg)
return create_response(500, "CRCX", trans_id);
if (endp->ci != CI_UNUSED) {
LOGP(DMGCP, LOGL_ERROR, "Endpoint is already used. 0x%x\n", ENDPOINT_NUMBER(endp));
return create_response(500, "CRCX", trans_id);
if (cfg->force_realloc) {
LOGP(DMGCP, LOGL_NOTICE, "Endpoint 0x%x already allocated. Forcing realloc.\n",
ENDPOINT_NUMBER(endp));
} else {
LOGP(DMGCP, LOGL_ERROR, "Endpoint is already used. 0x%x\n",
ENDPOINT_NUMBER(endp));
return create_response(500, "CRCX", trans_id);
}
}
/* parse CallID C: and LocalParameters L: */