<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### 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
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] 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
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
In this PR we introduce a new mode and two new parameters for accomplishing the same thing for user part also in domain part.
Docs incoming if no significant changes are needed.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/4246
-- Commit Summary --
* topos: Add new contact_mode=3 and 2 new modparam for contact host domains
* topos: Refactor contact_mode handling
* topos: Append port and protocol param
-- File Changes --
M src/modules/topos/topos_mod.c (13)
M src/modules/topos/tps_storage.c (428)
M src/modules/topos/tps_storage.h (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/4246.patchhttps://github.com/kamailio/kamailio/pull/4246.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/4246
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/4246(a)github.com>
amnapa created an issue (kamailio/kamailio#4205)
### Description
Using sCSCF sample found [here](https://github.com/kamailio/kamailio/blob/master/misc/examples/ims/sc…, after calling ims_www_challenge in REGISTER route block and sending a Diameter MAR request, the control is never passed to REG_MAR_REPLY route block and debug messages within REG_MAR_REPLY are not logged. This is not the case with REG_SAR_REPLY and PRE_REG_SAR_REPLY, those blocks are executed as expected.
```
######################################################################
# Route for handling Registrations:
######################################################################
route[REGISTER] {
xlog("ALGORITHM IS [$aa] and User-Agent is [$ua]\n");
$var(alg) = $aa;
if ($aa == $null) {
$var(alg) = "MD5"; #force to MD5 for zoiper.... non-ims
}
#!ifdef WITH_AUTH
if (!ims_www_authenticate("$td")) {
#!else
if (($var(alg) == "MD5") && (!ims_www_authenticate("$td"))) {
#!endif
if ($? == -2) {
send_reply("403", "Authentication Failed");
exit;
} else if ($? == -3) {
send_reply("400", "Bad Request");
exit;
} else if ($? == -9) {
xlog("L_DBG", "Authentication re-sync requested\n");
ims_www_resync_auth("REG_RESYNC_REPLY", "$td");
exit;
} else {
#user has not been authenticated. Lets send a challenge via 401 Unauthorized
xlog("L_DBG", "About to challenge! auth_ims\n");
ims_www_challenge("REG_MAR_REPLY", "$td", "$var(alg)");
exit;
}
} else {
xlog("L_DBG", "Auth succeeded\n");
# We need to check if this user is registered or not
if (!impu_registered("location")) {
xlog("L_ERR", "Not REGISTERED\n");
save("PRE_REG_SAR_REPLY", "location");
exit;
} else {
isc_match_filter_reg("1", "location");
save("REG_SAR_REPLY", "location");
exit;
}
}
}
route[REG_MAR_REPLY]
{
#this is async so to know status we have to check the reply avp
xlog("L_DBG", "maa_return code is $avp(s:maa_return_code)\n");
switch ($avp(s:maa_return_code)){
case 1: #success
xlog("L_DBG", "MAR success - 401/407 response sent from module\n");
break;
case -1: #failure
xlog("L_ERR", "MAR failure - error response sent from module\n");
break;
case -2: #error
xlog("L_ERR", "MAR error - sending error response now\n");
send_reply("500", "MAR failed");
break;
default:
xlog("L_ERR", "Unknown return code from MAR, value is [$avp(s:maa_return_code)]\n");
send_reply("500", "Unknown response code from MAR");
break;
}
exit;
}
```
### Troubleshooting
#### Reproduction
<!--
If the issue can be reproduced, describe how it can be done.
-->
#### Debugging Data
```
(paste your debugging data here)
```
#### Log Messages
```
ERROR: *** cfgtrace:request_route=[REGISTER] c=[/usr/local/etc/kamailio/kamailio.cfg] l=712 a=27 n=ims_www_challenge
DEBUG: ims_auth [authorize.c:290]: challenge(): Looking for route block [REG_MAR_REPLY]
INFO: ims_auth [cxdx_mar.c:76]: create_return_code(): created AVP successfully : [maa_return_code] - [-2]
DEBUG: ims_auth [authorize.c:314]: challenge(): Need to challenge for realm [ims.mnc072.mcc432.3gppnetwork.org]
DEBUG: ims_auth [authorize.c:321]: challenge(): Checking if REGISTER is authorized for realm [ims.mnc072.mcc432.3gppnetwork.org]...
DEBUG: ims_auth [authorize.c:1446]: get_auth_userdata(): Searching auth_userdata for IMPU sip:bob@ims.mnc072.mcc432.3gppnetwork.org (Hash 295)
DEBUG: ims_auth [authorize.c:1455]: get_auth_userdata(): Found auth_userdata
DEBUG: ims_auth [authorize.c:1061]: get_auth_vector(): looping through AV status is 3 and were looking for 0
DEBUG: tm [t_lookup.c:1343]: t_newtran(): msg (0x7f8d3f410cb0) id=1/11 global id=1/11 T start=(nil)
DEBUG: tm [t_lookup.c:498]: t_lookup_request(): start searching: hash=21555, isACK=0
DEBUG: tm [t_lookup.c:456]: matching_3261(): RFC3261 transaction matching failed - via branch [z9hG4bK3345.d6f2aff0d9192c2647aca3baea62cf94.1]
DEBUG: tm [t_lookup.c:681]: t_lookup_request(): no transaction found
DEBUG: tm [t_hooks.c:337]: run_reqin_callbacks_internal(): trans=0x7f8d2bff4520, callback type 1, id 0 entered
DEBUG: ims_auth [authorize.c:457]: challenge(): Suspending SIP TM transaction
DEBUG: ims_auth [authorize.c:1526]: multimedia_auth_request(): Sending MAR
DEBUG: ims_auth [cxdx_mar.c:572]: cxdx_send_mar(): Successfully sent async diameter
DEBUG: tm [t_lookup.c:1628]: t_lookup_ident_filter(): transaction found
INFO: ims_auth [cxdx_avp.c:134]: cxdx_get_avp(): cxdx_get_experimental_result_code: Failed finding avp (avp_code = 297, vendor_id = 0)
DEBUG: ims_auth [authorize.c:1557]: pack_challenge(): setting QOP str used is [, qop="auth"]
DEBUG: ims_auth [authorize.c:1559]: pack_challenge(): QOP str used is [, qop="auth"]
DEBUG: tm [t_reply.c:1660]: cleanup_uac_timers(): RETR/FR timers reset
DEBUG: tm [t_reply.c:595]: _reply_light(): reply sent out. buf=0x7f8d3f4120b8: SIP/2.0 401 Unauthor..., shmem=0x7f8d2bff9288: SIP/2.0 401 Unauthor
DEBUG: tm [t_reply.c:606]: _reply_light(): finished
DEBUG: ims_auth [authorize.c:1446]: get_auth_userdata(): Searching auth_userdata for IMPU sip:bob@ims.mnc072.mcc432.3gppnetwork.org (Hash 295)
DEBUG: ims_auth [authorize.c:1455]: get_auth_userdata(): Found auth_userdata
DEBUG: ims_auth [authorize.c:1679]: add_auth_vector(): Adding auth_vector (status 1) for IMPU sip:bob@ims.mnc072.mcc432.3gppnetwork.org / IMPI bob(a)ims.mnc072.mcc432.3gppnetwork.org (Hash 295)
DEBUG: ims_auth [cxdx_mar.c:483]: async_cdp_callback(): DBG:UAR Async CDP callback: ... Done resuming transaction
INFO: ims_auth [cxdx_mar.c:76]: create_return_code(): created AVP successfully : [maa_return_code] - [1]
DEBUG: ims_auth [cxdx_mar.c:495]: async_cdp_callback(): Destroying current transaction prevented!
DEBUG: tm [t_lookup.c:1620]: t_lookup_ident_filter(): transaction in terminated phase - skipping
ERROR: tm [t_suspend.c:196]: t_continue_helper(): active transaction not found
DEBUG: ims_auth [cxdx_mar.c:84]: free_saved_transaction_data(): Freeing saved transaction data: async
```
#### SIP Traffic
```
(paste your sip traffic here)
```
### Possible Solutions
The issue is related to ims_auth module, in [cxdx_mar.c ](https://github.com/kamailio/kamailio/blob/master/src/modules/ims_auth/cxdx_mar.c). within async_cdp_callback function, if I replace:
```
tmb.t_continue(data->tindex, data->tlabel, data->act);
````
with the following:
```
tmb.t_continue_skip_timer(data->tindex, data->tlabel, data->act);
```
the issue will be fixed and the control will be passed to REG_MAR_REPLY route block. In fact, in ims_registrar_scscf module, in [cxdx_sar.c ](https://github.com/kamailio/kamailio/blob/master/src/modules/ims_registrar_scscf/cxdx_sar.c) file, the t_continue_skip_timer is called instead of t_continue, if I replace it with t_continue the same issue happens for SAR callbacks.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 6.1.0-dev0 (x86_64/linux) c858ce-dirty
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: c858ce -dirty
compiled on 10:33:37 Apr 5 2025 with gcc 11.4.0
```
* **Operating System**:
```
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
Linux kuber-worker 5.15.0-133-generic #144-Ubuntu SMP Fri Feb 7 20:47:38 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4205
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4205(a)github.com>
Hello,
I am using exact same logic for which is define in this documentation and single device its working fine.
https://www.kamailio.org/events/2015-KamailioWorld/Day2/20-Federico.Cabiddu…
But seems like if multiple registration with same extension, like if extension 102 logged in mobile as well web. If web device registered and mobile is not registered with wss, then the Current transaction is not going to suspend due to its consider like there is only one location entry on location table.so only one Invite send to web and mobile its going to send notification but never get Invite, even it is going to register using push notification.
So below LOCATION function should be called and sending invite to registered extension and should be waiting for Other device as well. But in my case its consider like only one device is there and transaction is not suspending.
Could you check and suggest me which part of code need to improve to so i can make it working with registered device with parallel forking for adding new branch.
Here is my code.
modparam("registrar", "max_contacts", 10)
modparam("registrar", "append_branches", 1)
modparam("registrar", "use_path", 1)
modparam("registrar", "path_mode", 1)
loadmodule "tsilo.so"
modparam("tsilo", "use_domain", 1)
modparam("htable", "htable", "vtp=>size=100;autoexpire=30;")
# append branches or resume the transaction
route[PUSHJOIN] {
$var(hjoin) = 0;
lock("$tU");
$var(hjoin) = $sht(vtp=>join::$tU);
$var(hstored) = $sht(vtp=>stored::$tU);
$sht(vtp=>join::$tU) = $null;
unlock("$tU");
if ($var(hjoin)==0)
{
if ($var(hstored))
ts_append("location", "$tU");
return;
}
$var(id_index) = $(var(hjoin){s.select,0,:}{s.int});
$var(id_label) = $(var(hjoin){s.select,1,:}{s.int});
t_continue("$var(id_index)", "$var(id_label)", "INVRESUME");
}
# lookup and relay after resuming transaction
route[INVRESUME] {
lookup("location");
xlog("L_INFO","[RESUME] rm=$rm ru=$ru du=$du \n");
t_relay();
ts_store();
$sht(vtp=>stored::$rU) = 1;
$sht(vtp=>id_index::$tu) = $null;
$sht(vtp=>id_label::$tu) = $null;
xlog("L_INFO","stored transaction [$T(id_index):$T(id_label)] $fU => $rU\n");
}
route[SUSPEND] {
if ( !t_suspend() ) {
xlog("L_ERROR","[SUSPEND] failed suspending trasaction [$T(id_index):$T(id_label)]\n");
send_reply("501", "Suspending error");
exit;
}
xlog("L_INFO","[SUSPEND] suspended transaction [$T(id_index):$T(id_label)] $fU=> $rU\n");
$sht(vtp=>join::$rU) = "" + $T(id_index) + ":" + $T(id_label);
xlog("L_INFO","htable key value [$sht(vtp=>join::$rU)]\n");
}
route[SENDPUSH] {
$avp(platform) = $hdr(X-pn-platform);
$var(headers) = "Content-Type: application/json\r\nAuthorization: Bearer 55466cc-c789-4a48-39c8-219ebaa1512f";
$var(body) = "{\"user\": \"" + $rU + "\", " +
"\"platform\": \"" + $avp(platform) + "\"}";
http_client_query("https://handlepush.xxx.com/v2/phone/call/send_notification_kamalio",
"$var(body)",
"$var(headers)",
"$var(res)");
}
# User location service
route[LOCATION] {
if (!lookup("location"))
{
send_reply("100", "Trying");
xlog("L_INFO","SUSPENDING TRANASACTION $fU => $rU\n");
route(SUSPEND);
}
else
{
t_relay();
ts_store();
$sht(vtp=>stored::$rU) = 1;
xlog("L_INFO","stored transaction [$T(id_index):$T(id_label)] $fU=> $rU\n");
}
route(SENDPUSH);
exit;
}
if (is_method("REGISTER") || from_uri==myself) {
xlog("L_INFO", "SAVING TO LOCATIONS $si:$sp\n");
if (!save("location")) {
sl_reply_error();
}
route(PUSHJOIN);
exit;
}
Can you help me to understand why parallel forking not working in this case ?
Thanks
there's no ``kamailio-ims_dialog.xml`` at ``src/lib/srdb1/schema`` but there's a manual file created at ``utils/kamctl/mysql/ims_dialog-create.sql``
Same thing for:
- ``utils/kamctl/mysql/ims_charging-create.sql``
- ``utils/kamctl/mysql/ims_usrloc_pcscf-create.sql``
- ``utils/kamctl/mysql/ims_usrloc_scscf-create.sql``
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4100
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/4100(a)github.com>