diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-09-14 16:11:08 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-09-14 22:28:13 +0200 |
commit | 96cc57af80d91054b4d23e6de83015bf93fefb18 (patch) | |
tree | c996c11442d329c25cc4d3ee5112cafb5689bf41 /src/mgcp | |
parent | 42e44a9e5e88e32ad2dc218983f317bbec07cce4 (diff) |
mgcp: Generate the ConnId per trunk base
MGCP RFC 3435 does not specify that the Connection Id must be
generated with any kind of random. It must uniquely identify
the connection of an endpoint. So we can make it per trunk group
or could even have it per endpoint.
The code does not support multiple connections on the same endpoint
right now but the spec allows it.
Diffstat (limited to 'src/mgcp')
-rw-r--r-- | src/mgcp/mgcp_protocol.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mgcp/mgcp_protocol.c b/src/mgcp/mgcp_protocol.c index 19e9d4f..d583cee 100644 --- a/src/mgcp/mgcp_protocol.c +++ b/src/mgcp/mgcp_protocol.c @@ -91,24 +91,24 @@ static struct msgb *handle_noti_req(struct mgcp_config *cfg, struct msgb *msg); static void create_transcoder(struct mgcp_endpoint *endp); static void delete_transcoder(struct mgcp_endpoint *endp); -static uint32_t generate_call_id(struct mgcp_config *cfg) +static uint32_t generate_call_id(struct mgcp_trunk_config *tcfg) { int i; /* use the call id */ - ++cfg->last_call_id; + ++tcfg->last_call_id; /* handle wrap around */ - if (cfg->last_call_id == CI_UNUSED) - ++cfg->last_call_id; + if (tcfg->last_call_id == CI_UNUSED) + ++tcfg->last_call_id; /* callstack can only be of size number_of_endpoints */ /* verify that the call id is free, e.g. in case of overrun */ - for (i = 1; i < cfg->trunk.number_endpoints; ++i) - if (cfg->trunk.endpoints[i].ci == cfg->last_call_id) - return generate_call_id(cfg); + for (i = 1; i < tcfg->number_endpoints; ++i) + if (tcfg->endpoints[i].ci == tcfg->last_call_id) + return generate_call_id(tcfg); - return cfg->last_call_id; + return tcfg->last_call_id; } /* @@ -577,7 +577,7 @@ static struct msgb *handle_create_con(struct mgcp_config *cfg, struct msgb *msg) goto error2; /* assign a local call identifier or fail */ - endp->ci = generate_call_id(cfg); + endp->ci = generate_call_id(tcfg); if (endp->ci == CI_UNUSED) goto error2; |