mgcp: Add a callback to inform the client that an endpoint got reallocated

This commit is contained in:
Holger Hans Peter Freyther 2010-08-06 17:54:27 +08:00
parent c2ff55475e
commit 869e38eced
2 changed files with 4 additions and 0 deletions

View File

@ -76,6 +76,7 @@ struct mgcp_config;
#define MGCP_POLICY_REJECT 5
#define MGCP_POLICY_DEFER 6
typedef int (*mgcp_realloc)(struct mgcp_config *cfg, int endpoint);
typedef int (*mgcp_change)(struct mgcp_config *cfg, int endpoint, int state);
typedef int (*mgcp_policy)(struct mgcp_config *cfg, int endpoint, int state, const char *transactio_id);
typedef int (*mgcp_reset)(struct mgcp_config *cfg);
@ -121,6 +122,7 @@ struct mgcp_config {
mgcp_change change_cb;
mgcp_policy policy_cb;
mgcp_reset reset_cb;
mgcp_realloc realloc_cb;
void *data;
struct mgcp_endpoint *endpoints;

View File

@ -435,6 +435,8 @@ static struct msgb *handle_create_con(struct mgcp_config *cfg, struct msgb *msg)
LOGP(DMGCP, LOGL_NOTICE, "Endpoint 0x%x already allocated. Forcing realloc.\n",
ENDPOINT_NUMBER(endp));
mgcp_free_endp(endp);
if (cfg->realloc_cb)
cfg->realloc_cb(cfg, ENDPOINT_NUMBER(endp));
} else {
LOGP(DMGCP, LOGL_ERROR, "Endpoint is already used. 0x%x\n",
ENDPOINT_NUMBER(endp));