diff options
Diffstat (limited to 'src/call.c')
-rw-r--r-- | src/call.c | 27 |
1 files changed, 25 insertions, 2 deletions
@@ -59,6 +59,7 @@ struct call { char *local_name; /**< Local display name */ char *peer_uri; /**< Peer SIP Address */ char *peer_name; /**< Peer display name */ + char *id; /**< Cached session call-id */ struct tmr tmr_inv; /**< Timer for incoming calls */ struct tmr tmr_dtmf; /**< Timer for incoming DTMF events */ time_t time_start; /**< Time when call started */ @@ -378,6 +379,7 @@ static void call_destructor(void *arg) tmr_cancel(&call->tmr_dtmf); mem_deref(call->sess); + mem_deref(call->id); mem_deref(call->local_uri); mem_deref(call->local_name); mem_deref(call->peer_uri); @@ -901,6 +903,12 @@ int call_sdp_get(const struct call *call, struct mbuf **descp, bool offer) } +const char *call_id(const struct call *call) +{ + return call ? call->id : NULL; +} + + const char *call_peeruri(const struct call *call) { return call ? call->peer_uri : NULL; @@ -940,10 +948,10 @@ int call_debug(struct re_printf *pf, const struct call *call) err |= re_hprintf(pf, " local_uri: %s <%s>\n" " peer_uri: %s <%s>\n" - " af=%s\n", + " af=%s id=%s\n", call->local_name, call->local_uri, call->peer_name, call->peer_uri, - net_af2name(call->af)); + net_af2name(call->af), call->id); err |= re_hprintf(pf, " direction: %s\n", call->outgoing ? "Outgoing" : "Incoming"); @@ -994,6 +1002,9 @@ int call_status(struct re_printf *pf, const struct call *call) err |= video_print(pf, call->video); #endif + /* remove old junk */ + err |= re_hprintf(pf, " "); + return err; } @@ -1293,6 +1304,8 @@ static void sipsess_close_handler(int err, const struct sip_msg *msg, if (err) { info("%s: session closed: %m\n", call->peer_uri, err); + (void)re_snprintf(reason, sizeof(reason), "%m", err); + if (call->not) { (void)call_notify_sipfrag(call, 500, "%m", err); } @@ -1421,6 +1434,11 @@ int call_accept(struct call *call, struct sipsess_sock *sess_sock, return err; } + err = str_dup(&call->id, + sip_dialog_callid(sipsess_dialog(call->sess))); + if (err) + return err; + set_state(call, STATE_INCOMING); /* New call */ @@ -1525,11 +1543,16 @@ static int send_invite(struct call *call) ua_print_supported, call->ua); if (err) { warning("call: sipsess_connect: %m\n", err); + goto out; } + err = str_dup(&call->id, + sip_dialog_callid(sipsess_dialog(call->sess))); + /* save call setup timer */ call->time_conn = time(NULL); + out: mem_deref(desc); return err; |