diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-24 06:24:38 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-24 06:24:38 +0000 |
commit | 45553e70077ad12ebce11c2adcecdddac6eb3fe1 (patch) | |
tree | b6985d3151cf0f310b2f31a77b9c2b863d0bea0d /channels | |
parent | b4ba4dd1ca82c2448e87be01dc21e4bde3c2a4f3 (diff) |
Use URI in sip, update chan_vpb
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1413 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_sip.c | 58 | ||||
-rwxr-xr-x | channels/chan_vpb.c | 4 |
2 files changed, 43 insertions, 19 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 7934d63d7..83cf6acfa 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2149,23 +2149,26 @@ static int reqprep(struct sip_request *req, struct sip_pvt *p, char *msg, int se seqno = p->ocseq; } - if (p->outgoing) - strncpy(stripped, get_header(orig, "To"), sizeof(stripped) - 1); - else - strncpy(stripped, get_header(orig, "From"), sizeof(stripped) - 1); - - c = strchr(stripped, '<'); - if (c) - c++; - else - c = stripped; - n = strchr(c, '>'); - if (n) - *n = '\0'; - n = strchr(c, ';'); - if (n) - *n = '\0'; - + if (strlen(p->uri)) { + c = p->uri; + } else { + if (p->outgoing) + strncpy(stripped, get_header(orig, "To"), sizeof(stripped) - 1); + else + strncpy(stripped, get_header(orig, "From"), sizeof(stripped) - 1); + + c = strchr(stripped, '<'); + if (c) + c++; + else + c = stripped; + n = strchr(c, '>'); + if (n) + *n = '\0'; + n = strchr(c, ';'); + if (n) + *n = '\0'; + } init_req(req, msg, c); snprintf(tmp, sizeof(tmp), "%d %s", seqno, msg); @@ -2558,6 +2561,26 @@ static int transmit_reinvite_with_sdp(struct sip_pvt *p, struct ast_rtp *rtp, st return send_request(p, &req, 1, p->ocseq); } +static void extract_uri(struct sip_pvt *p, struct sip_request *req) +{ + char stripped[256]=""; + char *c, *n; + strncpy(stripped, get_header(req, "Contact"), sizeof(stripped) - 1); + c = strchr(stripped, '<'); + if (c) + c++; + else + c = stripped; + n = strchr(c, '>'); + if (n) + *n = '\0'; + n = strchr(c, ';'); + if (n) + *n = '\0'; + if (c && strlen(c)) + strncpy(p->uri, c, sizeof(p->uri) - 1); +} + static void build_contact(struct sip_pvt *p) { /* Construct Contact: header */ @@ -4705,6 +4728,7 @@ static int handle_request(struct sip_pvt *p, struct sip_request *req, struct soc /* Get destination right away */ gotdest = get_destination(p, NULL); get_rdnis(p, NULL); + extract_uri(p, req); build_contact(p); if (gotdest) { diff --git a/channels/chan_vpb.c b/channels/chan_vpb.c index 61700a1fd..fe6e1d21a 100755 --- a/channels/chan_vpb.c +++ b/channels/chan_vpb.c @@ -177,7 +177,7 @@ static int vpb_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, bridges[i].fo = fo; bridges[i].c0 = c0; bridges[i].c1 = c1; - ast_mutex_init(&bridges[i].lock, NULL); + ast_mutex_init(&bridges[i].lock); pthread_cond_init(&bridges[i].cond, NULL); } } ast_mutex_unlock(&bridge_lock); @@ -586,7 +586,7 @@ struct vpb_pvt *mkif(int board, int channel, int mode, float txgain, float rxgai tmp->readthread = 0; - ast_mutex_init(&tmp->lock, NULL); + ast_mutex_init(&tmp->lock); if (setrxgain) vpb_record_set_gain(tmp->handle, rxgain); |