Skip to content

Commit

Permalink
change: add SIP_KEEP_DIALOG_REQUET_URI to change ack request uri
Browse files Browse the repository at this point in the history
  • Loading branch information
ireader committed Jun 15, 2024
1 parent 332f258 commit c1d052e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion libsip/src/sip-message.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,13 @@ int sip_message_init2(struct sip_message_t* msg, const char* method, const struc
// initialize remote target
memmove(&msg->u.c.method, &msg->cseq.method, sizeof(struct cstring_t));
//memmove(&msg->u.c.uri, &dialog->remote.target, sizeof(struct sip_uri_t));
#if defined(SIP_KEEP_DIALOG_REQUET_URI)
// same as invite request uri
msg->ptr.ptr = sip_uri_clone(msg->ptr.ptr, msg->ptr.end, &msg->u.c.uri, &dialog->remote.uri);
#else
// replace URI with dialog peer contact
msg->ptr.ptr = sip_uri_clone(msg->ptr.ptr, msg->ptr.end, &msg->u.c.uri, &dialog->remote.target);
#endif

// TODO: Via

Expand Down Expand Up @@ -713,7 +719,7 @@ static inline int sip_message_skip_header(const struct cstring_t* name)
int sip_message_add_header(struct sip_message_t* msg, const char* name, const char* value)
{
int r;
struct sip_uri_t uri;
//struct sip_uri_t uri;
struct sip_param_t header;

if (!name || !*name)
Expand Down
2 changes: 1 addition & 1 deletion libsip/src/uac/sip-uac.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ int sip_uac_transaction_via(struct sip_uac_transaction_t* t, char *via, int nvia
if (0 == sip_uri_username(&t->req->from.uri, &user))
{
assert(user.n > 0);
r = snprintf(contact, ncontact, "<%.*s:%.*s@%s>", uri->scheme.n > 0 ? (int)uri->scheme.n : 3, uri->scheme.n > 0 ? uri->scheme.p : "sip", (int)user.n, user.p, local);
r = snprintf(contact, ncontact, "<%.*s:%.*s@%s>", (uri && uri->scheme.n > 0) ? (int)uri->scheme.n : 3, (uri && uri->scheme.n > 0) ? uri->scheme.p : "sip", (int)user.n, user.p, local);
if (r < 0 || r >= ncontact)
return -1; // ENOMEM
}
Expand Down

0 comments on commit c1d052e

Please sign in to comment.