summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorDavid Brooks <dbrooks@digium.com>2009-11-02 20:59:37 +0000
committerDavid Brooks <dbrooks@digium.com>2009-11-02 20:59:37 +0000
commit2c4d3b3168743f876a9935d66c0756967955b841 (patch)
tree43445d5c9e1bde0981e828ae0976a53f321850eb /channels/chan_sip.c
parentd279260f510bfe0e6dcf98cd5ef99de74c73c2e6 (diff)
SIP channel name uniqueness
SIP channel names were supposed to be unique by way of a name suffix derived from the pointer to the channel's private data. Uniqueness was preserved on 32-bit systems, but not on 64-bit systems. This patch, as suggested by kpfleming, replaces this suffix with a simple incremented unsigned int. (closes issue #15152) Reported by: palbrecht Review: https://reviewboard.asterisk.org/r/420/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@226974 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b0b4e9eb2..c1d5adefa 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -929,6 +929,8 @@ static const struct cfsip_methods {
{ SIP_PING, NO_RTP, "PING", CAN_CREATE_DIALOG_UNSUPPORTED_METHOD }
};
+static unsigned int chan_idx;
+
/*! Define SIP option tags, used in Require: and Supported: headers
We need to be aware of these properties in the phones to use
the replace: header. We should not do that without knowing
@@ -6938,8 +6940,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
sip_pvt_unlock(i);
/* Don't hold a sip pvt lock while we allocate a channel */
- tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, linkedid, i->amaflags, "SIP/%s-%08x", my_name, (int)(long) i);
-
+ tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, linkedid, i->amaflags, "SIP/%s-%08x", my_name, ast_atomic_fetchadd_int((int *)&chan_idx, +1));
}
if (!tmp) {
ast_log(LOG_WARNING, "Unable to allocate AST channel structure for SIP channel\n");