Skip to content

Commit

Permalink
sipreg/reg: add peer address to sipreg
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianfridrich committed Jul 10, 2024
1 parent d3e521b commit 3537c56
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/re_sipreg.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ int sipreg_send(struct sipreg *reg);
int sipreg_set_rwait(struct sipreg *reg, uint32_t rwait);

const struct sa *sipreg_laddr(const struct sipreg *reg);
const struct sa *sipreg_paddr(const struct sipreg *reg);

uint32_t sipreg_proxy_expires(const struct sipreg *reg);
bool sipreg_registered(const struct sipreg *reg);
Expand Down
16 changes: 16 additions & 0 deletions src/sipreg/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ enum {
struct sipreg {
struct sip_loopstate ls;
struct sa laddr;
struct sa paddr;
struct tmr tmr;
struct sip *sip;
struct sip_keepalive *ka;
Expand Down Expand Up @@ -201,6 +202,8 @@ static void response_handler(int err, const struct sip_msg *msg, void *arg)
goto out;
}

reg->paddr = msg->src;

if (msg->scode < 200) {
return;
}
Expand Down Expand Up @@ -565,6 +568,19 @@ const struct sa *sipreg_laddr(const struct sipreg *reg)
}


/**
* Get the peer address for a SIP Registration client
*
* @param reg SIP Registration client
*
* @return Peer address
*/
const struct sa *sipreg_paddr(const struct sipreg *reg)
{
return reg ? &reg->paddr : NULL;
}


/**
* Get the proxy expires value of a SIP registration client
*
Expand Down

0 comments on commit 3537c56

Please sign in to comment.