Hi,

Recently the maintainer of the SIPs proxy in our company quit, and well I'm
the new in charge of this project, the bad new is I had 0 experience with
SIP.  After some week I got my first case related to our "SIP proxy".

We are using OpenSIP 1.8 within our Firewall to handle the protocol and the
NAT that it will imply within a Firewall. The script my ex coworker did is
working in 99% of cases but this specific case.

The customer has one setup like this


PhoneA
PhoneB
PhoneC --- Call Manager --- Firewall --- SBC --- Farm of RTP Media servers
....
PhoneN

The opensips instance is running within the firewall. The next IPs are fake
but follow the "rules" of internal/external it is just to avoid problems

Call Manager: 172.17.1.1
Firewall: Internal Network 192.168.0.10
Firewall: Extenal Network 62.1.1.10
SBC: 210.200.100.100
Farm of Media Servers: 210.200.100.128/25

So the invite works as Expected but on the 180 Ringing either 200 OK the
moment the messages traverse the SIP proxy, doesn't contain the "farm" IP
but the SBC IP.

This are the 180 Ringing:

>From SBC to the Firewall

SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 62.1.1.10:5060;branch=z9hG4bKd091.937a047.0
Via: SIP/2.0/UDP 172.17.1.1:5060
;rport=5060;received=172.17.1.1;branch=z9hG4bKac393424402
From: <sip:[email protected]>;tag=1c393411873
To: <sip:[email protected];user=phone>;tag=gK08c71cc5
Call-ID: [email protected]
CSeq: 1 INVITE
Record-Route: <sip:62.1.1.10:5060;r2=on;lr;did=6d8.933abaa6>
Record-Route: <sip:192.168.0.10:5060;r2=on;lr;did=6d8.933abaa6>
Contact: <sip:[email protected]:5060>
Allow:
INVITE,ACK,CANCEL,BYE,REGISTER,REFER,INFO,SUBSCRIBE,NOTIFY,PRACK,UPDATE,OPTIONS,MESSAGE,PUBLISH
Require: 100rel
RSeq: 433990
Content-Length:   266
Content-Disposition: session; handling=required
Content-Type: application/sdp

v=0
o=Sonus_UAC 176482 50736 IN IP4 210.200.100.100
s=SIP Media Capabilities
c=IN IP4 210.200.100.243
t=0 0
m=audio 61348 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=ptime:20
a=silenceSupp:off - - - -

After the firewall + Opensips have processed this message to the call center

SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 172.17.1.1:5060;branch=z9hG4bKac393424402
From: <sip:[email protected]>;tag=1c393411873
To: <sip:[email protected];user=phone>;tag=gK08c71cc5
Call-ID: [email protected]
CSeq: 1 INVITE
Record-Route: <sip::62.1.1.10:5060;r2=on;lr;did=6d8.933abaa6>
Record-Route: <sip:192.168.0.10:5060;r2=on;lr;did=6d8.933abaa6>
Contact: <sip:[email protected]>
Allow:
INVITE,ACK,CANCEL,BYE,REGISTER,REFER,INFO,SUBSCRIBE,NOTIFY,PRACK,UPDATE,OPTIONS,MESSAGE,PUBLISH
Require: 100rel
RSeq: 433990
Content-Length: 295
Content-Disposition: session; handling=required
Content-Type: application/sdp

v=0
o=Sonus_UAC 176482 50736 IN IP4 210.200.100.100
s=SIP Media Capabilities
t=0 0
m=audio 4845 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=ptime:20
a=silenceSupp:off - - - -
a=nortpproxy:yes
c=IN IP4 210.200.100.100
a=rtcp:4848

----

The RTP "acceptor" is created under the IP 210.200.100.100 instead of the
IP 210.200.243 as the SIPproxy is changing the SDP connection information.


This is the logic we are using in our script for the INVITE and for the
onreply_route

if (is_method("INVITE")){
if (has_body("application/sdp")) {
$var(trustconnectionip) = "%TRUSTCONNECTIONIP%";
$var(ciptrusted) = "no";
if ($var(trustconnectionip)=="yes") {
$var(ciptrusted) = "yes";
} else if ($var(trustconnectionip)=="auto") {
$var(sdpc) = $(rb{sdp.line,c}{s.substr,9,0});
if($td == $fd && $td != $var(sdpc)) {
$var(ciptrusted) = "yes";
}
}
if ($var(ciptrusted)=="yes") {
rtpproxy_offer("focnr");
} else {
rtpproxy_offer("focn");
}
}
}



And on the onreply

if (has_body("application/sdp")) { $var(trustconnectionip) =
"%TRUSTCONNECTIONIP%"; $var(ciptrusted) = "no"; if
($var(trustconnectionip)=="yes") { $var(ciptrusted) = "yes"; } else if
($var(trustconnectionip)=="auto") { $var(sdpc) =
$(rb{sdp.line,c}{s.substr,9,0}); if($td == $fd && $td != $var(sdpc)) {
$var(ciptrusted) = "yes"; } } if ($var(ciptrusted)=="yes") {
rtpproxy_answer("fr"); } else { rtpproxy_answer("f"); } }


Where TRUSTONNECTIONIP = "no" so basically we are doing

rptproxy_offer("focn") and rtpproxy_answer("f").

Kind regards:

Jose Palma
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to