Hi !.,
Kamailio websocket state is going into FINWAIT1 without sending FIN message
out when we do service kamailio restart.
I have a Primary and Secondary node configured. When I perform switchover
socket status is going into FINWAIT1 state without sending FIN to the
client hence client status is showing established, This is happening 90+%
of times but does work sometimes.
AT Kamailio:
[root@localhost ~]# netstat -tunelap | grep 41034
tcp 0 1 172.27.45.198:9040 172.27.6.98:…
[View More]41034
FIN_WAIT1 0 0 -
[root@localhost ~]#
AT Nginx (client):
root@meet:~# netstat -tunelap | grep 9040
tcp 0 0 172.27.6.98:41034 172.27.45.198:9040
ESTABLISHED 33 763106 1322/nginx: worker
root@meet:~#
Thanks,
Shahid
[View Less]
Module: kamailio
Branch: 5.5
Commit: 557ac56a6ec6b4ca3d76a57ff8b21c64027791f2
URL: https://github.com/kamailio/kamailio/commit/557ac56a6ec6b4ca3d76a57ff8b21c6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-06-29T14:42:12+02:00
core: str list - added function to insert a block string in list
(cherry picked from commit b92b931c26c199b756fd08e9c80cc9305469fd2b)
---
Modified: src/core/str_list.c
Modified: …
[View More]src/core/str_list.h
---
Diff: https://github.com/kamailio/kamailio/commit/557ac56a6ec6b4ca3d76a57ff8b21c6…
Patch: https://github.com/kamailio/kamailio/commit/557ac56a6ec6b4ca3d76a57ff8b21c6…
---
diff --git a/src/core/str_list.c b/src/core/str_list.c
index f63b4c9151..207cee5bc3 100644
--- a/src/core/str_list.c
+++ b/src/core/str_list.c
@@ -13,13 +13,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
- * @file
+ * @file
* @brief Kamailio core :: Simple str type list and helper functions
* @ingroup core
* Module: @ref core
@@ -32,7 +32,7 @@
/**
* @brief Add a new allocated list element to an existing list
- *
+ *
* Add a new allocated list element to an existing list, the allocation is done
* from the private memory pool
* @param s input character
@@ -43,18 +43,45 @@
*/
struct str_list *append_str_list(char *s, int len, struct str_list **last, int *total)
{
- struct str_list *new;
- new = pkg_malloc(sizeof(struct str_list));
- if (!new) {
+ struct str_list *nv;
+ nv = pkg_malloc(sizeof(struct str_list));
+ if (!nv) {
PKG_MEM_ERROR;
return 0;
}
- new->s.s = s;
- new->s.len = len;
- new->next = 0;
+ nv->s.s = s;
+ nv->s.len = len;
+ nv->next = 0;
- (*last)->next = new;
- *last = new;
+ (*last)->next = nv;
+ *last = nv;
*total += len;
- return new;
+ return nv;
+}
+
+/**
+ * @brief Add a new allocated list element with cloned block value to an existing list
+ *
+ * Add a new allocated list element with cloned value in block to an existing list,
+ * the allocation is done from the private memory pool
+ * @param head existing list
+ * @param s input character
+ * @param len length of input character
+ * @return extended list
+ */
+str_list_t *str_list_block_add(str_list_t **head, char *s, int len)
+{
+ str_list_t *nv;
+ nv = pkg_mallocxz(sizeof(str_list_t) + (len+1)*sizeof(char));
+ if (!nv) {
+ PKG_MEM_ERROR;
+ return 0;
+ }
+ nv->s.s = (char*)nv + sizeof(str_list_t);
+ memcpy(nv->s.s, s, len);
+ nv->s.len = len;
+ nv->next = *head;
+ *head = nv;
+
+ return nv;
}
diff --git a/src/core/str_list.h b/src/core/str_list.h
index db3fa12887..1eac2578b0 100644
--- a/src/core/str_list.h
+++ b/src/core/str_list.h
@@ -51,4 +51,16 @@ typedef struct str_list {
*/
struct str_list *append_str_list(char *s, int len, struct str_list **last, int *total);
+/**
+ * @brief Add a new allocated list element with cloned block value to an existing list
+ *
+ * Add a new allocated list element with cloned value in block to an existing list,
+ * the allocation is done from the private memory pool
+ * @param head existing list
+ * @param s input character
+ * @param len length of input character
+ * @return extended list
+ */
+str_list_t *str_list_block_add(str_list_t **head, char *s, int len);
+
#endif
[View Less]
#### Pre-Submission Checklist
- [x] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] 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 …
[View More](non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
Wireshark project allows embedding session encryption keys into PCAP files. So it allows parsing encrypted packets as it was unencrypted.
[More info](https://blog.didierstevens.com/2021/01/11/decrypting-tls-streams-with…
I prepared a change that allows export session encryption keys.
Please review PR. If ok, then I add commits with DocBook info.
Kyys may be emeberd using command
```
editcap --inject-secrets tls,/var/lib/kamailio/session_keylog encrypted.pcap with_keys.pcapng
```
As prototype used
https://github.com/openssl/openssl/blob/master/apps/lib/s_cb.c#L1480-L1525
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2785
-- Commit Summary --
* tls: added new session_keylog_enable and session_keylog_filename configuration params
* tls: first interation of session key logger
* tls: added logs output
-- File Changes --
M src/modules/tls/tls_cfg.c (6)
M src/modules/tls/tls_cfg.h (2)
M src/modules/tls/tls_init.c (79)
M src/modules/tls/tls_init.h (2)
M src/modules/tls/tls_mod.c (2)
M src/modules/tls/tls_rpc.c (2)
M src/modules/tls/tls_server.c (1)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2785.patchhttps://github.com/kamailio/kamailio/pull/2785.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2785
[View Less]
…freeing memory
<!-- 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 …
[View More]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
- [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
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
as per @miconda's suggestion, added memory checks
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2792
-- Commit Summary --
* nats: make sure pkg & shm memory is allocated; check pointers before freeing memory
-- File Changes --
M src/modules/nats/nats_mod.c (69)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2792.patchhttps://github.com/kamailio/kamailio/pull/2792.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2792
[View Less]
Hello,
As mobile applications based on kamailio are growing exponentially on Play Store and App Store, i would suggest if you could add by default the code for ios/android push notifications.
I have problems mainly for incoming call (phone wakeup) on linphone iphone app, as kamailio is missing the push solution. On Android i am using Baresip and works perfect without push.
Navigating on the web, i found some uncomplete or minimum tutorials to implement this.
Like: https://denys-pozniak.…
[View More]medium.com/apple-push-notification-with-kamailio-eeca…
And also some code snippets of a modification of "kamailio.cfg" to add support for ios push notifications. (see below).
Could someone have this already working? Or kamailio official developers could add this by default inside source code?
# keep a record of an IPhone for 4 hours
modparam("htable", "htable", "iphone_remote=>size=10;autoexpire=14400;")
modparam("htable", "htable", "iphone_voip=>size=10;autoexpire=14400;")
modparam("htable", "htable", "iphone_check=>size=10;autoexpire=14400;")
modparam("htable", "htable", "vtp=>size=10;autoexpire=120;")
route[REGISTRAR] {
...
...
if (save("location")) {
# user registered, now look at the useragent header for iPhone string
if ($hdr(User-Agent)=~"LinphoneiOS.*") {
$var(uri) = @contact.uri; # select the uri from contact header
$var(pn-prid) = $(var(uri){uri.param,pn-prid}); # get the uri param pn-prid from the uri, i.e. 1DF26BC10F597676B
xlog("!!!! - $var(pn-prid)");
$var(i) = 0;
$var(n) = $(var(pn-prid){s.count,&});
while( $var(i) <= $var(n)) {
$var(pn-prid_item) = $(var(pn-prid){s.select,$var(i),&});
$var(pn-prid_type) = $(var(pn-prid_item){s.select,1,:});
$var(pn-prid_token) = $(var(pn-prid_item){s.select,0,:});
if ( $var(pn-prid_type) == "remote" ) {
$var(pn-prid_remote) = $(var(pn-prid_item){s.select,0,:}) ;
}
if ( $var(pn-prid_type) == "voip" ) {
$var(pn-prid_voip) = $(var(pn-prid_item){s.select,0,:}) ;
}
$var(i) = $var(i) + 1;
}
xlog("L_INFO","iPhone PUSH tokens for user $fU - remote: $var(pn-prid_remote), voip: $var(pn-prid_voip)");
# store the values of tokens to htable with fromUser as key
$sht(iphone_remote=>$fU) = $var(pn-prid_remote);
$sht(iphone_voip=>$fU) = $var(pn-prid_voip);
$sht(iphone_check=>$fU) = 1;
if ( $sht(vtp=>id_index::$tU) != $null ) {
xlog("L_INFO", "New $rm ru=$ru tu=$tu \n");
route(JOIN);
}
} else {
# no iphone
$sht(iphone_check=>$fU) = 0;
}
...
...
}
route[LOCATION] {
...
...
if (!lookup("location")) {
$var(rc) = $rc;
# handle PUSH notifications for iPhone
# iphones should not be registered and contacts stored in database
# hence lookup should fail and we need to try to push iphone first
if ($sht(iphone_check=>$tU) == 1) {
xlog("L_ERR", "[PUSH] The to user has already used iPhone, trying push notifications");
xlog("L_ERR", "[PUSH] No registration to try, suspending.");
sl_send_reply("100", "Suspending");
route(SUSPEND);
route(RELAY);
exit;
}
...
...
if (is_method("INVITE")) {
setflag(FLT_ACCMISSED);
# handle PUSH notifications for iPhone
# in some cases, iphone does not send de-register when going to background
# for these circumstances, push iphone even if it has an active registration
if ($sht(iphone_check=>$tU) == 1) {
xlog("L_ERR", "[PUSH] The to user has already used iPhone, trying push notifications");
xlog("L_ERR", "[PUSH] No registration to try, suspending.");
sl_send_reply("100", "Suspending");
route(SUSPEND);
}
}
route(RELAY);
exit;
}
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;
} else {
xlog("L_INFO","[SUSPEND] suspended transaction [$T(id_index):$T(id_label)] $fU=> $rU\n");
$sht(vtp=>id_index::$rU) = $T(id_index);
$sht(vtp=>id_label::$rU) = $T(id_label);
xlog("L_INFO","[SUSPEND] htable key value [$sht(vtp=>id_index::$rU) -- $sht(vtp=>id_label::$rU)]\n");
route(SENDPUSH);
exit;
}
}
route[SENDPUSH] {
#http_client_query("http://url/push.php"<http://url/push.php>, "user=$rU\r\npn-tok=$sht(tokens=>$rU)\r\n","Content-Type: text/plain", "$var(result)");
xlog("!!!!!!!!!!!!!!!!!!!!!! PUSH !!!!!!!!!!!!!!!!!!!");
xlog("/opt/push/push.sh $ci $sht(iphone_voip=>$tU)");
exec_avp("/opt/push/push.sh $ci $sht(iphone_voip=>$tU)");
xlog("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
sl_send_reply("100", "Pushing");
}
route[JOIN] {
xlog("L_WARN","[JOIN] htable key value [$sht(vtp=>id_index::$tU) -- $sht(vtp=>id_label::$tU)]\n");
t_continue("$sht(vtp=>id_index::$tU)", "$sht(vtp=>id_label::$tU)", "RESUME");
$sht(vtp=>joined::$tU) = 1;
}
route[RESUME] {
lookup("location");
xlog("L_INFO","[RESUME] rm=$rm ru=$ru du=$du \n");
t_relay();
$sht(vtp=>id_index::$tU) = $null;
$sht(vtp=>id_label::$tU) = $null;
exit; }
[View Less]