<p>I incremented the size of the buffer to 8196, the old value of 2048 being rather small for dealing with sip messages. In the future, this might be changed to allocated memory at startup based on pv buffer size.</p>
<p>However, in case of dealing with larger values, there are couple of options:</p>
<ul>
<li>navigate line by line in sdp:</li>
</ul>
<pre><code>$var(lc) = $(rb{line.count});
$var(i) = 0;
while($var(i)<$var(lc)) {
  $var(line) = $(rb{line.at,$var(i)});
  # do you re here on $var(line) ...

  $var(i) = $var(i) + 1;
}
</code></pre>
<ul>
<li>split operation on parts of the value:</li>
</ul>
<pre><code>$var(halflen) = $(rb{s.len}) / 2;
$var(firsthalf) = $(rb{s.substr,0,$var(halflen)});
$var(secondhalf) = $(rb{s.substr,$var(halflen),0});
</code></pre>
<p>This may have the risk of splitting on the line you want to match, but could be useful for other cases.</p>
<ul>
<li>use an embedded interpreter, for example app_jsdk or app_sqlang have no external dependencies, but you can use also app_lua, app_python, ...</li>
</ul>

<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/1592#issuecomment-405002970">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZQoL4owmfPJcBM9Me-faXiYj7lS2ks5uGZBcgaJpZM4VO8T7">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZUhGYp_o57NnG8ZIR8tzlALrDwDsks5uGZBcgaJpZM4VO8T7.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":"PERSON","message":"@miconda in #1592: I incremented the size of the buffer to 8196, the old value of 2048 being rather small for dealing with sip messages. In the future, this might be changed to allocated memory at startup based on pv buffer size.\r\n\r\nHowever, in case of dealing with larger values, there are couple of options:\r\n\r\n  * navigate line by line in sdp:\r\n\r\n```\r\n$var(lc) = $(rb{line.count});\r\n$var(i) = 0;\r\nwhile($var(i)\u003c$var(lc)) {\r\n  $var(line) = $(rb{line.at,$var(i)});\r\n  # do you re here on $var(line) ...\r\n\r\n  $var(i) = $var(i) + 1;\r\n}\r\n```\r\n  * split operation on parts of the value:\r\n\r\n```\r\n$var(halflen) = $(rb{s.len}) / 2;\r\n$var(firsthalf) = $(rb{s.substr,0,$var(halflen)});\r\n$var(secondhalf) = $(rb{s.substr,$var(halflen),0});\r\n```\r\nThis may have the risk of splitting on the line you want to match, but could be useful for other cases.\r\n\r\n  * use an embedded interpreter, for example app_jsdk or app_sqlang have no external dependencies, but you can use also app_lua, app_python, ..."}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1592#issuecomment-405002970"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1592#issuecomment-405002970",
"url": "https://github.com/kamailio/kamailio/issues/1592#issuecomment-405002970",
"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": "Re: [kamailio/kamailio] re.subst cannot process sdp content-length of 2978 (#1592)",
"sections": [
{
"text": "",
"activityTitle": "**Daniel-Constantin Mierla**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@miconda",
"facts": [

]
}
],
"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\": 1592,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/kamailio/kamailio/issues/1592#issuecomment-405002970"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 356238587\n}"
}
],
"themeColor": "26292E"
}
]</script>