<h3>Description</h3>
<p>I want convert INVITE message with SDP body to multypart body. To do this is used patch for reference kamailio.cfg</p>
<pre><code>[root@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
</code></pre>
<p>After <code>msg_apply_changes</code> kamailio send INVITE without original SDP and without trailing delimiter.</p>
<pre><code>INVITE sip:safarov@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@aio.kazoo>;tag=988293340
To: <sip:safarov@aio.kazoo>
Call-ID: 1851253425
CSeq: 21 INVITE
Contact: <sip:safarov@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

</code></pre>
<h3>Troubleshooting</h3>
<p>NA</p>
<h4>Reproduction</h4>
<ol>
<li>Need to apply patch provided above;</li>
<li>create any sip account;</li>
<li>register SIP client using auth data for created sip account;</li>
<li>place call for created account.</li>
</ol>
<h4>Debugging Data</h4>
<p>NA</p>
<h4>Log Messages</h4>
<p><a href="https://github.com/kamailio/kamailio/files/2568706/kamailio.log">kamailio.log</a></p>
<h4>SIP Traffic</h4>
<p><a href="https://github.com/kamailio/kamailio/files/2568707/kamailio.pcapng.gz">kamailio.pcapng.gz</a></p>
<h3>Possible Solutions</h3>
<p>Not known</p>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code><br>
Tested current master</li>
</ul>
<pre><code>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
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<pre><code>/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 #
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1719">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZaDFg0yNGhDtPlScDDbThWAu0OnAks5utzLZgaJpZM4YYKPv">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZZqKq1C04aqW54MRPd3S5hrVa02lks5utzLZgaJpZM4YYKPv.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"set_body_multipart produce broken body (#1719)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1719"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1719",
"url": "https://github.com/kamailio/kamailio/issues/1719",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "set_body_multipart produce broken body (#1719)",
"sections": [
{
"text": "",
"activityTitle": "**sergey-safarov**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@sergey-safarov",
"facts": [
{
"name": "Repository: ",
"value": "kamailio/kamailio"
},
{
"name": "Issue #: ",
"value": 1719
}
]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1719,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close issue",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1719\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/kamailio/kamailio/issues/1719"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 408986607\n}"
}
],
"themeColor": "26292E"
}
]</script>