diff options
author | Alfred E. Heggestad <aeh@db.org> | 2015-10-25 17:54:06 +0100 |
---|---|---|
committer | Alfred E. Heggestad <aeh@db.org> | 2015-10-25 17:54:06 +0100 |
commit | 039c4b1b627b86b041d76b483db2b9532452f6f4 (patch) | |
tree | e7acd72654b634dd2751997ce64191ca33cc01ae | |
parent | 558b17a21f0e740b8293259483649f4d38c5703d (diff) |
call: add direction flag
-rw-r--r-- | include/baresip.h | 1 | ||||
-rw-r--r-- | src/call.c | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/baresip.h b/include/baresip.h index 595070f..7f49e36 100644 --- a/include/baresip.h +++ b/include/baresip.h @@ -85,6 +85,7 @@ struct audio *call_audio(const struct call *call); struct video *call_video(const struct call *call); struct list *call_streaml(const struct call *call); struct ua *call_get_ua(const struct call *call); +bool call_is_outgoing(const struct call *call); /* @@ -64,6 +64,7 @@ struct call { time_t time_start; /**< Time when call started */ time_t time_conn; /**< Time when call initiated */ time_t time_stop; /**< Time when call stopped */ + bool outgoing; bool got_offer; /**< Got SDP Offer from Peer */ bool on_hold; /**< True if call is on hold */ struct mnat_sess *mnats; /**< Media NAT session */ @@ -584,6 +585,8 @@ int call_connect(struct call *call, const struct pl *paddr) info("call: connecting to '%r'..\n", paddr); + call->outgoing = true; + /* if the peer-address is a full SIP address then we need * to parse it and extract the SIP uri part. */ @@ -845,6 +848,8 @@ int call_debug(struct re_printf *pf, const struct call *call) call->local_name, call->local_uri, call->peer_name, call->peer_uri, net_af2name(call->af)); + err |= re_hprintf(pf, " direction: %s\n", + call->outgoing ? "Outgoing" : "Incoming"); /* SDP debug */ err |= sdp_session_debug(pf, call->sdp); @@ -1227,6 +1232,8 @@ int call_accept(struct call *call, struct sipsess_sock *sess_sock, if (!call || !msg) return EINVAL; + call->outgoing = false; + got_offer = (mbuf_get_left(msg->mb) > 0); err = pl_strdup(&call->peer_uri, &msg->from.auri); @@ -1670,3 +1677,9 @@ bool call_is_onhold(const struct call *call) { return call ? call->on_hold : false; } + + +bool call_is_outgoing(const struct call *call) +{ + return call ? call->outgoing : false; +} |