#### Pre-Submission Checklist <!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply --> <!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above--> <!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list --> - [x] Commit message has the format required by CONTRIBUTING guide - [x] Commits are split per component (core, individual modules, libs, utils, ...) - [x] Each component has a single commit (if not, squash them into one commit) - [x] No commits to README files for modules (changes must be done to docbook files in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change - [x] Small bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds new functionality) - [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist: <!-- Go over all points below, and after creating the PR, tick the checkboxes that apply --> - [ ] PR should be backported to stable branches - [ ] Tested changes locally - [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description After enabling the Topos module, we ran into a bit of trouble with early in-dialog notifies. We use the `event: talk` package from Cisco Broadsoft to be able to do call control, as described in chapter 6 here: https://pubhub.devnetcloud.com/media/broadsoft-docs/docs/pdf/BW-SIPAccessSid...
This will send a NOTIFY with a header `Event: talk` before the first `200 OK`. Currently this doesn't work with the topos module, since the NOTIFY method without a B-side contact will not check the INVITE record. When added to those methods in `tps_msg.c`, it tries to check the SUBSCRIBE for all NOTIFY's in `tps_storage.c`. The NOTIFY with `Event: talk` will follow on an INVITE, so there was a small change needed there.
I've limited it to just the NOTIFY's with the `Event: talk` header, to minimize any impact.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3627
-- Commit Summary --
* topos: add compatiblity for early in-dialog NOTIFY
-- File Changes --
M src/modules/topos/tps_msg.c (5) M src/modules/topos/tps_storage.c (3)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3627.patch https://github.com/kamailio/kamailio/pull/3627.diff
@miconda commented on this pull request.
@@ -910,7 +910,10 @@ int tps_request_received(sip_msg_t *msg, int dialog)
goto error; } metid = get_cseq(msg)->method_id; - if((metid & (METHOD_BYE | METHOD_INFO | METHOD_PRACK | METHOD_UPDATE)) + if(((metid & (METHOD_BYE | METHOD_INFO | METHOD_PRACK | METHOD_UPDATE)) + || ((metid & (METHOD_NOTIFY)) + && (msg->event + && strncmp(msg->event->body.s, "talk", 4) == 0)))
I would skip checking the event body to be "talk", there may be other event types and I think it is not the proxy that should decide what events to be accepted in such case.
@miconda commented on this pull request.
@@ -1146,7 +1146,8 @@ int tps_db_load_branch(
if((get_cseq(msg)->method_id == METHOD_SUBSCRIBE) || ((get_cseq(msg)->method_id == METHOD_NOTIFY) - && (msg->event && msg->event->len > 0))) { + && (msg->event && msg->event->len > 0 + && strncmp(msg->event->body.s, "talk", 4) != 0))) {
Here is a new condition added that only event "talk" is accepted. The previous version accepted any other value there, so it can break something that was working before.
@mauritsderuiter95 commented on this pull request.
@@ -1146,7 +1146,8 @@ int tps_db_load_branch(
if((get_cseq(msg)->method_id == METHOD_SUBSCRIBE) || ((get_cseq(msg)->method_id == METHOD_NOTIFY) - && (msg->event && msg->event->len > 0))) { + && (msg->event && msg->event->len > 0 + && strncmp(msg->event->body.s, "talk", 4) != 0))) {
Yes, the previous version accepted any NOTIFY with an event, and therefore set `bInviteDlg = 0`. This doesn't work with the `Event: talk`, since in that specific case topos needs to look for an INVITE dialog instead of a SUBSCRIBE dialog. So it doesn't only accept event "talk", but the opposite: it accepts any event except "talk".
@mauritsderuiter95 pushed 1 commit.
a76e978390a800b2e30f7d83c1de02c82b6497f0 topos: remove event: talk check from proxy
@mauritsderuiter95 commented on this pull request.
@@ -910,7 +910,10 @@ int tps_request_received(sip_msg_t *msg, int dialog)
goto error; } metid = get_cseq(msg)->method_id; - if((metid & (METHOD_BYE | METHOD_INFO | METHOD_PRACK | METHOD_UPDATE)) + if(((metid & (METHOD_BYE | METHOD_INFO | METHOD_PRACK | METHOD_UPDATE)) + || ((metid & (METHOD_NOTIFY)) + && (msg->event + && strncmp(msg->event->body.s, "talk", 4) == 0)))
Alright
Indeed, I've seen wrongly the condition about accepting event `talk`.
As I looked at the code and took in consideration this case, I've just pushed a different commit that should handle any NOTIFY even during the INVITE-based call setup, by ignoring the method type in loading the storage record.
Given that the method value is not explicitly needed for identifying the messages within dialog, I think this way is more flexible, to be able to cope also with other Event header values. It is also from the perspective that I would prefer to have it more in the style of the SIP proxy forwarding, where it does not really care about the header values, but the type of traffic.
Can you test with git master branch and see if it works for your case? I had no option to test something like that here.
Can you test with git master branch and see if it works for your case? I had no option to test something like that here.
While it does work with the early in-dialog NOTIFY messages, my BLF tests are suddenly failing. Looking at the SQL queries, it looks for a tag in the `b_tag` column, but in the value it is looking for is in the `a_tag` column. Not really sure yet what is going on there, but just so you know I'm looking into it.
I pushed another commit (06ce65a2bbea826b890a3712cf1ac4f8b53e54cd) to master branch. Can you test again?
Also with that commit added, it is not working. The log line `no stored record for INVITE` is triggered. So I was looking what's currently in the database and which query it is doing. I've filtered out the IP addresses of course:
```sql select * from topos_t; +------+---------------------+-----------+-----------+--------+--------------------------------------+----------------------+----------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------+-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+------------------------------+-------+--------------------------------------------------------------------------------+-------------------------------------------------------------------------+------------------------------------------------+------------------------------------------------+--------------------------------------+--------------------------------------+--------------------------------------+-----------+-----------+----------+----------+ | id | rectime | x_context | s_method | s_cseq | a_callid | a_uuid | b_uuid | direction | x_via | x_vbranch | x_rr | y_rr | s_rr | x_uri | a_contact | b_contact | as_contact | bs_contact | x_tag | a_tag | b_tag | a_srcaddr | b_srcaddr | a_socket | b_socket | +------+---------------------+-----------+-----------+--------+--------------------------------------+----------------------+----------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------+-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+------------------------------+-------+--------------------------------------------------------------------------------+-------------------------------------------------------------------------+------------------------------------------------+------------------------------------------------+--------------------------------------+--------------------------------------+--------------------------------------+-----------+-----------+----------+----------+ | 5231 | 2023-11-21 19:41:23 | | SUBSCRIBE | 17719 | 0d46940de2e2d6fc | atpsh-655cef84-73c-5 | btpsh-655cef84-73c-5 | 0 | SIP/2.0/UDP 123.456.78.910:43233;received=123.456.78.910;branch=z9hG4bKaf32841f6b079d99;rport=43233 | z9hG4bKc39b.b929a632c72af688f3322f3a1dfab19a.0 | | | sip:123.456.78.910:8060;lr | | sip:phone_533129_0-360870417@123.456.78.910:43233;alias=123.456.78.910~43233~1 | | sip:atpsh-655cef84-73c-5@123.456.78.910:8060 | sip:btpsh-655cef84-73c-5@123.456.78.910:8060 | 1352a62f28284315 | 1352a62f28284315 | | | | | | | 5234 | 2023-11-21 19:41:23 | | SUBSCRIBE | 17720 | 0d46940de2e2d6fc | atpsh-655cef84-738-7 | btpsh-655cef84-738-7 | 0 | SIP/2.0/UDP 123.456.78.910:43233;received=123.456.78.910;branch=z9hG4bKb9f6e728e390e8e6;rport=43233 | z9hG4bK139b.c13bf8f8fdb01c081f3f5daedb12c454.0 | | | sip:123.456.78.910:8060;lr | | sip:phone_533129_0-360870417@123.456.78.910:43233;alias=123.456.78.910~43233~1 | | sip:atpsh-655cef84-738-7@123.456.78.910:8060 | sip:btpsh-655cef84-738-7@123.456.78.910:8060 | 1352a62f28284315 | 1352a62f28284315 | | | | | | | 5237 | 2023-11-21 19:41:24 | | INVITE | 9439 | 63c77fbe-d2ab-4a9e-a6fd-aec68122603e | atpsh-655cef84-733-5 | btpsh-655cef84-733-5 | 0 | SIP/2.0/UDP 123.456.78.910:38449;received=123.456.78.910;rport=38449;branch=z9hG4bKPjd7ab7540-9887-4b47-9aef-c14aba9ba3ac | z9hG4bK49ca.e04110c580aa0c2dde9013b0214d69e3.0 | | | sip:123.456.78.910:8060;lr | | sip:phone_533129_0@123.456.78.910:38449;ob;alias=123.456.78.910~38449~1 | | sip:atpsh-655cef84-733-5@123.456.78.910:8060 | sip:btpsh-655cef84-733-5@123.456.78.910:8060 | 7da593a3-fb4e-4689-8c8e-b5c942a61939 | 7da593a3-fb4e-4689-8c8e-b5c942a61939 | | | | | | | 5240 | 2023-11-21 19:41:24 | | INVITE | 9440 | 63c77fbe-d2ab-4a9e-a6fd-aec68122603e | atpsh-655cef84-73b-7 | btpsh-655cef84-73b-7 | 0 | SIP/2.0/UDP 123.456.78.910:38449;received=123.456.78.910;rport=38449;branch=z9hG4bKPj567f3f03-b450-4165-958a-a065ccf7302f | z9hG4bKce9a.8524a50fa147c71567722224647bb9dd.0 | | sip:123.456.78.910:8065;lr;ftag=7da593a3-fb4e-4689-8c8e-b5c942a61939;did=dc3.87c1 | sip:123.456.78.910:8060;lr | | sip:phone_533129_0@123.456.78.910:38449;ob;alias=123.456.78.910~38449~1 | sip:123.456.78.910:8066 | sip:atpsh-655cef84-73b-7@123.456.78.910:8060 | sip:btpsh-655cef84-73b-7@123.456.78.910:8060 | 7da593a3-fb4e-4689-8c8e-b5c942a61939 | 7da593a3-fb4e-4689-8c8e-b5c942a61939 | 7cbea23b-a500-4301-be2d-b1e768cb79a8 | | | | | | 5243 | 2023-11-21 19:41:25 | | INVITE | 17887 | 580087e3-b220-4377-b6af-ee02578be7ee | atpsh-655cef84-732-7 | btpsh-655cef84-732-7 | 0 | SIP/2.0/UDP 987.654.3.210:8065;branch=z9hG4bKd459.dba4940fca90c84e875f37cb94d2eb46.0,SIP/2.0/UDP 123.456.78.910:8066;received=123.456.78.910;rport=8066;branch=z9hG4bKPj97d1606d-0f56-4e7f-a469-195304ecfe2b | z9hG4bKd459.507dc49c8d948c0da2c4d8a7f04f9bd4.0 | sip:987.654.3.210:8065;lr;ftag=d78d0bd2-28f9-42aa-ad43-6993814e92e5;did=4aa.47b2 | | sip:123.456.78.910:8060;lr | | sip:201@123.456.78.910:8066 | sip:phone_533132_0@123.456.78.910:38449;ob;alias=123.456.78.910~38449~1 | sip:atpsh-655cef84-732-7@123.456.78.910:8060 | sip:btpsh-655cef84-732-7@123.456.78.910:8060 | d78d0bd2-28f9-42aa-ad43-6993814e92e5 | d78d0bd2-28f9-42aa-ad43-6993814e92e5 | 4adc36cc-4335-4ce9-93bd-8b6eb226e046 | | | | | | 5246 | 2023-11-21 19:41:25 | | INVITE | 16441 | 055fa0d5-a5a8-401f-ae56-86663cbbaaa9 | atpsh-655cef84-738-8 | btpsh-655cef84-738-8 | 0 | SIP/2.0/UDP 123.456.78.910:8065;branch=z9hG4bK0da1.3ee7af44b4af377d2ff5d1ad75eb4825.0,SIP/2.0/UDP 123.456.78.910:8066;received=123.456.78.910;rport=8066;branch=z9hG4bKPjc88d1489-8c01-49a3-a82c-6d91a4df383c | z9hG4bK0da1.4aab292eba10ffc58ddf5c5e3723906b.0 | sip:123.456.78.910:8065;lr;ftag=39fddff3-2fd6-477e-8c03-e9bcc932e91b;did=4dc.e301 | | sip:123.456.78.910:8060;lr | | sip:201@123.456.78.910:8066 | sip:phone_533135_0@123.456.78.910:38449;ob;alias=123.456.78.910~38449~1 | sip:atpsh-655cef84-738-8@123.456.78.910:8060 | sip:btpsh-655cef84-738-8@123.456.78.910:8060 | 39fddff3-2fd6-477e-8c03-e9bcc932e91b | 39fddff3-2fd6-477e-8c03-e9bcc932e91b | 1e2a697d-6ee1-44f5-95f8-b13d81511873 | | | | | +------+---------------------+-----------+-----------+--------+--------------------------------------+----------------------+----------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------+-------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+------------------------------+-------+--------------------------------------------------------------------------------+-------------------------------------------------------------------------+------------------------------------------------+------------------------------------------------+--------------------------------------+--------------------------------------+--------------------------------------+-----------+-----------+----------+----------+ ```
```sql select * from topos_d; +------+---------------------+-----------+-----------+--------+--------------------------------------+-------------------------+-------------------------+---------------------------------------------------------------------------------------------------+-------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------+-------------------------------------------+-------------------------------------------------------------------------------------+------+-------------------------------------------------------------------------------------+--------+-------+-------+-------+-----------+-----------+----------+----------+ | id | rectime | x_context | s_method | s_cseq | a_callid | a_uuid | b_uuid | a_contact | b_contact | as_contact | bs_contact | a_tag | b_tag | a_rr | b_rr | s_rr | iflags | a_uri | b_uri | r_uri | a_srcaddr | b_srcaddr | a_socket | b_socket | +------+---------------------+-----------+-----------+--------+--------------------------------------+-------------------------+-------------------------+---------------------------------------------------------------------------------------------------+-------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------+-------------------------------------------+-------------------------------------------------------------------------------------+------+-------------------------------------------------------------------------------------+--------+-------+-------+-------+-----------+-----------+----------+----------+ | 1571 | 2023-11-21 19:41:23 | | SUBSCRIBE | 17719 | 0d46940de2e2d6fc | atpsh-655cef84-73c-5 | btpsh-655cef84-73c-5 | sip:phone_533129_0-360870417@123.456.78.910:43233;alias=123.456.78.910~43233~1 | | sip:atpsh-655cef84-73c-5@123.456.78.910:8060 | sip:btpsh-655cef84-73c-5@123.456.78.910:8060 | 1352a62f28284315 | | | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1574 | 2023-11-21 19:41:55 | | SUBSCRIBE | 17720 | 0d46940de2e2d6fc | atpsh-655cef84-738-7 | btpsh-655cef84-738-7 | sip:phone_533129_0-360870417@123.456.78.910:43233;alias=123.456.78.910~43233~1 | sip:123.456.78.910:8067 | sip:atpsh-655cef84-738-7@123.456.78.910:8060 | sip:btpsh-655cef84-738-7@123.456.78.910:8060 | 1352a62f28284315 | 01ed138498061afc1be350944aa9ed96-25adc4a2 | | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1577 | 2023-11-21 19:41:24 | | INVITE | 9439 | 63c77fbe-d2ab-4a9e-a6fd-aec68122603e | atpsh-655cef84-733-5 | btpsh-655cef84-733-5 | sip:phone_533129_0@123.456.78.910:38449;ob;alias=123.456.78.910~38449~1 | | sip:atpsh-655cef84-733-5@123.456.78.910:8060 | sip:btpsh-655cef84-733-5@123.456.78.910:8060 | 7da593a3-fb4e-4689-8c8e-b5c942a61939 | | | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1580 | 2023-11-21 19:41:24 | | INVITE | 9440 | 63c77fbe-d2ab-4a9e-a6fd-aec68122603e | atpsh-655cef84-73b-7 | btpsh-655cef84-73b-7 | sip:phone_533129_0@123.456.78.910:38449;ob;alias=123.456.78.910~38449~1 | | sip:atpsh-655cef84-73b-7@123.456.78.910:8060 | sip:btpsh-655cef84-73b-7@123.456.78.910:8060 | 7da593a3-fb4e-4689-8c8e-b5c942a61939 | | | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1583 | 2023-11-21 19:41:25 | | INVITE | 17887 | 580087e3-b220-4377-b6af-ee02578be7ee | atpsh-655cef84-732-7 | btpsh-655cef84-732-7 | sip:201@123.456.78.910:8066 | | sip:atpsh-655cef84-732-7@123.456.78.910:8060 | sip:btpsh-655cef84-732-7@123.456.78.910:8060 | d78d0bd2-28f9-42aa-ad43-6993814e92e5 | | sip:987.654.3.210:8065;lr;ftag=d78d0bd2-28f9-42aa-ad43-6993814e92e5;did=4aa.47b2 | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1586 | 2023-11-21 19:41:25 | | INVITE | 16441 | 055fa0d5-a5a8-401f-ae56-86663cbbaaa9 | atpsh-655cef84-738-8 | btpsh-655cef84-738-8 | sip:201@123.456.78.910:8066 | | sip:atpsh-655cef84-738-8@123.456.78.910:8060 | sip:btpsh-655cef84-738-8@123.456.78.910:8060 | 39fddff3-2fd6-477e-8c03-e9bcc932e91b | | sip:123.456.78.910:8065;lr;ftag=39fddff3-2fd6-477e-8c03-e9bcc932e91b;did=4dc.e301 | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | +------+---------------------+-----------+-----------+--------+--------------------------------------+-------------------------+-------------------------+---------------------------------------------------------------------------------------------------+-------------------------+-----------------------------------------------------------------+---------------------------------------------------+--------------------------------------+-------------------------------------------+-------------------------------------------------------------------------------------+------+-------------------------------------------------------------------------------------+--------+-------+-------+-------+-----------+-----------+----------+----------+ ```
The query that goes wrong is: ```sql select `rectime`,`a_callid`,`a_uuid`,`b_uuid`,`direction`,`x_via`,`x_vbranch`,`x_rr`,`y_rr`,`s_rr`,`x_uri`,`x_tag`,`s_method`,`s_cseq`,`a_contact`,`b_contact`,`as_contact`,`bs_contact`,`a_tag`,`b_tag` from `topos_t` where `a_callid`='0d46940de2e2d6fc' AND `b_tag`='01ed138498061afc1be350944aa9ed96-25adc4a2' AND `b_uuid`='btpsh-655cef84-738-7'; ```
For as far as I could figure out, it is looking for a subscribe in the transaction table, with a certain `b_tag`, but the `SUBSCRIBE` rows in the transaction table do not have a value in their `b_tag` columns. But the dialog table has a subscribe with that exact `b_tag`.
Are you using stock kamailio master branch? Or do you have other custom changes done locally?
The branch record for NOTIFY should be loaded only if the dialog record is not found for it, or it is found by has to b-side contact. But I see the corresponding record in the dialog. Can you get the sql query that is done in this case for topos_d table? Should be just before the query done to topos_t table.
At the time of the last message, I was at the 5.6 with the 2 commits cherry-picked on it. I'm sorry, I should have mentioned it. I'm now using the master branch. I ran into a problem where the auth module does a `select secret, secre, ...`, but I couldn't immediately find the reason, so I worked around it.
Anyway, it didn't fix the issue for me, so I went looking further. This is the query that's just before the earlier mentioned one:
```sql select `rectime`,`a_callid`,`a_uuid`,`b_uuid`,`a_contact`,`b_contact`,`as_contact`,`bs_contact`,`a_tag`,`b_tag`,`a_rr`,`b_rr`,`s_rr`,`iflags`,`a_uri`,`b_uri`,`r_uri`,`a_srcaddr`,`b_srcaddr`,`s_method`,`s_cseq` from `topos_d` where `b_uuid`='btpsh-655e0722-8653-1' ```
The tables at that time are:
```sql select * from topos_d; +------+---------------------+-----------+-----------+--------+--------------------------------------+-----------------------+-----------------------+-------------------------------------------------------------------------------+-------------------------+-------------------------------------------------+-------------------------------------------------+--------------------------------------+-------------------------------------------+-------------------------------------------------------------------------------------+------+------------------------------+--------+-------+-------+-------+-----------+-----------+----------+----------+ | id | rectime | x_context | s_method | s_cseq | a_callid | a_uuid | b_uuid | a_contact | b_contact | as_contact | bs_contact | a_tag | b_tag | a_rr | b_rr | s_rr | iflags | a_uri | b_uri | r_uri | a_srcaddr | b_srcaddr | a_socket | b_socket | +------+---------------------+-----------+-----------+--------+--------------------------------------+-----------------------+-----------------------+-------------------------------------------------------------------------------+-------------------------+-------------------------------------------------+-------------------------------------------------+--------------------------------------+-------------------------------------------+-------------------------------------------------------------------------------------+------+------------------------------+--------+-------+-------+-------+-----------+-----------+----------+----------+ | 1907 | 2023-11-22 14:50:49 | | SUBSCRIBE | 4499 | f40e29291da360e7 | atpsh-655e0722-8655-1 | btpsh-655e0722-8655-1 | sip:phone_537935_0-87778069@123.456.78.910:50226;alias=123.456.78.910~50226~1 | | sip:atpsh-655e0722-8655-1@123.456.78.910:8060 | sip:btpsh-655e0722-8655-1@123.456.78.910:8060 | dc481dcd29713c0c | | | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1910 | 2023-11-22 14:50:49 | | SUBSCRIBE | 4500 | f40e29291da360e7 | atpsh-655e0722-8653-1 | btpsh-655e0722-8653-1 | sip:phone_537935_0-87778069@123.456.78.910:50226;alias=123.456.78.910~50226~1 | sip:123.456.78.910:8067 | sip:atpsh-655e0722-8653-1@123.456.78.910:8060 | sip:btpsh-655e0722-8653-1@123.456.78.910:8060 | dc481dcd29713c0c | 01ed138498061afc1be350944aa9ed96-b9a06c7b | | | sip:123.456.78.910:8060;lr | 2 | | | | | | | | | 1913 | 2023-11-22 14:50:50 | | INVITE | 23920 | e7d9fb2b-f404-4071-a1d1-7f572dcbd6ee | atpsh-655e0722-864d-1 | btpsh-655e0722-864d-1 | sip:phone_537935_0@123.456.78.910:60379;ob;alias=123.456.78.910~60379~1 | | sip:atpsh-655e0722-864d-1@123.456.78.910:8060 | sip:btpsh-655e0722-864d-1@123.456.78.910:8060 | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | | | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1916 | 2023-11-22 14:50:52 | | INVITE | 23920 | e7d9fb2b-f404-4071-a1d1-7f572dcbd6ee | atpsh-655e0722-8656-1 | btpsh-655e0722-8656-1 | sip:phone_537935_0@123.456.78.910:60379;ob;alias=123.456.78.910~60379~1 | | sip:atpsh-655e0722-8656-1@123.456.78.910:8060 | sip:btpsh-655e0722-8656-1@123.456.78.910:8060 | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | | | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1919 | 2023-11-22 14:50:52 | | INVITE | 23921 | e7d9fb2b-f404-4071-a1d1-7f572dcbd6ee | atpsh-655e0722-8654-1 | btpsh-655e0722-8654-1 | sip:phone_537935_0@123.456.78.910:60379;ob;alias=123.456.78.910~60379~1 | | sip:atpsh-655e0722-8654-1@123.456.78.910:8060 | sip:btpsh-655e0722-8654-1@123.456.78.910:8060 | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | | | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1922 | 2023-11-22 14:50:54 | | INVITE | 23921 | e7d9fb2b-f404-4071-a1d1-7f572dcbd6ee | atpsh-655e0722-8656-2 | btpsh-655e0722-8656-2 | sip:phone_537935_0@123.456.78.910:60379;ob;alias=123.456.78.910~60379~1 | | sip:atpsh-655e0722-8656-2@123.456.78.910:8060 | sip:btpsh-655e0722-8656-2@123.456.78.910:8060 | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | | | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1925 | 2023-11-22 14:50:57 | | INVITE | 30484 | 65f0f0d0-d6c1-48fb-8efb-4c403d5d53fc | atpsh-655e0722-864e-1 | btpsh-655e0722-864e-1 | sip:201@123.456.78.910:8066 | | sip:atpsh-655e0722-864e-1@123.456.78.910:8060 | sip:btpsh-655e0722-864e-1@123.456.78.910:8060 | dd691130-7385-48f4-83fe-b6f7d508762a | | sip:123.456.78.910:8065;lr;ftag=dd691130-7385-48f4-83fe-b6f7d508762a;did=466.7271 | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | | 1928 | 2023-11-22 14:50:58 | | INVITE | 21501 | 898c1855-9925-49ff-84ad-ae9c2f742f5c | atpsh-655e0722-8653-2 | btpsh-655e0722-8653-2 | sip:201@123.456.78.910:8066 | | sip:atpsh-655e0722-8653-2@123.456.78.910:8060 | sip:btpsh-655e0722-8653-2@123.456.78.910:8060 | ed3cee0b-f5c7-4668-b8ce-f68d60a0042f | | sip:123.456.78.910:8065;lr;ftag=ed3cee0b-f5c7-4668-b8ce-f68d60a0042f;did=aee.6d6 | | sip:123.456.78.910:8060;lr | 0 | | | | | | | | +------+---------------------+-----------+-----------+--------+--------------------------------------+-----------------------+-----------------------+-------------------------------------------------------------------------------+-------------------------+-------------------------------------------------+-------------------------------------------------+--------------------------------------+-------------------------------------------+-------------------------------------------------------------------------------------+------+------------------------------+--------+-------+-------+-------+-----------+-----------+----------+----------+ ```
```sql select * from topos_t; +------+---------------------+-----------+-----------+--------+--------------------------------------+-----------------------+-----------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------+-------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+------------------------------+-------+-------------------------------------------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------+-------------------------------------------------+--------------------------------------+--------------------------------------+--------------------------------------+-----------+-----------+----------+----------+ | id | rectime | x_context | s_method | s_cseq | a_callid | a_uuid | b_uuid | direction | x_via | x_vbranch | x_rr | y_rr | s_rr | x_uri | a_contact | b_contact | as_contact | bs_contact | x_tag | a_tag | b_tag | a_srcaddr | b_srcaddr | a_socket | b_socket | +------+---------------------+-----------+-----------+--------+--------------------------------------+-----------------------+-----------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------+-------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+------------------------------+-------+-------------------------------------------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------+-------------------------------------------------+--------------------------------------+--------------------------------------+--------------------------------------+-----------+-----------+----------+----------+ | 5651 | 2023-11-22 14:50:49 | | SUBSCRIBE | 4499 | f40e29291da360e7 | atpsh-655e0722-8655-1 | btpsh-655e0722-8655-1 | 0 | SIP/2.0/UDP 123.456.78.910:50226;received=123.456.78.910;branch=z9hG4bK961e68c0c5519e4f;rport=50226 | z9hG4bK09ff.77405be1a1aff2a4b55dc0862955849b.0 | | | sip:123.456.78.910:8060;lr | | sip:phone_537935_0-87778069@123.456.78.910:50226;alias=123.456.78.910~50226~1 | | sip:atpsh-655e0722-8655-1@123.456.78.910:8060 | sip:btpsh-655e0722-8655-1@123.456.78.910:8060 | dc481dcd29713c0c | dc481dcd29713c0c | | | | | | | 5654 | 2023-11-22 14:50:49 | | SUBSCRIBE | 4500 | f40e29291da360e7 | atpsh-655e0722-8653-1 | btpsh-655e0722-8653-1 | 0 | SIP/2.0/UDP 123.456.78.910:50226;received=123.456.78.910;branch=z9hG4bK225b9a1e575e6121;rport=50226 | z9hG4bKac7d.d0f51ec08def55fa345c32731847bccf.0 | | | sip:123.456.78.910:8060;lr | | sip:phone_537935_0-87778069@123.456.78.910:50226;alias=123.456.78.910~50226~1 | | sip:atpsh-655e0722-8653-1@123.456.78.910:8060 | sip:btpsh-655e0722-8653-1@123.456.78.910:8060 | dc481dcd29713c0c | dc481dcd29713c0c | | | | | | | 5657 | 2023-11-22 14:50:50 | | INVITE | 23920 | e7d9fb2b-f404-4071-a1d1-7f572dcbd6ee | atpsh-655e0722-864d-1 | btpsh-655e0722-864d-1 | 0 | SIP/2.0/UDP 123.456.78.910:60379;received=123.456.78.910;rport=60379;branch=z9hG4bKPj0d6bcdbe-7b6c-484c-a300-a4aa17a03df1 | z9hG4bK4218.c548b9bd819f3d50a13f343055973505.0 | | | sip:123.456.78.910:8060;lr | | sip:phone_537935_0@123.456.78.910:60379;ob;alias=123.456.78.910~60379~1 | | sip:atpsh-655e0722-864d-1@123.456.78.910:8060 | sip:btpsh-655e0722-864d-1@123.456.78.910:8060 | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | | | | | | | 5660 | 2023-11-22 14:50:52 | | INVITE | 23920 | e7d9fb2b-f404-4071-a1d1-7f572dcbd6ee | atpsh-655e0722-8656-1 | btpsh-655e0722-8656-1 | 0 | SIP/2.0/UDP 123.456.78.910:60379;received=123.456.78.910;rport=60379;branch=z9hG4bKPj0d6bcdbe-7b6c-484c-a300-a4aa17a03df1 | z9hG4bK4218.c548b9bd819f3d50a13f343055973505.1 | | | sip:123.456.78.910:8060;lr | | sip:phone_537935_0@123.456.78.910:60379;ob;alias=123.456.78.910~60379~1 | | sip:atpsh-655e0722-8656-1@123.456.78.910:8060 | sip:btpsh-655e0722-8656-1@123.456.78.910:8060 | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | | | | | | | 5663 | 2023-11-22 14:50:52 | | INVITE | 23921 | e7d9fb2b-f404-4071-a1d1-7f572dcbd6ee | atpsh-655e0722-8654-1 | btpsh-655e0722-8654-1 | 0 | SIP/2.0/UDP 123.456.78.910:60379;received=123.456.78.910;rport=60379;branch=z9hG4bKPj39d687d9-8992-4457-9139-ce213d551f86 | z9hG4bK5218.0a0ffaf3f11e06deee9ccab5971d764d.0 | | | sip:123.456.78.910:8060;lr | | sip:phone_537935_0@123.456.78.910:60379;ob;alias=123.456.78.910~60379~1 | | sip:atpsh-655e0722-8654-1@123.456.78.910:8060 | sip:btpsh-655e0722-8654-1@123.456.78.910:8060 | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | | | | | | | 5666 | 2023-11-22 14:50:54 | | INVITE | 23921 | e7d9fb2b-f404-4071-a1d1-7f572dcbd6ee | atpsh-655e0722-8656-2 | btpsh-655e0722-8656-2 | 0 | SIP/2.0/UDP 123.456.78.910:60379;received=123.456.78.910;rport=60379;branch=z9hG4bKPj39d687d9-8992-4457-9139-ce213d551f86 | z9hG4bK5218.0a0ffaf3f11e06deee9ccab5971d764d.1 | | sip:123.456.78.910:8065;lr;ftag=9ceebb32-139c-4968-8b1f-0ea5329cc25a;did=a1.8141 | sip:123.456.78.910:8060;lr | | sip:phone_537935_0@123.456.78.910:60379;ob;alias=123.456.78.910~60379~1 | sip:123.456.78.910:8066 | sip:atpsh-655e0722-8656-2@123.456.78.910:8060 | sip:btpsh-655e0722-8656-2@123.456.78.910:8060 | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | 9ceebb32-139c-4968-8b1f-0ea5329cc25a | 7f5c6da6-48b8-4f57-8053-2739383377a2 | | | | | | 5669 | 2023-11-22 14:50:57 | | INVITE | 30484 | 65f0f0d0-d6c1-48fb-8efb-4c403d5d53fc | atpsh-655e0722-864e-1 | btpsh-655e0722-864e-1 | 0 | SIP/2.0/UDP 123.456.78.910:8065;branch=z9hG4bK93ff.b147e2cfe641dee654399798782d37a6.0,SIP/2.0/UDP 123.456.78.910:8066;received=123.456.78.910;rport=8066;branch=z9hG4bKPjc880be8a-9c03-439e-9eb6-f42c56b9c62e | z9hG4bK93ff.48aba8c79801a9d666ea6f9a526c5925.0 | sip:123.456.78.910:8065;lr;ftag=dd691130-7385-48f4-83fe-b6f7d508762a;did=466.7271 | | sip:123.456.78.910:8060;lr | | sip:201@123.456.78.910:8066 | sip:phone_537938_0@123.456.78.910:60379;ob;alias=123.456.78.910~60379~1 | sip:atpsh-655e0722-864e-1@123.456.78.910:8060 | sip:btpsh-655e0722-864e-1@123.456.78.910:8060 | dd691130-7385-48f4-83fe-b6f7d508762a | dd691130-7385-48f4-83fe-b6f7d508762a | c65045a5-7bf8-4ac3-8844-2eeb3af6e4b5 | | | | | | 5672 | 2023-11-22 14:50:58 | | INVITE | 21501 | 898c1855-9925-49ff-84ad-ae9c2f742f5c | atpsh-655e0722-8653-2 | btpsh-655e0722-8653-2 | 0 | SIP/2.0/UDP 123.456.78.910:8065;branch=z9hG4bKbb5e.1ce976f13bdb3a62c8cb7bdfb5a8bac7.0,SIP/2.0/UDP 123.456.78.910:8066;received=123.456.78.910;rport=8066;branch=z9hG4bKPjf105594d-0d18-4623-80a9-4f5707bd32ec | z9hG4bKbb5e.68189bc8f760e10150c957c63540b8f0.0 | sip:123.456.78.910:8065;lr;ftag=ed3cee0b-f5c7-4668-b8ce-f68d60a0042f;did=aee.6d6 | | sip:123.456.78.910:8060;lr | | sip:201@123.456.78.910:8066 | sip:phone_537941_0@123.456.78.910:60379;ob;alias=123.456.78.910~60379~1 | sip:atpsh-655e0722-8653-2@123.456.78.910:8060 | sip:btpsh-655e0722-8653-2@123.456.78.910:8060 | ed3cee0b-f5c7-4668-b8ce-f68d60a0042f | ed3cee0b-f5c7-4668-b8ce-f68d60a0042f | 18d2ccd9-5d16-42b1-89b8-e2433b4be6b8 | | | | | +------+---------------------+-----------+-----------+--------+--------------------------------------+-----------------------+-----------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------+-------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+------------------------------+-------+-------------------------------------------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------+-------------------------------------------------+--------------------------------------+--------------------------------------+--------------------------------------+-----------+-----------+----------+----------+ ```
So, I'd expect it would get the `b_contact` from the row in the dialog table with id `1910`. But according to the log it doesn't have that data:
```sh 2023-11-22T14:50:49.922538+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:185]: db_str2val(): converting DATETIME [2023-11-22 14:50:49] 2023-11-22T14:50:49.922568+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [f40e29291da360e7] 2023-11-22T14:50:49.922595+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [atpsh-655e0722-8653-1] 2023-11-22T14:50:49.922625+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [btpsh-655e0722-8653-1] 2023-11-22T14:50:49.922716+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [sip:phone_537935_0-87778069@123.456.78.910:50226;alias=123.456.78.910~50226~1] 2023-11-22T14:50:49.922748+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [] # I expected the b_contact here 2023-11-22T14:50:49.922774+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [sip:atpsh-655e0722-8653-1@123.456.78.910:8060] 2023-11-22T14:50:49.922894+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [sip:btpsh-655e0722-8653-1@123.456.78.910:8060] 2023-11-22T14:50:49.922926+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [dc481dcd29713c0c] 2023-11-22T14:50:49.923040+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [01ed138498061afc1be350944aa9ed96-b9a06c7b] 2023-11-22T14:50:49.923090+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:196]: db_str2val(): converting BLOB [] 2023-11-22T14:50:49.923140+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:196]: db_str2val(): converting BLOB [] 2023-11-22T14:50:49.923169+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:196]: db_str2val(): converting BLOB [sip:123.456.78.910:8060;lr] 2023-11-22T14:50:49.923215+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:74]: db_str2val(): converting INT [2] 2023-11-22T14:50:49.923288+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [] 2023-11-22T14:50:49.923417+01:00 debug balancer[34388]: message repeated 4 times: [ DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING []] 2023-11-22T14:50:49.923443+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [SUBSCRIBE] 2023-11-22T14:50:49.923490+01:00 debug balancer[34388]: DEBUG: <core> [db_val.c:143]: db_str2val(): converting STRING [4500] ```
Then it enters the `if` statement, because `b_contact`'s length is 0. The `tps_storage_link_msg` logs the right data, I believe:
```sh 2023-11-22T14:50:49.924925+01:00 debug balancer[34388]: DEBUG: topos [tps_storage.c:568]: tps_storage_link_msg(): downstream: no - acontact: [] - bcontact: [sip:123.456.78.910:8067] ```
And then it hit the `tps_storage_load_branch`.
Okay, I found why it doesn't find the b_contact. It's because it isn't there yet when the query is done. My test sends a `200 OK` and then immediately a `NOTIFY`. Apparently the handling of the `NOTIFY` goes faster than the `200 OK`, so the dialog table gets updated after handling the `NOTIFY`.
@mauritsderuiter95 So just to summarize, the problems you've seen were due to an issue in your test setup? So its now fine and this PR could be closed?
Sorry, I was just describing what happened during the test. It is not the test setup itself that sends the NOTIFY immediately after the OK. I've had a few busy weeks so didn't have the time to get any deeper into this. But I'll have some time next week.
@mauritsderuiter95 Did you managed to have another look to this topic regarding the test of git master?
My apologies for the very late reply. The problem here lies not so much with this patch to master, which works as intended. My setup includes the presence server, which uses the presence_dialoginfo module. That module seems to be sending a NOTIFY immediately after sending the 200 OK, as seen under Overview on the modules page: https://kamailio.org/docs/modules/5.8.x/modules/presence_dialoginfo.html
So there's nothing wrong with the patches on master regarding the topos module. For my setup I'm skipping the SUBSCRIBEs for now.
@mauritsderuiter95 Thanks for the feedback. So this PR was not merged to master in the proposed form, but Daniel pushed a bit different commits if I read it correctly. So if the current master is ok from your point of view, the PR should be closed.
Closed #3627.
Yes, it can be closed. Thank you both for your help!