<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-forward-container"><br>
<br>
-------- Mensaje original --------
<table class="moz-email-headers-table" border="0" cellpadding="0"
cellspacing="0">
<tbody>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Return-Path:
</th>
<td><a class="moz-txt-link-rfc2396E" href="mailto:sr-users-bounces@lists.sip-router.org"><sr-users-bounces@lists.sip-router.org></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Delivered-To:
</th>
<td><a class="moz-txt-link-rfc2396E" href="mailto:a_villacis@palosanto.com"><a_villacis@palosanto.com></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Received:
</th>
<td>from palosanto.com by mail.palosanto.com (Dovecot) with
LMTP id o9JTLusS6VNAYAAA3RMWGw for
<a class="moz-txt-link-rfc2396E" href="mailto:a_villacis@palosanto.com"><a_villacis@palosanto.com></a>; Mon, 11 Aug 2014
14:02:20 -0500</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Received:
</th>
<td>from localhost (mail.palosanto.com [127.0.0.1]) by
palosanto.com (Postfix) with ESMTP id DB61213C026F for
<a class="moz-txt-link-rfc2396E" href="mailto:a_villacis@palosanto.com"><a_villacis@palosanto.com></a>; Mon, 11 Aug 2014
14:02:20 -0500 (ECT)</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">X-Virus-Scanned:
</th>
<td>Debian amavisd-new at mail.palosanto.com</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">X-Spam-Flag:
</th>
<td>NO</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">X-Spam-Score:
</th>
<td>-2.159</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">X-Spam-Level:
</th>
<td><br>
</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">X-Spam-Status:
</th>
<td>No, score=-2.159 tagged_above=-1000 required=6.31
tests=[AWL=-0.259, BAYES_00=-1.9] autolearn=ham</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Received:
</th>
<td>from palosanto.com ([127.0.0.1]) by localhost
(mail.palosanto.com [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id i5aRnN4kNPTq for
<a class="moz-txt-link-rfc2396E" href="mailto:a_villacis@palosanto.com"><a_villacis@palosanto.com></a>; Mon, 11 Aug 2014
14:02:17 -0500 (ECT)</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Received:
</th>
<td>from <a class="moz-txt-link-abbreviated" href="http://www.kamailio.org">www.kamailio.org</a> (main.kamailio.org
[193.22.119.66]) by palosanto.com (Postfix) with ESMTPS id
AAB2813C0276 for <a class="moz-txt-link-rfc2396E" href="mailto:a_villacis@palosanto.com"><a_villacis@palosanto.com></a>; Mon, 11
Aug 2014 14:02:16 -0500 (ECT)</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Received:
</th>
<td>from localhost ([127.0.0.1] helo=main.kamailio.org
ident=list) by <a class="moz-txt-link-abbreviated" href="http://www.kamailio.org">www.kamailio.org</a> with esmtp (Exim 4.72)
(envelope-from
<a class="moz-txt-link-rfc2396E" href="mailto:sr-users-bounces@lists.sip-router.org"><sr-users-bounces@lists.sip-router.org></a>) id
1XGurq-00065q-JJ; Mon, 11 Aug 2014 21:02:50 +0200</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Received:
</th>
<td>from lab2.palosanto.com ([201.234.196.173]
helo=palosanto.com) by <a class="moz-txt-link-abbreviated" href="http://www.kamailio.org">www.kamailio.org</a> with esmtp (Exim
4.72) (envelope-from <a class="moz-txt-link-rfc2396E" href="mailto:a_villacis@palosanto.com"><a_villacis@palosanto.com></a>) id
1XGuro-000654-FM for <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>; Mon,
11 Aug 2014 21:02:48 +0200</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Received:
</th>
<td>from localhost (mail.palosanto.com [127.0.0.1]) by
palosanto.com (Postfix) with ESMTP id D745713C026F for
<a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.sip-router.org"><sr-users@lists.sip-router.org></a>; Mon, 11 Aug 2014
14:02:04 -0500 (ECT)</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">X-Virus-Scanned:
</th>
<td>Debian amavisd-new at mail.palosanto.com</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Received:
</th>
<td>from palosanto.com ([127.0.0.1]) by localhost
(mail.palosanto.com [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 6B6_a4ssmARw for
<a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.sip-router.org"><sr-users@lists.sip-router.org></a>; Mon, 11 Aug 2014
14:02:02 -0500 (ECT)</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Received:
</th>
<td>from avillacis.palosanto.com (avillacis.palosanto.com
[192.168.3.2]) by palosanto.com (Postfix) with ESMTPSA id
8EBDA13C0286 for <a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.sip-router.org"><sr-users@lists.sip-router.org></a>;
Mon, 11 Aug 2014 14:01:33 -0500 (ECT)</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Message-ID:
</th>
<td><a class="moz-txt-link-rfc2396E" href="mailto:53E91331.50104@palosanto.com"><53E91331.50104@palosanto.com></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Date: </th>
<td>Mon, 11 Aug 2014 14:02:09 -0500</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">From: </th>
<td>Alex Villacís Lasso <a class="moz-txt-link-rfc2396E" href="mailto:a_villacis@palosanto.com"><a_villacis@palosanto.com></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">User-Agent:
</th>
<td>Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101
Thunderbird/24.7.0</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">MIME-Version:
</th>
<td>1.0</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">To: </th>
<td><a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">References:
</th>
<td><a class="moz-txt-link-rfc2396E" href="mailto:53E54348.9090904@palosanto.com"><53E54348.9090904@palosanto.com></a>
<a class="moz-txt-link-rfc2396E" href="mailto:53E8712A.2050407@gmail.com"><53E8712A.2050407@gmail.com></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">In-Reply-To:
</th>
<td><a class="moz-txt-link-rfc2396E" href="mailto:53E8712A.2050407@gmail.com"><53E8712A.2050407@gmail.com></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Subject:
</th>
<td>Re: [SR-Users] How do I make subst_hf() use variables in
search (not replacement)?</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">X-BeenThere:
</th>
<td><a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">X-Mailman-Version:
</th>
<td>2.1.13</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Precedence:
</th>
<td>list</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Reply-To:
</th>
<td>Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.sip-router.org"><sr-users@lists.sip-router.org></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">List-Id:
</th>
<td>"Kamailio \(SER\) - Users Mailing List"
<sr-users.lists.sip-router.org></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">List-Unsubscribe:
</th>
<td><a class="moz-txt-link-rfc2396E" href="http://lists.sip-router.org/cgi-bin/mailman/options/sr-users"><http://lists.sip-router.org/cgi-bin/mailman/options/sr-users></a>,
<a class="moz-txt-link-rfc2396E" href="mailto:sr-users-request@lists.sip-router.org?subject=unsubscribe"><mailto:sr-users-request@lists.sip-router.org?subject=unsubscribe></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">List-Archive:
</th>
<td><a class="moz-txt-link-rfc2396E" href="http://lists.sip-router.org/pipermail/sr-users"><http://lists.sip-router.org/pipermail/sr-users></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">List-Post:
</th>
<td><a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.sip-router.org"><mailto:sr-users@lists.sip-router.org></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">List-Help:
</th>
<td><a class="moz-txt-link-rfc2396E" href="mailto:sr-users-request@lists.sip-router.org?subject=help"><mailto:sr-users-request@lists.sip-router.org?subject=help></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">List-Subscribe:
</th>
<td><a class="moz-txt-link-rfc2396E" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"><http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users></a>,
<a class="moz-txt-link-rfc2396E" href="mailto:sr-users-request@lists.sip-router.org?subject=subscribe"><mailto:sr-users-request@lists.sip-router.org?subject=subscribe></a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Content-Transfer-Encoding:
</th>
<td>quoted-printable</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Content-Type:
</th>
<td>text/plain; charset="windows-1252"; Format="flowed"</td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Sender:
</th>
<td><a class="moz-txt-link-abbreviated" href="mailto:sr-users-bounces@lists.sip-router.org">sr-users-bounces@lists.sip-router.org</a></td>
</tr>
<tr>
<th nowrap="nowrap" valign="BASELINE" align="RIGHT">Errors-To:
</th>
<td><a class="moz-txt-link-abbreviated" href="mailto:sr-users-bounces@lists.sip-router.org">sr-users-bounces@lists.sip-router.org</a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>El 11/08/14 02:30, Daniel-Constantin Mierla escribió:
> I haven't looked at the code, but probably the function doesn't accept variable for the matching regular expression.
>
> If the IP/port of asterisk are not changed, you can try:
>
> #!substdef "/ASTERISKIP/127.0.0.1/"
> #!substdef "/ASTERISKPORT/5080/"
>
> asterisk.bindip = "ASTERISKIP" ...
> asterisk.bindport = ASTERISKPORT ...
>
> subst_hf("Contact", "/ASTERISKIP:ASTERISKPORT/$td/", "a");
>
> Cheers,
> Daniel
>
> On 08/08/14 23:38, Alex Villacís Lasso wrote:
>> Consider the following snippet:
>>
>> if (is_present_hf("Contact")) {
>> xlog("L_ALERT", "===== reply to SUBSCRIBE has Contact:$ct\n");
>> xlog("L_ALERT", "===== want to replace with $td\n");
>> xlog("L_ALERT", "===== regexp to use is /$sel(cfg_get.asterisk.bindip):$sel(cfg_get.asterisk.bindport)/$td/\n");
>> if (subst_hf("Contact", "/127.0.0.1:5080/$td/", "a")) {
>> xlog("L_ALERT", "===== reply had Contact modified\n");
>> }
>> }
>>
>> If I use the hardcoded regexp "/127.0.0.1:5080/$td/", subst_hf() replaces the Contact value correctly.
>>
>> However, if I use "/$sel(cfg_get.asterisk.bindip):$sel(cfg_get.asterisk.bindport)/$td/" (where asterisk.bindip and asterisk.bindport are the supposed values 127.0.0.1 and 5080), subst_hf() fails to replace the Contact value.
>>
>> How do I make use of the existing configuration variables in order to substitute in the Contact header?
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
>> <a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
>
Thanks for the tip.
However, I also have an issue - subst_hf() does not seem to be working. Consider the following route, of which the snippet quoted above is a part:
# manage incoming replies
onreply_route[MANAGE_REPLY] {
# run rtpproxy resolution
route(MHOMED_ELASTIX);
xdbg("incoming reply\n");
if(status=~"[12][0-9][0-9]")
route(NATMANAGE);
if (is_method("SUBSCRIBE") && route(FROMASTERISK)) {
#xlog("L_ALERT", "===== reply to SUBSCRIBE, coming from asterisk, Call-ID is $ci\n");
$sht(pending_subscribe=>$ci) = 0;
if (is_present_hf("Contact")) {
xlog("L_ALERT", "===== reply to SUBSCRIBE has Contact: $ct\n");
xlog("L_ALERT", "===== want to replace with $td\n");
xlog("L_ALERT", "===== regexp to use is /$sel(cfg_get.asterisk.bindip):$sel(cfg_get.asterisk.bindport)/$td/\n");
if (subst_hf("Contact", "/127.0.0.1:5080/$td/", "a")) {
xlog("L_ALERT", "===== reply hadContact modified\n");
}
}
}
# manage websocket reply
if (nat_uac_test(64)) {
# Do NAT traversal stuff for replies to a WebSocket connection
# - even if it is not behind a NAT!
# This won't be needed in the future if Kamailio and the
# WebSocket client support Outbound and Path.
add_contact_alias();
}
}
When I run this with debug=4, I get the following:
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [socket_info.c:583]: grep_sock_info(): grep_sock_info - checking if host==us: 9==9 && [127.0.0.1] == [127.0.0.1]
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [dset.c:769]: uri_add_rcv_alias(): encoded <a class="moz-txt-link-rfc2396E" href="mailto:sip:102@127.0.0.1:5080"><sip:102@127.0.0.1:5080></a> => [<a class="moz-txt-link-abbreviated" href="mailto:sip:102@127.0.0.1:5080;alias=127.0.0.1~5080~1">sip:102@127.0.0.1:5080;alias=127.0.0.1~5080~1</a>
]
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [select.c:429]: run_select(): Calling SELECT 0x7f8e431a3d90
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [select.c:429]: run_select(): Calling SELECT 0x7f8e43292ac0
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: htable [ht_var.c:90]:pv_set_ht_cell(): set value for $ht(pending_subscribe=>6a2222bca4cc2be8)
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: ALERT: <script>: ===== reply to SUBSCRIBE has Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:102@127.0.0.1:5080"><sip:102@127.0.0.1:5080></a>;expires=3600
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: ALERT: <script>: ===== want to replace with pbx.villacis.com
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [select.c:429]: run_select(): Calling SELECT 0x7f8e431a3d90
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [select.c:429]: run_select(): Calling SELECT 0x7f8e43292ac0
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: ALERT: <script>: ===== regexp to use is /127.0.0.1:5080/pbx.villacis.com/
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [re.c:454]: subst_run(): subst_run: running. r=0
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [re.c:475]: subst_run(): subst_run: matched (9, 14): [127.0.0.1:5080]
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: textops [textops.c:2285]: subst_hf_f(): textops replacing at offset 849 [127.0.0.1:5080] with [pbx.villacis.com]
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: textops [textops.c:2351]: subst_hf_f(): lst was 0x7f8e432e4918
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: ALERT: <script>: ===== reply had Contact modified
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: tm [t_reply.c:1304]: t_should_relay_response(): ->>>>>>>>> T_code=0, new_code=200
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: tm [t_reply.c:1822]: relay_reply(): DEBUG: relay_reply: branch=0, save=0, relay=0 icode=0
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [msg_translator.c:2009]: generate_res_buf_from_sip_res(): old size: 900, new size: 813
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [msg_translator.c:2027]: generate_res_buf_from_sip_res(): copied size: orig:863, new: 776, rest: 37 msg=#012SIP/2.0 200 OK#015#012Via: SIP/2.0/UDP
192.168.2.100:5060;rport=5060;branch=z9hG4bK036380ac70257f0f5#015#012Record-Route: <sip:127.0.0.1;r2=on;lr=on;ftag=239adbead7;vsf=cBoZSlANEgEdDBcAFx8lMBIaVlgfBQANAgoaXU0MAi0xMjcuMC4wLjE6NTA4MA--;nat=yes>#015#012Record-Route:
<sip:192.168.2.18;r2=on;lr=on;ftag=239adbead7;vsf=cBoZSlANEgEdDBcAFx8lMBIaVlgfBQANAgoaXU0MAi0xMjcuMC4wLjE6NTA4MA--;nat=yes>#015#012From: "jgutierrez" <a class="moz-txt-link-rfc2396E" href="mailto:sip:jgutierrez@pbx.villacis.com"><sip:jgutierrez@pbx.villacis.com></a>;tag=239adbead7#015#012To: ""
<a class="moz-txt-link-rfc2396E" href="mailto:sip:102@pbx.villacis.com"><sip:102@pbx.villacis.com></a>;tag=as2e48d5d6#015#012Call-ID: 6a2222bca4cc2be8#015#012CSeq: 22329 SUBSCRIBE#015#012Server: Asterisk PBX 11.11.0#015#012Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE#015#012Supported:
replaces, timer#015#012Expires: 3600#015#012Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:102@127.0.0.1:5080;alias=127.0.0.1~5080~1pbx.villacis.com"><sip:102@127.0.0.1:5080;alias=127.0.0.1~5080~1pbx.villacis.com></a>;expires=3600#015#012Content-Length: 0#015#012#015#012
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [mem/shm_mem.c:111]: _shm_resize(): WARNING:vqm_resize: resize(0) called
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: tm [t_reply.c:1663]: cleanup_uac_timers(): DEBUG: cleanup_uac_timers: RETR/FR timers reset
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list: destroying list (nil)
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list: destroying list (nil)
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list: destroying list (nil)
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list: destroying list (nil)
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list: destroying list (nil)
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list: destroying list (nil)
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [xavp.c:448]: xavp_destroy_list(): destroying xavp list (nil)
Aug 11 12:52:53 elx3 /usr/sbin/kamailio[2971]: DEBUG: <core> [receive.c:296]: receive_msg(): receive_msg: cleaning up
Apparently the search matched, and the replace was made. However, the replacement is incorrect:
Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:102@127.0.0.1:5080;alias=127.0.0.1~5080~1pbx.villacis.com"><sip:102@127.0.0.1:5080;alias=127.0.0.1~5080~1pbx.villacis.com></a>;expires=3600
What I going on? Is the regexp incorrect? What I expected for the Contact header is this:
Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:102@pbx.villacis.com"><sip:102@pbx.villacis.com></a>;expires=3600
or this:
Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:102@pbx.villacis.com;alias=127.0.0.1~5080~1"><sip:102@pbx.villacis.com;alias=127.0.0.1~5080~1></a>;expires=3600
...although I am not sure whether the latter is a valid header, but at least it would do something expected.
The documentation (<a class="moz-txt-link-freetext" href="http://www.kamailio.org/docs/modules/4.1.x/modules/textops.html#idp1655472">http://www.kamailio.org/docs/modules/4.1.x/modules/textops.html#idp1655472</a>) says the regexp is perl-style, and a sample running with perl shows the regexp to work correctly and to do what I want. I made a mistake when I mentioned that subst_hf() works correctly with the hardcoded regexp. What was really happening is that it does get accepted as a valid configuration, but displays unexpected behavior.
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
<br>
</div>
<br>
</body>
</html>