[sr-dev] [kamailio/kamailio] set_body_multipart produce broken body (#1719)

sergey-safarov notifications at github.com
Sat Nov 10 21:11:05 CET 2018


### Description

I want convert INVITE message with SDP body to multypart body. To do this is used patch for reference kamailio.cfg
```
[root at safarov-dell kamailio]# diff -u kamailio.cfg kamailio2.cfg 
--- kamailio.cfg	2018-11-09 18:28:36.000000000 +0300
+++ kamailio2.cfg	2018-11-10 22:49:43.604132033 +0300
@@ -1,5 +1,10 @@
 #!KAMAILIO
 #
+#!define WITH_DEBUG
+#!define WITH_MYSQL
+#!define WITH_AUTH
+#!define WITH_USRLOCDB
+#
 # Kamailio (OpenSER) SIP Server v5.2 - default configuration script
 #     - web: https://www.kamailio.org
 #     - git: https://github.com/kamailio/kamailio
@@ -286,6 +291,8 @@
 loadmodule "debugger.so"
 #!endif
 
+loadmodule "textopsx.so"
+
 # ----------------- setting module-specific parameters ---------------
 
 
@@ -495,6 +502,10 @@
 	# account only INVITEs
 	if (is_method("INVITE")) {
 		setflag(FLT_ACC); # do accounting
+		set_body_multipart("test", "text/plain", "delimiter");
+		msg_apply_changes();
+		# # $var(b) = "7e Od 04 55 75 69 20 4d 61 6b 65 43 61 6c 6c";
+		# # append_body_part("$var(b)", "application/vnd.cirpack.isdn-ext", "signal;handling=required");
 	}
 
 	# dispatch requests to foreign domains
```
After `msg_apply_changes` kamailio send INVITE without original SDP and without trailing delimiter.
```
INVITE sip:safarov at 192.168.100.28:43749;transport=tcp SIP/2.0
Record-Route: <sip:192.168.100.31;transport=tcp;r2=on;lr>
Record-Route: <sip:192.168.100.31;r2=on;lr>
Via: SIP/2.0/TCP 192.168.100.31;branch=z9hG4bK9a1.9a042f2f4fe26e1e0fa9b65185f3a733.0
Via: SIP/2.0/UDP 192.168.100.31:35060;received=192.168.100.31;rport=35060;branch=z9hG4bK1985869670
From: <sip:safarov at aio.kazoo>;tag=988293340
To: <sip:safarov at aio.kazoo>
Call-ID: 1851253425
CSeq: 21 INVITE
Contact: <sip:safarov at 192.168.100.31:35060>
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Max-Forwards: 69
User-Agent: Linphone/3.6.1 (eXosip2/3.6.0)
Subject: Phone call
Content-Length:   60
Content-Type: multipart/mixed;boundary="delimiter"
Mime-Version: 1.0

--delimiter
Content-Type: text/plain

test
--delimiter

```
### Troubleshooting
NA

#### Reproduction

1) Need to apply patch provided above;
2) create any sip account;
3) register SIP client using auth data for created sip account;
4) place call for created account.

#### Debugging Data

NA

#### Log Messages

[kamailio.log](https://github.com/kamailio/kamailio/files/2568706/kamailio.log)

#### SIP Traffic

[kamailio.pcapng.gz](https://github.com/kamailio/kamailio/files/2568707/kamailio.pcapng.gz)

### Possible Solutions

Not known

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`
Tested current master
```
version: kamailio 5.3.0-dev0 (x86_64/linux) 
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, 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_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_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: unknown 
compiled on 14:49:40 Nov  9 2018 with gcc 8.2.0
```

* **Operating System**:

```
/etc/kamailio # cat /etc/os-release 
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.8.0
PRETTY_NAME="Alpine Linux v3.8"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"
/etc/kamailio #
```


-- 
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/issues/1719
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20181110/cf6e8176/attachment.html>


More information about the sr-dev mailing list