summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorEugene Voityuk <eugene@thirdlane.com>2015-12-02 20:42:15 +0200
committerEugene Voityuk <eugene@thirdlane.com>2015-12-08 15:50:47 -0600
commit28d924307940700ce2321572b016fdd8263ac7ad (patch)
tree7ab6f7e320d4cb23707ece6b776879ca56d58b30 /channels
parent246e513110e8b24dc9469472668a23f580a355bc (diff)
chan_sip.c: Start ICE negotiation when response is sent or received.
The current logic for ICE negotiation starts it when receiving an SDP with ICE candidates. This is incorrect as ICE negotiation can only start when each call party have at least one pair of local and remote candidate. Starting ICE negotiation early would result in negotiation failure and ultimately no audio. This change makes it so ICE negotiation is only started when a response with SDP is received or when a response with SDP is sent. ASTERISK-24146 Change-Id: I55a632bde9e9827871b09141d82747e08379a8ca
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 47b505d02..c54224570 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -10628,7 +10628,11 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
/* Setup audio address and port */
if (p->rtp) {
if (sa && portno > 0) {
- start_ice(p->rtp, (req->method != SIP_RESPONSE) ? 0 : 1);
+ /* Start ICE negotiation here, only when it is response, and setting that we are conrolling agent,
+ as we are offerer */
+ if (req->method == SIP_RESPONSE) {
+ start_ice(p->rtp, 1);
+ }
ast_sockaddr_set_port(sa, portno);
ast_rtp_instance_set_remote_address(p->rtp, sa);
if (debug) {
@@ -13402,6 +13406,11 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
if (!doing_directmedia) {
if (ast_test_flag(&p->flags[2], SIP_PAGE3_ICE_SUPPORT)) {
add_ice_to_sdp(p->rtp, &a_audio);
+ /* Start ICE negotiation, and setting that we are controlled agent,
+ as this is response to offer */
+ if (resp->method == SIP_RESPONSE) {
+ start_ice(p->rtp, 0);
+ }
}
add_dtls_to_sdp(p->rtp, &a_audio);