Fixed broken Contact line
This commit is contained in:
parent
0ad29dcc63
commit
2bb1f893a9
|
@ -472,7 +472,7 @@ static void setup_req(call_t *call, osmo_cc_msg_t *msg)
|
||||||
uint8_t type, plan, present, screen;
|
uint8_t type, plan, present, screen;
|
||||||
char callerid[256], dialing[256];
|
char callerid[256], dialing[256];
|
||||||
const char *sdp = sdp;
|
const char *sdp = sdp;
|
||||||
const char *user, *peer;
|
const char *user, *peer, *p;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!call->sip_ep->remote_peer || !call->sip_ep->remote_peer[0]) {
|
if (!call->sip_ep->remote_peer || !call->sip_ep->remote_peer[0]) {
|
||||||
|
@ -491,7 +491,7 @@ static void setup_req(call_t *call, osmo_cc_msg_t *msg)
|
||||||
}
|
}
|
||||||
PDEBUG(DSIP, DEBUG_DEBUG, " -> new nua_handle %p\n", call->nua_handle);
|
PDEBUG(DSIP, DEBUG_DEBUG, " -> new nua_handle %p\n", call->nua_handle);
|
||||||
|
|
||||||
/* caller information */
|
/* caller information (also used for contact) */
|
||||||
rc = osmo_cc_get_ie_calling(msg, 0, &type, &plan, &present, &screen, callerid, sizeof(callerid));
|
rc = osmo_cc_get_ie_calling(msg, 0, &type, &plan, &present, &screen, callerid, sizeof(callerid));
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
callerid[0] = '\0';
|
callerid[0] = '\0';
|
||||||
|
@ -500,15 +500,29 @@ static void setup_req(call_t *call, osmo_cc_msg_t *msg)
|
||||||
user = call->sip_ep->local_user; // high prio
|
user = call->sip_ep->local_user; // high prio
|
||||||
else if (callerid[0])
|
else if (callerid[0])
|
||||||
user = callerid; // low prio
|
user = callerid; // low prio
|
||||||
peer = call->sip_ep->local_peer;
|
|
||||||
if (call->sip_ep->public_ip[0])
|
if (call->sip_ep->public_ip[0])
|
||||||
peer = call->sip_ep->public_ip;
|
peer = call->sip_ep->public_ip;
|
||||||
|
else
|
||||||
|
peer = call->sip_ep->local_peer;
|
||||||
if (user)
|
if (user)
|
||||||
sprintf(from, "sip:%s@%s", user, peer);
|
sprintf(from, "sip:%s@%s", user, peer);
|
||||||
else
|
else
|
||||||
sprintf(from, "sip:%s", peer);
|
sprintf(from, "sip:%s", peer);
|
||||||
PDEBUG(DSIP, DEBUG_DEBUG, " -> From = %s\n", from);
|
PDEBUG(DSIP, DEBUG_DEBUG, " -> From = %s\n", from);
|
||||||
|
|
||||||
|
/* contact information, equal to 'from', but with port number added, if not already exists */
|
||||||
|
strcpy(contact, from);
|
||||||
|
/* if port is not set (maybe public IP), get it from local_peer */
|
||||||
|
if (!strchr(peer, ':')) {
|
||||||
|
/* append port of local peer or use 5060, if not exits */
|
||||||
|
p = osmo_cc_port_of_address(call->sip_ep->local_peer);
|
||||||
|
if (!p)
|
||||||
|
p = "5060";
|
||||||
|
strcat(contact, ":");
|
||||||
|
strcat(contact, p);
|
||||||
|
}
|
||||||
|
PDEBUG(DSIP, DEBUG_DEBUG, " -> Contact = %s\n", contact);
|
||||||
|
|
||||||
/* dialing information */
|
/* dialing information */
|
||||||
rc = osmo_cc_get_ie_called(msg, 0, &type, &plan, dialing, sizeof(dialing));
|
rc = osmo_cc_get_ie_called(msg, 0, &type, &plan, dialing, sizeof(dialing));
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
|
@ -534,19 +548,6 @@ static void setup_req(call_t *call, osmo_cc_msg_t *msg)
|
||||||
PDEBUG(DSIP, DEBUG_DEBUG, " -> Asserted ID = %s\n", asserted_id);
|
PDEBUG(DSIP, DEBUG_DEBUG, " -> Asserted ID = %s\n", asserted_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public (or stun) ip */
|
|
||||||
if (call->sip_ep->public_ip[0]) {
|
|
||||||
const char *p;
|
|
||||||
// contact is set above
|
|
||||||
/* append port of local peer */
|
|
||||||
p = osmo_cc_port_of_address(call->sip_ep->local_peer);
|
|
||||||
if (p) {
|
|
||||||
strcat(contact, ":");
|
|
||||||
strcat(contact, p);
|
|
||||||
}
|
|
||||||
PDEBUG(DSIP, DEBUG_DEBUG, " -> Contact = %s\n", contact);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SDP */
|
/* SDP */
|
||||||
char sdp_buffer[65536];
|
char sdp_buffer[65536];
|
||||||
rc = osmo_cc_get_ie_sdp(msg, 0, sdp_buffer, sizeof(sdp_buffer));
|
rc = osmo_cc_get_ie_sdp(msg, 0, sdp_buffer, sizeof(sdp_buffer));
|
||||||
|
@ -1929,6 +1930,7 @@ static void sip_handle_register(sip_endpoint_t *sip_ep)
|
||||||
char to[256] = "";
|
char to[256] = "";
|
||||||
char contact[256+10] = "";
|
char contact[256+10] = "";
|
||||||
char expires[256] = "";
|
char expires[256] = "";
|
||||||
|
const char *peer, *p;
|
||||||
|
|
||||||
switch (sip_ep->register_state) {
|
switch (sip_ep->register_state) {
|
||||||
case REGISTER_STATE_UNREGISTERED:
|
case REGISTER_STATE_UNREGISTERED:
|
||||||
|
@ -1950,15 +1952,23 @@ static void sip_handle_register(sip_endpoint_t *sip_ep)
|
||||||
PDEBUG(DSIP, DEBUG_DEBUG, " -> From = %s\n", from);
|
PDEBUG(DSIP, DEBUG_DEBUG, " -> From = %s\n", from);
|
||||||
sprintf(to, "sip:%s@%s", sip_ep->register_user, sip_ep->register_peer);
|
sprintf(to, "sip:%s@%s", sip_ep->register_user, sip_ep->register_peer);
|
||||||
PDEBUG(DSIP, DEBUG_DEBUG, " -> To = %s\n", to);
|
PDEBUG(DSIP, DEBUG_DEBUG, " -> To = %s\n", to);
|
||||||
if (sip_ep->public_ip[0]) {
|
|
||||||
const char *p;
|
/* use public_ip if set, otherwise use local_peer */
|
||||||
sprintf(contact, "sip:%s@%s", sip_ep->register_user, sip_ep->public_ip);
|
if (sip_ep->public_ip[0])
|
||||||
/* append port of local peer */
|
peer = sip_ep->public_ip;
|
||||||
|
else
|
||||||
|
peer = sip_ep->local_peer;
|
||||||
|
sprintf(contact, "sip:%s@%s", sip_ep->register_user, peer);
|
||||||
|
/* if port is not set (maybe public IP), get it from local_peer */
|
||||||
|
if (!strchr(peer, ':')) {
|
||||||
|
/* append port of local peer or use 5060, if not exits */
|
||||||
p = osmo_cc_port_of_address(sip_ep->local_peer);
|
p = osmo_cc_port_of_address(sip_ep->local_peer);
|
||||||
if (p)
|
if (!p)
|
||||||
strcat(contact, p);
|
p = "5060";
|
||||||
PDEBUG(DSIP, DEBUG_DEBUG, " -> Contact = %s\n", contact);
|
strcat(contact, ":");
|
||||||
|
strcat(contact, p);
|
||||||
}
|
}
|
||||||
|
PDEBUG(DSIP, DEBUG_DEBUG, " -> Contact = %s\n", contact);
|
||||||
|
|
||||||
if (sip_ep->register_interval) {
|
if (sip_ep->register_interval) {
|
||||||
sprintf(expires, "%d", sip_ep->register_interval + 60);
|
sprintf(expires, "%d", sip_ep->register_interval + 60);
|
||||||
|
|
Loading…
Reference in New Issue