]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix an issue where outgoing calls would fail to establish audio due to ICE negotiatio...
authorJoshua Colp <jcolp@digium.com>
Thu, 11 Oct 2012 16:02:31 +0000 (16:02 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 11 Oct 2012 16:02:31 +0000 (16:02 +0000)
This change removes the requirement for ufrag and pwd in the transport stanza and also
makes us the controlling agent.

(closes issue ASTERISK-20554)
Reported by: mmichelson

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@374850 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_motif.c
res/res_rtp_asterisk.c

index 12e4b37f1fe0f95fb5f82d1ab34306cfff1604a0..12f42926b1ad0a2d6d37c9b61d83d7277fb73aa3 100644 (file)
@@ -1729,6 +1729,7 @@ static struct ast_channel *jingle_request(const char *type, struct ast_format_ca
        struct jingle_session *session;
        struct ast_channel *chan;
        enum jingle_transport transport = JINGLE_TRANSPORT_NONE;
+       struct ast_rtp_engine_ice *ice;
        AST_DECLARE_APP_ARGS(args,
                             AST_APP_ARG(name);
                             AST_APP_ARG(target);
@@ -1832,6 +1833,15 @@ static struct ast_channel *jingle_request(const char *type, struct ast_format_ca
                jingle_enable_video(session);
        }
 
+       /* As this is outgoing set ourselves as controlling */
+       if (session->rtp && (ice = ast_rtp_instance_get_ice(session->rtp))) {
+               ice->ice_lite(session->rtp);
+       }
+
+       if (session->vrtp && (ice = ast_rtp_instance_get_ice(session->vrtp))) {
+               ice->ice_lite(session->vrtp);
+       }
+
        /* We purposely don't decrement the session here as there is a reference on the channel */
        ao2_link(endpoint->state->sessions, session);
 
@@ -1939,14 +1949,10 @@ static int jingle_interpret_ice_udp_transport(struct jingle_session *session, ik
                return -1;
        }
 
-       if (ast_strlen_zero(ufrag) || ast_strlen_zero(pwd)) {
-               jingle_queue_hangup_with_cause(session, AST_CAUSE_PROTOCOL_ERROR);
-               ast_log(LOG_ERROR, "Invalid ICE-UDP transport information received on session '%s', ufrag or pwd not present\n", session->sid);
-               return -1;
+       if (!ast_strlen_zero(ufrag) && !ast_strlen_zero(pwd)) {
+               ice->set_authentication(rtp, ufrag, pwd);
        }
 
-       ice->set_authentication(rtp, ufrag, pwd);
-
        for (candidate = iks_child(transport); candidate; candidate = iks_next(candidate)) {
                char *component = iks_find_attrib(candidate, "component"), *foundation = iks_find_attrib(candidate, "foundation");
                char *generation = iks_find_attrib(candidate, "generation"), *id = iks_find_attrib(candidate, "id");
index a16dbac942c2cd36cd1a3a08b8c797d0aa311758..73fef432e6ba474e22999012b5cd75f0c510637a 100644 (file)
@@ -536,6 +536,8 @@ static void ast_rtp_ice_start(struct ast_rtp_instance *instance)
 
        ao2_iterator_destroy(&i);
 
+       ast_log(LOG_NOTICE, "ufrag = %s password = %s\n", rtp->remote_ufrag, rtp->remote_passwd);
+
        if (pj_ice_sess_create_check_list(rtp->ice, &ufrag, &passwd, ao2_container_count(rtp->remote_candidates), &candidates[0]) == PJ_SUCCESS) {
                pj_ice_sess_start_check(rtp->ice);
                pj_timer_heap_poll(timerheap, NULL);
@@ -4432,7 +4434,7 @@ static int load_module(void)
 {
        pj_lock_t *lock;
 
-       pj_log_set_level(0);
+//     pj_log_set_level(0);
 
        if (pj_init() != PJ_SUCCESS) {
                return AST_MODULE_LOAD_DECLINE;