|
From: | Aymeric Moizard |
Subject: | Re: [osip-dev] eXosip and reINVITE |
Date: | Tue, 4 Sep 2018 16:40:52 +0200 |
Hi Aymeric.
Can eXosip handle (receive) OPTIONS requests ?
Regards.
On 6.08.2018 16:05, Aymeric Moizard wrote:
Hi!
How can I detect what exosip event message belongs to what call leg ?
I can't use cid as it is different for INVITE and RINGING for example.
You must use cid which remains the same for the compete call-leg.
If this is not the case, there is a bug. I doubt any such issue exists in exosip2...
Regards!Aymeric
Regards.
On 3.08.2018 18:16, Aymeric Moizard wrote:
2018-08-03 16:25 GMT+02:00 Tsvetan Filev <address@hidden>:
Aymeric,
the problem was wrong tid. I have to update my call states after reinvite.
That's it! ;)Thanks for helping me out.
You are welcome!I now have direct RTP media.
Good.AymericRegards.
On 3.08.2018 15:57, Tsvetan Filev wrote:
Yes here is the code:
l_ret = eXosip_call_send_answer(m_ctx, p_tid, p_sip_event, p_answer);
I have tid 1: Error Send OK result -3 tid 1
I guess this is wrong ?
On 3.08.2018 15:37, Aymeric Moizard wrote:
Le ven. 3 août 2018 à 14:19, Tsvetan Filev <address@hidden> a écrit :
Hey.
I checked out the latest exosip (last commit 6da834d2980d97e4ad7a59f6734884f6962b8267 from Mon Jul 2 11:37:23 2018 +0200) and osip2 (last commit 7a3f2cbabed8147017ac04846a117ae1e8f59386 from Wed Jun 20 17:35:37 2018 +0200) repos, I recompiled and reINVITE sends Trying automatically again.
Sorry about the debug. Here it is:
03/08/18-15:07:41:447656 |Received SIP message: 2, 'New call received!', cid=1
03/08/18-15:07:41:447686 |type 2 cid 1 did 2 tid 1 sid 0
03/08/18-15:07:41:469728 |Received SIP message: 5, 'Call is being processed!', cid=3
03/08/18-15:07:41:469755 |type 5 cid 3 did 0 tid 2 sid 0
03/08/18-15:07:41:538803 |Received SIP message: 6, 'Remote phone is ringing!', cid=3
03/08/18-15:07:41:538827 |type 6 cid 3 did 4 tid 2 sid 0
03/08/18-15:07:42:707314 |Received SIP message: 7, 'Remote phone has answered!', cid=3
03/08/18-15:07:42:707338 |type 7 cid 3 did 4 tid 2 sid 0
03/08/18-15:07:42:707892 |Received SIP message: 12, 'ACK received!', cid=1
03/08/18-15:07:42:707899 |type 12 cid 1 did 2 tid 1 sid 0
03/08/18-15:07:42:708515 |Received SIP message: 3, 'INVITE within call received!', cid=1
03/08/18-15:07:42:708522 |type 3 cid 1 did 2 tid 3 sid 0
03/08/18-15:07:42:708625 |eXosip invite returned cid = 0
03/08/18-15:07:42:711846 |Received SIP message: 5, 'Call is being processed!', cid=3
03/08/18-15:07:42:711855 |type 5 cid 3 did 4 tid 4 sid 0
03/08/18-15:07:42:711923 |Received SIP message: 7, 'Remote phone has answered!', cid=3
03/08/18-15:07:42:711927 |type 7 cid 3 did 4 tid 4 sid 0
03/08/18-15:07:42:712015 |Error Send OK -6
Please indicate the tid you use to send the answer! If I'm correct, it should be tid=3 and if I'm correct, the tid only is required for the API to send answer? Right?
Aymeric
On 3.08.2018 13:35, Aymeric Moizard wrote:
Hi!
Using the latest git is advised!
More inline:
Le ven. 3 août 2018 à 10:31, Tsvetan Filev <address@hidden> a écrit :
Aymeric,
I'm using 4.1.0 for both exosip and osip. At least this is what the latest documentation points to : http://www.antisip.com/doc/exosip2/
Anyway I updated to 5.0.0 and tested again without sending Trying manually.
Here is the log from eXosip node:
Initial INVITE
03/08/18-11:01:12:920830 |Received SIP message: 2, 'New call received!', cid=1
03/08/18-11:01:12:921048 |SIP message 2 received for cid=1, did=0, tid=0
I'm surprised to see did=0 and tid=0. Those value should be already set in the exosip_event (as shown right below)03/08/18-11:01:12:921067 |sip_call_ivite_rcv for cid=1, did=2, tid=1
Send INVITE to call leg 2
03/08/18-11:01:13:016953 |eXosip invite returned cid = 3
03/08/18-11:01:13:024636 |Received SIP message: 5, 'Call is being processed!', cid=3
03/08/18-11:01:13:024921 |SIP message 5 received for cid=3, did=0, tid=0Again, did=0 and tid=0 and the value should be set in exosip_event.Send trying to call leg 1
03/08/18-11:01:13:108228 |Received SIP message: 6, 'Remote phone is ringing!', cid=3
03/08/18-11:01:13:108366 |SIP message 6 received for cid=3, did=0, tid=0
Same comment as above.
Send ringing to call leg 1
03/08/18-11:01:13:108411 |Send ringing response result 0
03/08/18-11:01:14:099017 |Received SIP message: 7, 'Remote phone has answered!', cid=3
03/08/18-11:01:14:099187 |SIP message 7 received for cid=3, did=0, tid=0
Same comment as above.
Send OK to call leg 1
03/08/18-11:01:14:099219 |Send OK response result 0
03/08/18-11:01:14:100065 |Received SIP message: 12, 'ACK received!', cid=1
reINVTIE from call leg 1
03/08/18-11:01:14:101841 |Received SIP message: 3, 'INVITE within call received!', cid=1
03/08/18-11:01:14:101956 |SIP message 3 received for cid=1, did=0, tid=0
Same again.
Send reINVTIE to call leg 2
03/08/18-11:01:14:102023 |eXosip invite returned cid = 0
Cid=0 can't be true for a new transaction?
Got Trying and OK from call leg 2
03/08/18-11:01:14:103046 |Received SIP message: 5, 'Call is being processed!', cid=3
03/08/18-11:01:14:103127 |SIP message 5 received for cid=3, did=0, tid=0
...03/08/18-11:01:14:103397 |Received SIP message: 7, 'Remote phone has answered!', cid=3
03/08/18-11:01:14:103580 |SIP message 7 received for cid=3, did=0, tid=0
... tid
Send OK to call leg 1
03/08/18-11:01:14:103651 |Error Send OK -6
Only tid=0 exist in your log, but you should be able to display 4 tid (4 transactions)
Your logs could be improved to display the tid. If they are not set, there must be a bigger issue.
It is possible that you reuse too much the tags, call-id, via branch: and breaks the sip protocol. This may introduce unexpected matching for some messages that are considered part of wrong transactions.
I can't read the Wireshark capture: I'm on mobile.... ;)
RegardsAymeric
Attached is wireshark trace from the communication. Have a look at packet 381: eXosip is sending Trying again.
These are the nodes:
10.82.10.56:5065 - alice
10.82.10.56:5062 - asterisk 1
10.82.10.132:5060 - eXosip
10.82.12.55:5060 - asterisk 2
10.82.10.56:5064 - bob
Tnx
On 2.08.2018 18:32, Aymeric Moizard wrote:
Hi again!
100 is reserved to proxy. But exosip is a User-Agent, so you can sendanswers from 101 to 699. This explains why you have OSIP_BADPARAMETERwhen trying to send "100 Trying".
Old version of eXosip2 was sending 101 automatically, but newer versionare not sending it anymore to simplify interoperability.
More below!
2018-08-02 16:35 GMT+02:00 Tsvetan Filev <address@hidden>:
One thing I notice is that eXosip sends Trying automatically after reINVITE and when I try to send TRYING I get -2 OSIP_BADPARAMETER
If I try to send OK after reINVITE without sending manually TRYING I get -6 OSIP_NOTFOUNDDo you mean it works when you try to send a 100 Trying before the 200 Ok? (note that you said it's failing to send send100 Trying, and I confirmed it won't work)
Have you checked if the TID parameter you provide is correct?
In practice, this code seems to fail in eXcall_api.c:
if (tid > 0) {_eXosip_call_transaction_find (excontext, tid, &jc, &jd, &tr);}if (jd == NULL || tr == NULL || tr->orig_request == NULL || tr->orig_request->sip_method == NULL) {OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: No call here or no transaction for call\n"));osip_message_free (answer);return OSIP_NOTFOUND;}
You should compile exosip in debug, with logs, and see the exact reason : wrong tid? jd=NULL? tr=NULL?
If you use an old version of exosip, I would advise to upgrade to a recent. Latest/current git for both osip & exosipis advised.
RegardsAymeric
On 2.08.2018 16:50, Aymeric Moizard wrote:
I guess you need to track down the status of your incoming sip transaction and the value of the tid/cid/did you use to send the 200ok.
Mostly, the parameter of this method and the parameters you use inside this method:
send_answer(p_call_info_ua1.call_event_info.tid, SIP_OK, p_call_info_ua1.call_event_info.engine_session_id, l_answer
Aymeric
Le jeu. 2 août 2018 à 15:17, Tsvetan Filev <address@hidden> a écrit :
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
This is my send _ok code:
{
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;
}
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 asterisk1before you receive the SDP from 200 Ok from asterisk2. I'm not listing the otherpossible issue of a B2BUA, you may know them... ;)
You said you have an error, but, but you didn't told which errorand what you tried? Let me know more if you want help.
RegardsAymeric
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
--
Antisip - http://www.antisip.com
--
Antisip - http://www.antisip.com
--
Antisip - http://www.antisip.com
[Prev in Thread] | Current Thread | [Next in Thread] |