aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-03 16:20:47 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-03 16:20:47 +0000
commit62565452b0ec611f90957b173bb04a700df4162c (patch)
tree9c9b2f742ec5094aa73eba64c5b2a7de1e86b2d9 /channels
parent77ae9e88e3f1b9305bcb8493fe9b91c996ca0a60 (diff)
Grab incoming tag on initial events.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@745 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_sip.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index f846edc25..c18bcf75f 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3024,6 +3024,8 @@ static int sip_show_channel(int fd, int argc, char *argv[])
ast_cli(fd, "Theoretical Address: %s:%d\n", inet_ntoa(cur->sa.sin_addr), ntohs(cur->sa.sin_port));
ast_cli(fd, "Received Address: %s:%d\n", inet_ntoa(cur->recv.sin_addr), ntohs(cur->recv.sin_port));
ast_cli(fd, "NAT Support: %s\n", cur->nat ? "Yes" : "No");
+ ast_cli(fd, "Our Tag: %08d\n", cur->tag);
+ ast_cli(fd, "Their Tag: %s\n", cur->theirtag);
strcpy(tmp, "");
if (cur->dtmfmode & SIP_DTMF_RFC2833)
strcat(tmp, "rfc2833 ");
@@ -3556,6 +3558,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
struct sip_request resp;
char *cmd;
char *cseq;
+ char *from;
char *e;
struct ast_channel *c=NULL;
int seqno;
@@ -3595,6 +3598,17 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc
respond appropriately */
ignore=1;
}
+ if (!strlen(p->theirtag)) {
+ from = get_header(req, "From");
+ from = strstr(from, "tag=");
+ if (from) {
+ from += 4;
+ strncpy(p->theirtag, from, sizeof(p->theirtag) - 1);
+ from = strchr(p->theirtag, ';');
+ if (from)
+ *from = '\0';
+ }
+ }
} else {
/* Response to our request -- Do some sanity checks */
if (!p->initreq.headers) {