summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-10-14 18:29:47 +0000
committerMark Spencer <markster@digium.com>2004-10-14 18:29:47 +0000
commitf8ee49646c2338f5efdda9bb98301de72edb29b5 (patch)
tree9eb7853b1f0ef55092dc057eaefa101e10108490
parent4ff125c703209747753d3debe43ba98cdfee34ed (diff)
Forget fullcontact when specific number is dialed (bug #2620)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4003 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rwxr-xr-xchannels/chan_sip.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index bb0a6e472..c3b018c17 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1947,6 +1947,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title)
{
struct ast_channel *tmp;
int fmt;
+
ast_mutex_unlock(&i->lock);
/* Don't hold a sip pvt lock while we allocate a channel */
tmp = ast_channel_alloc(1);
@@ -3650,9 +3651,11 @@ static void initreqprep(struct sip_request *req, struct sip_pvt *p, char *cmd, c
else
snprintf(from, sizeof(from), "\"%s\" <sip:%s@%s>;tag=as%08x", n, l, ast_strlen_zero(p->fromdomain) ? ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip) : p->fromdomain, p->tag);
+ /* If we're calling a registred SIP peer, use the fullcontact to dial to the peer */
if (!ast_strlen_zero(p->fullcontact)) {
/* If we have full contact, trust it */
strncpy(invite, p->fullcontact, sizeof(invite) - 1);
+ /* Otherwise, use the username while waiting for registration */
} else if (!ast_strlen_zero(p->username)) {
if (ntohs(p->sa.sin_port) != DEFAULT_SIP_PORT) {
snprintf(invite, sizeof(invite), "sip:%s@%s:%d",p->username, p->tohost, ntohs(p->sa.sin_port));
@@ -7984,8 +7987,15 @@ static struct ast_channel *sip_request(const char *type, int format, void *data)
else /* UNIDEN bug */
snprintf(p->via, sizeof(p->via), "SIP/2.0/UDP %s:%d;branch=z9hG4bK%08x", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport, p->branch);
build_callid(p->callid, sizeof(p->callid), p->ourip, p->fromdomain);
- if (ext)
+
+ /* We have an extension to call, don't use the full contact here */
+ /* This to enable dialling registred peers with extension dialling,
+ like SIP/peername/extension
+ SIP/peername will still use the full contact */
+ if (ext) {
strncpy(p->username, ext, sizeof(p->username) - 1);
+ p->fullcontact[0] = 0;
+ }
#if 0
printf("Setting up to call extension '%s' at '%s'\n", ext ? ext : "<none>", host);
#endif