diff options
author | Alfred E. Heggestad <aeh@db.org> | 2014-12-06 22:05:42 +0100 |
---|---|---|
committer | Alfred E. Heggestad <aeh@db.org> | 2014-12-06 22:05:42 +0100 |
commit | b62ab004f458a8e3126114743ee1389c08e6eac9 (patch) | |
tree | 3d0d53a16db3e2401f08531e9194c8fbd3cc9469 /src | |
parent | 77ed30535fa53075fcc46239d35000825fcbd623 (diff) |
gruu: use the correct contact-header
Diffstat (limited to 'src')
-rw-r--r-- | src/reg.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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; |