<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Title" content="">
<meta name="Keywords" content="">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.msoIns
        {mso-style-type:export-only;
        mso-style-name:"";
        text-decoration:underline;
        color:teal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I have been having an issue using kamailio to load balance to a SIP/MRCP server. I believe that the issue actually lies with the reply being sent from the final recipient, but I wanted to be sure that I understood
 the problem and to see if there were any possible solutions within Kamailio.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I am using the dispatcher module to dispatch SIP INVITES to media resources, in this case I am just using a single host in a single dispatcher group. The configuration that I have has worked just fine for
 other SIP/MRCP servers, which is why I think the issue is with this target in particular.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">The INVITE is routed correctly and contains the headers that it should. The invite comes originally from a Freeswitch, arrives at Kamailio, who should then dispatch to a host in the group.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">x.x.x.x:4901 is Kamailio<br>
x.x.x.x:8090 is Freeswitch<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">y.y.y.y:8000 is the final target<br>
<br>
This is the invite, as received by the final target after dispatched via Kamailio<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">INVITE sip: x.x.x.x:4901 SIP/2.0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Record-Route: <sip: x.x.x.x:4901;transport=tcp;lr><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Via: SIP/2.0/TCP x.x.x.x:4901;branch=z9hG4bK3a9a.7f9a4b588cd75108cfea9a2bd9ffa829.0;i=3<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Via: SIP/2.0/TCP x.x.x.x:8090;branch=z9hG4bKStXp06Sv7jU7S<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Max-Forwards: 69<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">From: <sip: x.x.x.x:8090>;tag=4gHgNcNUDjvFQ<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">To: <sip: x.x.x.x:4901><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Call-ID: 6f2a0e9c-3f9e-1238-2aa9-005056854777<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">CSeq: 8692231 INVITE<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">User-Agent: tts<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Supported: timer, 100rel<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Content-Type: application/sdp<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Content-Disposition: session<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Content-Length: 281<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">v=0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">o=IPSoft 3367790083977298880 2789991278648035021 IN IP4 x.x.x.x<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">s=-<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">c=IN IP4 x.x.x.x<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">t=0 0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">m=application 9 TCP/MRCPv2 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=setup:active<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=connection:existing<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=resource:speechsynth<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=cmid:1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">m=audio 32038 RTP/AVP 0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=rtpmap:0 PCMU/8000<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=recvonly<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=mid:1<br>
<br>
The reply that the server sends back appears to be missing a second Via header, which is preventing Kamailio for routing it correctly (based on the error message from core/forward.c)<br>
<br>
This is the reply sent by the target destination<br>
<br>
SIP/2.0 200 OK<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Via: SIP/2.0/TCP x.x.x.x:8090;branch=z9hG4bKStXp06Sv7jU7S<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">To: <sip: x.x.x.x:4901>;tag=ndszib3k<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">From: <sip: x.x.x.x:8090>;tag=4gHgNcNUDjvFQ<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Call-ID: 6f2a0e9c-3f9e-1238-2aa9-005056854777<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">CSeq: 8692231 INVITE<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Contact: "Voiceware MRCP Server" <sip:vwmrcp@ y.y.y.y:8000;transport=tcp><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Content-Type: application/sdp<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Content-Length: 324<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">v=0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">o=- 1566492047 1566492047 IN IP4 y.y.y.y<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">s=Voiceware MRCP Server 2.15.0.7. Dec 28 2018<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">c=IN IP4 y.y.y.y<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">t=0 0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">m=application 8002 TCP/MRCPv2 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=channel:12951125463@speechsynth<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=connection:new<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=setup:passive<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=cmid:1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">m=audio 30158 RTP/AVP 0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=rtpmap:0 pcmu/8000<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=sendonly<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=ptime:20<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">a=mid:1<br>
<br>
It is correct that there should still be a 2<sup>nd</sup> Via header in the 200 OK reply from the target host, right?<br>
<br>
If so, is there anything else that can be done in Kamailio to handle this, or is this mrcp server simply not complying properly with SIP?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">There’s no funky natting between these hosts or anything like that.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thanks in advance!<o:p></o:p></span></p>
</div>
</body>
</html>