Hi Daniel,

I've just sent the captures on to you privately.

Thanks

On 09/08/2016 08:34, Daniel-Constantin Mierla wrote:
Hello,

can you send the pcap with sip messages for such situation? It will help
to understand if Via is used corerctly for replies.

Cheers,
Daniel


On 08/08/16 18:51, Asgaroth wrote:
Hi All,

I have a configuration where we run a multi-homed proxy/loadbalancer
and a seperate internal presence server. We then use
pua/pua-dialoginfo on the proxies to publish dialog state to the
internal presence server.

The proxies listen on udp:external_ip:5062 and udp:internal_ip1:5060.
The presence server listens on udp:internal_ip2:5060 on a seperate
server.

The problem I am coming accross is that when kamailio generates a
PUBLISH message for some dialogs it creates the via header with
address external:ip:5062, however the pua module is configured to send
to the presence server address on internal_ip2:5060. I have a route
which forces the sending socket ($fs) to be udp:internal_ip1:5060.

What happens then is that the presence server tries to send the 200
reply to the PUBLISH message back to internal_ip1:5062 (when it should
be internal_ip1:5060), I'm thinking this is because the Via header has
host as external_ip:5062.

Is it possible, from event-route[tm:local-request] to rewrite the via
header so that it reflects internal_ip1:5060 instead of external_ip:5062?

I did try the following snippet from event-route[tm:local-request],
but I got module parse errors on the Via header:

if (is_method("PUBLISH")) {
       subst_hf("Via", "/ 1\.2\.3\.[0-9]+:5062;/
$sel(cfg_get.socket.internal_ip);/", "f");
}

[7370]: ERROR: <core> [parser/parse_via.c:2607]: parse_via():
ERROR:parse_via on <1> state 5 (default)
[7370]: ERROR: <core> [parser/parse_via.c:2708]: parse_via(): ERROR:
parse_via on: <SIP/2.0/UDP
external_ip:5062;branch=z9hG4bK96eb.0f014ae4000000000000000000000000.0#015#012
internal_ip1;
[7370]: ERROR: <core> [parser/parse_via.c:2712]: parse_via(): ERROR:
parse_via parse error, parsed so far:<SIP/2.0/UDP
external_ip:5062;branch=z9hG4bK96eb.0f014ae4000000000000000000000000.0#015#012
[7370]: ERROR: <core> [parser/msg_parser.c:125]: get_hdr_field():
ERROR: get_hdr_field: bad via
[7370]: INFO: <core> [parser/msg_parser.c:338]: parse_headers():
ERROR: bad header field [Via: SIP/2.0/UDP 1]
[7370]: ERROR: <core> [parser/msg_parser.c:690]: parse_msg(): ERROR:
parse_msg: message=<PUBLISH sip:user@domain;transport=UDP
SIP/2.0#015#012Via: SIP/2.0/UDP
external_ip:5062;branch=z9hG4bK96eb.0f014ae4000000000000000000000000.0#015#012
internal_ip1;To: <sip:user@domain;transport=UDP>#015#012From:
<sip:user@domain;transport=UDP>;tag=3e8fdaca277026bf3e6d75c5e5313096-f162#015#012CSeq:
10 PUBLISH#015#012Call-ID:
5634294b786134b3-7370@external_ip#015#012Content-Length:
692#015#012User-Agent: kamailio (bfievklb04)#015#012Max-Forwards:
70#015#012Event: dialog#015#012Expires: 10901#015#012Content-Type:
application/dialog-info+xml#015#012#015#012<?xml
version="1.0"?>#012<dialog-info
xmlns="urn:ietf:params:xml:ns:dialog-info" version="0" state="full"
entity="sip:user@domain;transport=UDP">#012  <dialog
id="mvqXXaAr24DHdfsffYKZeA.." call-id="mvqXXaAr24DHdfsffYKZeA.."
direction="initiator">#012 <state>Trying</state>#012    <remote>#012
<identity>sip:1234567@domain;transport=UDP</identity>#012 <target
uri="sip:1234567@domain;transport=UDP"/>#012 </remote>#012
<local>#012 <identity>sip:user@domain;transport=UDP</identity>#012
<target uri="sip:user@domain;transport=UDP"/>#012 </local>#012
</dialog>#012</dialog-info>#012>
[7370]: ERROR: <core> [msg_translator.c:3057]:
build_sip_msg_from_buf(): parsing failed
[7370]: ERROR: tm [uac.c:163]: uac_refresh_hdr_shortcuts(): failed to
parse msg buffer
[7370]: ERROR: tm [uac.c:487]: t_uac_prepare(): failed to refresh
header shortcuts
[7370]: ERROR: pua [send_publish.c:700]: send_publish(): in t_request
tm module function
[7370]: ERROR: pua_dialoginfo [dialog_publish.c:358]:
dialog_publish(): while sending publish

To me, it looks like the replace section of the subst_hf sub
expression is being appended to the end of the via header instead of
replacing the address section found.

I have sanitized the above output to not show internal details, but if
you need it, I can send it on to you privately.

Am I going about this issue in the correct way, and, if so, where am I
going wrong with the subst_hf snippet above?

Kamailio version is 4.3.6.

Any pointers/tips/trciks are greatly appreciated.

Thanks

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to