<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I'm using 'subst' in multiline mode - basically using it to rewrite a
'Refer-To' header based on the contents of the 'Contact' header.<br>
However, if I do that, it looks like all the default processing that
occurs on the message (specifically, the addition of a 'Via' header),
gets tacked on to the end of the message.&nbsp; It almost looks like all the
changes that were made to the message end up in a buffer that gets
appended to the end of the message, and *not* as part of the message.<br>
<br>
<br>
In the example below, I just used the following to generate the error
condition<br>
subst('/(.*)5100(.*)/\15100aptela\2/si');<br>
<br>
And yes, I know that the above doesnt need the 's' flag.&nbsp; Its just that
i've distilled my ridiculously complex 'subst' expressiond down to the
above really simple expression which still causes the error below.<br>
<br>
<br>
So, the question is, is this actually supposed to work?&nbsp; Anyone ever
actually tried this out?&nbsp; <br>
<br>
e.g.<br>
incoming packet is (note that th "Refer-To" line sez 'sip:5100@...'.&nbsp;
This will get changed to sip:5100aptela@...<br>
<br>
<small><font color="#ff0000">REFER <a class="moz-txt-link-abbreviated" href="mailto:sip:7732206484@66.23.129.219:5090">sip:7732206484@66.23.129.219:5090</a>
SIP/2.0.<br>
f:
<a class="moz-txt-link-rfc2396E" href="mailto:sip:operator.aptela@voice.aptela.com">&lt;sip:operator.aptela@voice.aptela.com&gt;</a>;tag=7f1ca8c0-13c442ad79d2.<br>
t: "7732206484"<a class="moz-txt-link-rfc2396E" href="mailto:sip:7732206484@66.23.129.219:5090">&lt;sip:7732206484@66.23.129.219:5090&gt;</a>;tag=as10a69cf8.<br>
Call-ID: <a class="moz-txt-link-abbreviated" href="mailto:6bfbb1d627b2c0366bb2be7206177cea@66.23.129.219">6bfbb1d627b2c0366bb2be7206177cea@66.23.129.219</a>.<br>
CSeq: 2 REFER.<br>
Via: SIP/2.0/UDP
192.168.28.127:5060;rport;branch=z9hG4bK-42ad79d6-1750412-5e02.<br>
Max-Forwards: 70.<br>
Supported: 100rel,replaces.<br>
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE.<br>
User-Agent: SIP Phone-1.0.41 - ABP.<br>
Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:operator.aptela@64.81.147.138:33049">&lt;sip:operator.aptela@64.81.147.138:33049&gt;</a>.<br>
Route: &lt;sip:69.25.47.134;lr;ftag=as10a69cf8&gt;.<br>
Referred-By: <a class="moz-txt-link-rfc2396E" href="mailto:sip:operator.aptela@voice.aptela.com">&lt;sip:operator.aptela@voice.aptela.com&gt;</a>.<br>
Refer-To: <a class="moz-txt-link-rfc2396E" href="mailto:sip:5100@voice.aptela.com">&lt;sip:5100@voice.aptela.com&gt;</a>.<br>
Content-Length: 0.</font></small><br>
.<br>
<br>
outgoing packet *should* be (note the Refer-To line now <br>
<small><font color="#ff0000"><br>
REFER <a class="moz-txt-link-abbreviated" href="mailto:sip:7732206484@66.23.129.219:5090">sip:7732206484@66.23.129.219:5090</a> SIP/2.0.<br>
Record-Route: &lt;sip:69.25.47.134;ftag=7f1ca8c0-13c442ad79d2;lr=on&gt;.<br>
f:
<a class="moz-txt-link-rfc2396E" href="mailto:sip:operator.aptela@voice.aptela.com">&lt;sip:operator.aptela@voice.aptela.com&gt;</a>;tag=7f1ca8c0-13c442ad79d2.<br>
t: "7732206484"<a class="moz-txt-link-rfc2396E" href="mailto:sip:7732206484@66.23.129.219:5090">&lt;sip:7732206484@66.23.129.219:5090&gt;</a>;tag=as10a69cf8.<br>
Call-ID: <a class="moz-txt-link-abbreviated" href="mailto:6bfbb1d627b2c0366bb2be7206177cea@66.23.129.219">6bfbb1d627b2c0366bb2be7206177cea@66.23.129.219</a>.<br>
CSeq: 2 REFER.<br>
Via: SIP/2.0/UDP 69.25.47.134;branch=z9hG4bKfd4a.00e82c93.0.<br>
Via: SIP/2.0/UDP
192.168.28.127:5060;received=64.81.147.138;rport=33049;branch=z9hG4bK-42ad79d6-1750412-5e02.<br>
Max-Forwards: 16.<br>
Supported: 100rel,replaces.<br>
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE.<br>
User-Agent: SIP Phone-1.0.41 - ABP.<br>
Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:operator.aptela@64.81.147.138:33049">&lt;sip:operator.aptela@64.81.147.138:33049&gt;</a>.<br>
Route: &lt;sip:69.25.47.134;lr;ftag=as10a69cf8&gt;.<br>
Referred-By: <a class="moz-txt-link-rfc2396E" href="mailto:sip:operator.aptela@voice.aptela.com">&lt;sip:operator.aptela@voice.aptela.com&gt;</a>.<br>
Refer-To: <a class="moz-txt-link-rfc2396E" href="mailto:sip:5100aptela@voice.aptela.com">&lt;sip:5100aptela@voice.aptela.com&gt;</a>.<br>
Content-Length: 0.<br>
</font></small><br>
<br>
but, instead, is<br>
<br>
<small><font color="#ff0000">REFER <a class="moz-txt-link-abbreviated" href="mailto:sip:7732206484@66.23.129.219:5090">sip:7732206484@66.23.129.219:5090</a>
SIP/2.0.<br>
Record-Route: &lt;sip:69.25.47.134;ftag=7f1ca8c0-13c442ad79d2;lr=on&gt;.<br>
f:
<a class="moz-txt-link-rfc2396E" href="mailto:sip:operator.aptela@voice.aptela.com">&lt;sip:operator.aptela@voice.aptela.com&gt;</a>;tag=7f1ca8c0-13c442ad79d2.<br>
t: "7732206484"<a class="moz-txt-link-rfc2396E" href="mailto:sip:7732206484@66.23.129.219:5090">&lt;sip:7732206484@66.23.129.219:5090&gt;</a>;tag=as10a69cf8.<br>
Call-ID: <a class="moz-txt-link-abbreviated" href="mailto:6bfbb1d627b2c0366bb2be7206177cea@66.23.129.219">6bfbb1d627b2c0366bb2be7206177cea@66.23.129.219</a>.<br>
CSeq: 2 REFER.<br>
Via: SIP/2.0/UDP
192.168.28.127:5060;rport;branch=z9hG4bK-42ad79d6-1750412-5e02.<br>
Max-Forwards: 16.<br>
Supported: 100rel,replaces.<br>
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE.<br>
User-Agent: SIP Phone-1.0.41 - ABP.<br>
Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:operator.aptela@64.81.147.138:33049">&lt;sip:operator.aptela@64.81.147.138:33049&gt;</a>.<br>
Route: &lt;sip:69.25.47.134;lr;ftag=as10a69cf8&gt;.<br>
Referred-By: <a class="moz-txt-link-rfc2396E" href="mailto:sip:operator.aptela@voice.aptela.com">&lt;sip:operator.aptela@voice.aptela.com&gt;</a>.<br>
Refer-To: <a class="moz-txt-link-rfc2396E" href="mailto:sip:5100aptela@voice.aptela.com">&lt;sip:5100aptela@voice.aptela.com&gt;</a>.<br>
Content-Length: 0.<br>
.<br>
Via: SIP/2.0/UDP 69.25.47.134;branch=z9hG4bKfd4a.00e82c93.0.<br>
;received=64.81.147.138;rport=33049<br>
<br>
</font></small>note the two lines at the bottom of the message.&nbsp; These
are the additional lines that got changed in the message as it was
processed.<br>
</body>
</html>