Skip to content

Commit c1d052e

Browse files
committed
change: add SIP_KEEP_DIALOG_REQUET_URI to change ack request uri
1 parent 332f258 commit c1d052e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

libsip/src/sip-message.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,13 @@ int sip_message_init2(struct sip_message_t* msg, const char* method, const struc
235235
// initialize remote target
236236
memmove(&msg->u.c.method, &msg->cseq.method, sizeof(struct cstring_t));
237237
//memmove(&msg->u.c.uri, &dialog->remote.target, sizeof(struct sip_uri_t));
238+
#if defined(SIP_KEEP_DIALOG_REQUET_URI)
239+
// same as invite request uri
240+
msg->ptr.ptr = sip_uri_clone(msg->ptr.ptr, msg->ptr.end, &msg->u.c.uri, &dialog->remote.uri);
241+
#else
242+
// replace URI with dialog peer contact
238243
msg->ptr.ptr = sip_uri_clone(msg->ptr.ptr, msg->ptr.end, &msg->u.c.uri, &dialog->remote.target);
244+
#endif
239245

240246
// TODO: Via
241247

@@ -713,7 +719,7 @@ static inline int sip_message_skip_header(const struct cstring_t* name)
713719
int sip_message_add_header(struct sip_message_t* msg, const char* name, const char* value)
714720
{
715721
int r;
716-
struct sip_uri_t uri;
722+
//struct sip_uri_t uri;
717723
struct sip_param_t header;
718724

719725
if (!name || !*name)

libsip/src/uac/sip-uac.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ int sip_uac_transaction_via(struct sip_uac_transaction_t* t, char *via, int nvia
296296
if (0 == sip_uri_username(&t->req->from.uri, &user))
297297
{
298298
assert(user.n > 0);
299-
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);
299+
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);
300300
if (r < 0 || r >= ncontact)
301301
return -1; // ENOMEM
302302
}

0 commit comments

Comments
 (0)