osip-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [osip-dev] eXosip and reINVITE


From: Tsvetan Filev
Subject: Re: [osip-dev] eXosip and reINVITE
Date: Thu, 2 Aug 2018 16:17:01 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi Aymeric.

You are right the real workflow should be something like this: https://www.websequencediagrams.com/cgi-bin/cdraw?lz=cGFydGljaXBhbnQgYWxpY2UKAAUNc3Rlcmlza18xAAoNZVhvc2lwABQWMgA0DWJvYgoKIyBJbml0aWFsIGludml0ZQoAZAUgLT4AVQs6ABUHIChzZHApCgBvCgAiBQArBTogMTAwIFRyeWluZwASDwCBCwYANQ8AgSAGAFkOADcOAA8TMgBxGDIAXgoAcxcAHQVib2IAgTwPYm9iAFQOAIE7DgAKFjgwIFJpbmcAThIAeAoAGAsAgVIYADIUAIJDDgBdCwCBFBUyMDAgT0sAgXcVYm9iIDogQUNLAIIMGAAvDQCCVxQAOAcAgxEXAGUWAINkCwBuEACEHg0AgSsOAIReEgCBNAcKIyByZS0AhRAHAIQ3HmluLWRpYWxvZwCBNxsAASwAhH0PAHMLAIREJwCCUxYKAIIrJQCCdBsAglAbAIEUEACDfQYAggkXAIVZHwCENTk&s=rose 

I get -3 OSIP_WRONG_STATE.


This is how my SIP messages handler looks like:

CN_UBYTE handle_sip_event(const S_event_info& p_msg, S_call_info& p_ci) const
{
    p_ci.call_event_info = p_msg;

    switch (p_msg.type)
    {
        case EXOSIP_CALL_REINVITE:
            if(p_sm.m_ua1_p_ci and p_sm.m_ua2_p_ci)
            {
                // Send reINVITE to call leg 2
                send_reinvite(m_ua1_p_ci, m_ua2_p_ci);

                // Send 180 Ringing to call leg 1
                send_response(m_ua1_p_ci->call_event_info.tid, SIP_RINGING);
            }
            break;

        case EXOSIP_CALL_ANSWERED:
            // Send 200 OK to call leg 1
             if(m_ua1_p_ci and m_ua2_p_ci)
             {
                 get_sip_layer().send_ok(m_ua1_p_ci, m_ua2_p_ci);
             }

            break;

        default:
            break;
    }

    return 0;
}

This is my send _ok code:

int C_sip_layer::send_ok(sip::S_call_info& p_call_info_ua1, sip::S_call_info& p_call_info_ua2) const
{
    if(m_ctx == NULL)
    {
        return -1;
    }

    osip_message_t *l_answer;

    int l_i = eXosip_call_build_answer(m_ctx, p_call_info_ua1.call_event_info.tid, SIP_OK, &l_answer);

    if (l_i == 0)
    {
        sdp_message_t *l_remote_sdp = eXosip_get_remote_sdp_from_tid(m_ctx, p_call_info_ua2.call_event_info.tid);

        if(l_remote_sdp)
        {
            char* buf = nullptr;
            if(sdp_message_to_str (l_remote_sdp, &buf) == OSIP_SUCCESS and buf != nullptr) {
                osip_message_set_body(l_answer, buf, strlen(buf));
                osip_message_set_content_type (l_answer, sdp_content_type_str);
                free(buf);
            }
            sdp_message_free(l_remote_sdp);
        }
        if(l_i = send_answer(p_call_info_ua1.call_event_info.tid, SIP_OK, p_call_info_ua1.call_event_info.engine_session_id, l_answer))
        {
            printf("Error Send OK %d\n", l_i);
        }
    } else {
        printf("Error Build OK\n");
    }

    return l_i;
}



On 2.08.2018 16:04, Aymeric Moizard wrote:
Hello,

In the call flow you sent, the SDP from 200 Ok for re-INVITE is sent to asterisk1
before you receive the SDP from 200 Ok from asterisk2. I'm not listing the other
possible issue of a B2BUA, you may know them... ;)

You said you have an error, but, but you didn't told which error
and what you tried? Let me know more if you want help.

Regards
Aymeric


2018-08-02 14:50 GMT+02:00 Tsvetan Filev <address@hidden>:
Hi.

I'm trying to achieve the following SIP communication:

https://www.websequencediagrams.com/cgi-bin/cdraw?lz=cGFydGljaXBhbnQgYWxpY2UKAAUNc3Rlcmlza18xAAoNZVhvc2lwABQWMgA0DWJvYgoKIyBJbml0aWFsIGludml0ZQoAZAUgLT4AVQs6ABUHIChzZHApCgBvCgAiBQArBTogMTAwIFRyeWluZwASDwCBCwYANQ8AgSAGAFkOADcOAA8TMgBxGDIAXgoAcxcAHQVib2IAgTwPYm9iAFQOAIE7DgAKFjgwIFJpbmcAThIAeAoAGAsAgVIYADIUAIJDDgBdCwCBFBUyMDAgT0sAgXcVYm9iIDogQUNLAIIMGAAvDQCCVxQAOAcAgxEXAGUWAINkCwBuEACEHg0AgSsOAIReEgCBNAcKIyByZS0AhRAHAIQ3HmluLWRpYWxvZwCEIzwAgS0sAIUBHgCAfxAAhHkwAIJ2MQCDahUAggUXAIVVHwCEMTkK&s=rose

This is basically initial INVITE followed by reINVITE that tells the phones to use direct RTP traffic instead of RTP going through asterisk.
eXosip node is a transparent B2BUA written using the eXosip/osip2 library.
I set directmedia=outgoing to both asterisks which tells them to send reINVITE only to outgoing leg (the default asterisk behavior is to send to both legs https://wiki.asterisk.org/wiki/display/AST/SIP+Direct+Media+Reinvite+Glare+Avoidance).

So I have two call legs in my eXosip node : call leg 1 (asterisk 1) and call leg 2 (asterisk 2).

I was able to send successfully reINVITE from eXosip to asterisk 2 and Trying from eXosip to asterisk 1.
When I get OK from asterisk 2 and try to send OK to asterisk 1 by copying the sdp from asterisk 2 I get an error.

Is it possible to achieve this with eXosip and how ?

Regards.


_______________________________________________
osip-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/osip-dev



--


reply via email to

[Prev in Thread] Current Thread [Next in Thread]