diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/call.c | 17 | ||||
-rw-r--r-- | src/core.h | 4 | ||||
-rw-r--r-- | src/ua.c | 13 |
3 files changed, 24 insertions, 10 deletions
@@ -468,6 +468,7 @@ static int assign_linenum(uint32_t *linenum, const struct list *lst) * @param prm Call parameters * @param msg SIP message for incoming calls * @param xcall Optional call to inherit properties from + * @param dnsc DNS Client * @param eh Call event handler * @param arg Handler argument * @@ -477,6 +478,7 @@ int call_alloc(struct call **callp, const struct config *cfg, struct list *lst, const char *local_name, const char *local_uri, struct account *acc, struct ua *ua, const struct call_prm *prm, const struct sip_msg *msg, struct call *xcall, + struct dnsc *dnsc, call_event_h *eh, void *arg) { struct call *call; @@ -486,9 +488,12 @@ int call_alloc(struct call **callp, const struct config *cfg, struct list *lst, int label = 0; int err = 0; - if (!cfg || !local_uri || !acc || !ua) + if (!cfg || !local_uri || !acc || !ua || !prm) return EINVAL; + debug("call: alloc with params laddr=%j, af=%s\n", + &prm->laddr, net_af2name(prm->af)); + call = mem_zalloc(sizeof(*call), call_destructor); if (!call) return ENOMEM; @@ -514,8 +519,7 @@ int call_alloc(struct call **callp, const struct config *cfg, struct list *lst, goto out; /* Init SDP info */ - err = sdp_session_alloc(&call->sdp, - net_laddr_af(baresip_network(), call->af)); + err = sdp_session_alloc(&call->sdp, &prm->laddr); if (err) goto out; @@ -531,7 +535,7 @@ int call_alloc(struct call **callp, const struct config *cfg, struct list *lst, /* Initialise media NAT handling */ if (acc->mnat) { err = acc->mnat->sessh(&call->mnats, - net_dnsc(baresip_network()), call->af, + dnsc, call->af, acc->stun_host, acc->stun_port, acc->stun_user, acc->stun_pass, call->sdp, !got_offer, @@ -1564,13 +1568,12 @@ struct list *call_streaml(const struct call *call) } -int call_reset_transp(struct call *call) +int call_reset_transp(struct call *call, const struct sa *laddr) { if (!call) return EINVAL; - sdp_session_set_laddr(call->sdp, - net_laddr_af(baresip_network(), call->af)); + sdp_session_set_laddr(call->sdp, laddr); return call_modify(call); } @@ -145,6 +145,7 @@ struct call; /** Call parameters */ struct call_prm { + struct sa laddr; enum vidmode vidmode; int af; }; @@ -154,6 +155,7 @@ int call_alloc(struct call **callp, const struct config *cfg, const char *local_name, const char *local_uri, struct account *acc, struct ua *ua, const struct call_prm *prm, const struct sip_msg *msg, struct call *xcall, + struct dnsc *dnsc, call_event_h *eh, void *arg); int call_connect(struct call *call, const struct pl *paddr); int call_accept(struct call *call, struct sipsess_sock *sess_sock, @@ -164,7 +166,7 @@ int call_answer(struct call *call, uint16_t scode); int call_sdp_get(const struct call *call, struct mbuf **descp, bool offer); int call_jbuf_stat(struct re_printf *pf, const struct call *call); int call_info(struct re_printf *pf, const struct call *call); -int call_reset_transp(struct call *call); +int call_reset_transp(struct call *call, const struct sa *laddr); int call_notify_sipfrag(struct call *call, uint16_t scode, const char *reason, ...); int call_af(const struct call *call); @@ -412,6 +412,7 @@ static int ua_call_alloc(struct call **callp, struct ua *ua, enum vidmode vidmode, const struct sip_msg *msg, struct call *xcall, const char *local_uri) { + const struct network *net = baresip_network(); struct call_prm cprm; int af = AF_UNSPEC; int err; @@ -431,6 +432,9 @@ static int ua_call_alloc(struct call **callp, struct ua *ua, af = ua->af; } + memset(&cprm, 0, sizeof(cprm)); + + sa_cpy(&cprm.laddr, net_laddr_af(net, af)); cprm.vidmode = vidmode; cprm.af = af; @@ -438,7 +442,9 @@ static int ua_call_alloc(struct call **callp, struct ua *ua, ua->acc->dispname, local_uri ? local_uri : ua->acc->aor, ua->acc, ua, &cprm, - msg, xcall, call_event_handler, ua); + msg, xcall, + net_dnsc(net), + call_event_handler, ua); if (err) return err; @@ -1515,8 +1521,11 @@ int uag_reset_transp(bool reg, bool reinvite) for (lec = ua->calls.head; lec; lec = lec->next) { struct call *call = lec->data; + const struct sa *laddr; + + laddr = net_laddr_af(net, call_af(call)); - err |= call_reset_transp(call); + err |= call_reset_transp(call, laddr); } } } |