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);
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 */
/* Get destination right away */
gotdest = get_destination(p, NULL);
get_rdnis(p, NULL);
+ extract_uri(p, req);
build_contact(p);
if (gotdest) {
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);
tmp->readthread = 0;
- ast_mutex_init(&tmp->lock, NULL);
+ ast_mutex_init(&tmp->lock);
if (setrxgain)
vpb_record_set_gain(tmp->handle, rxgain);