forked from Mirrors/freeswitch
Wed Sep 10 09:56:53 EDT 2008 Pekka Pessi <first.last@nokia.com>
* test_s2.c: use only tport protocol if primary tport is given git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9509 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
4c606d6df4
commit
cee1157243
@ -511,7 +511,7 @@ s2_request_to(struct dialog *d,
|
|||||||
|
|
||||||
msg_t *msg = s2_msg(0);
|
msg_t *msg = s2_msg(0);
|
||||||
sip_t *sip = sip_object(msg);
|
sip_t *sip = sip_object(msg);
|
||||||
url_string_t *target = NULL;
|
url_t const *target = NULL;
|
||||||
sip_cseq_t cseq[1];
|
sip_cseq_t cseq[1];
|
||||||
sip_via_t via[1]; char const *v_params[8];
|
sip_via_t via[1]; char const *v_params[8];
|
||||||
sip_content_length_t l[1];
|
sip_content_length_t l[1];
|
||||||
@ -525,20 +525,22 @@ s2_request_to(struct dialog *d,
|
|||||||
if (sip_add_tagis(msg, sip, &tags) < 0)
|
if (sip_add_tagis(msg, sip, &tags) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if (sip->sip_request)
|
||||||
|
target = sip->sip_request->rq_url;
|
||||||
|
else if (d->target)
|
||||||
|
target = d->target->m_url;
|
||||||
|
else if (s2->registration->contact)
|
||||||
|
target = s2->registration->contact->m_url;
|
||||||
|
else
|
||||||
|
target = NULL;
|
||||||
|
|
||||||
|
if (target == NULL)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (!sip->sip_request) {
|
if (!sip->sip_request) {
|
||||||
sip_request_t *rq;
|
sip_request_t *rq;
|
||||||
|
rq = sip_request_create(msg_home(msg), method, name,
|
||||||
if (d->target)
|
(url_string_t *)target, NULL);
|
||||||
target = (url_string_t *)d->target->m_url;
|
|
||||||
else if (s2->registration->contact)
|
|
||||||
target = (url_string_t *)s2->registration->contact->m_url;
|
|
||||||
else
|
|
||||||
target = NULL;
|
|
||||||
|
|
||||||
if (target == NULL)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
rq = sip_request_create(msg_home(msg), method, name, target, NULL);
|
|
||||||
sip_header_insert(msg, sip, (sip_header_t *)rq);
|
sip_header_insert(msg, sip, (sip_header_t *)rq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,11 +590,12 @@ s2_request_to(struct dialog *d,
|
|||||||
assert(tport);
|
assert(tport);
|
||||||
|
|
||||||
*tpn = *tport_name(tport);
|
*tpn = *tport_name(tport);
|
||||||
if (tport_is_udp(tport)) {
|
|
||||||
tpn->tpn_host = d->target->m_url->url_host;
|
if (tport_is_primary(tport)) {
|
||||||
tpn->tpn_port = url_port(d->target->m_url);
|
tpn->tpn_host = target->url_host;
|
||||||
|
tpn->tpn_port = url_port(target);
|
||||||
if (!tpn->tpn_port || !tpn->tpn_port[0])
|
if (!tpn->tpn_port || !tpn->tpn_port[0])
|
||||||
tpn->tpn_port = url_port_default(d->target->m_url->url_type);
|
tpn->tpn_port = url_port_default(target->url_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
magic = tport_magic(tport);
|
magic = tport_magic(tport);
|
||||||
|
Loading…
Reference in New Issue
Block a user