summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2014-12-06 22:05:42 +0100
committerAlfred E. Heggestad <aeh@db.org>2014-12-06 22:05:42 +0100
commitb62ab004f458a8e3126114743ee1389c08e6eac9 (patch)
tree3d0d53a16db3e2401f08531e9194c8fbd3cc9469 /src
parent77ed30535fa53075fcc46239d35000825fcbd623 (diff)
gruu: use the correct contact-header
Diffstat (limited to 'src')
-rw-r--r--src/reg.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/reg.c b/src/reg.c
index 1f8f840..b206ed8 100644
--- a/src/reg.c
+++ b/src/reg.c
@@ -99,6 +99,21 @@ static int sip_auth_handler(char **username, char **password,
}
+static bool contact_handler(const struct sip_hdr *hdr,
+ const struct sip_msg *msg, void *arg)
+{
+ struct reg *reg = arg;
+ struct sip_addr addr;
+ (void)msg;
+
+ if (sip_addr_decode(&addr, &hdr->val))
+ return false;
+
+ /* match our contact */
+ return 0 == pl_strcasecmp(&addr.uri.user, ua_local_cuser(reg->ua));
+}
+
+
static void register_handler(int err, const struct sip_msg *msg, void *arg)
{
struct reg *reg = arg;
@@ -138,7 +153,8 @@ static void register_handler(int err, const struct sip_msg *msg, void *arg)
reg->scode = msg->scode;
- hdr = sip_msg_hdr(msg, SIP_HDR_CONTACT);
+ hdr = sip_msg_hdr_apply(msg, true, SIP_HDR_CONTACT,
+ contact_handler, reg);
if (hdr) {
struct sip_addr addr;
struct pl pval;