[Users] OpenSER + SEMS + Nat?

Brandon Armstead brandon.armstead at gmail.com
Wed Nov 8 14:37:20 CET 2006


Hello,

    I currently have an openser server running on port 5060, and a second
that handles voicemail / stateful transaction stuff on port 5070.  So, I am
having proxy A forward to proxy B to do the handling which are both on the
same server, although there seems to be a problem with NAT'ing, when I call
'voicemail' or something I can not hear anything.  It seems to be because it
is sending the RTP data to the wrong location?  It should be sending it back
to public-ip-addr-1 when it is sending to an internal ip address 192.168.1.*

Here is the log from sems:
101
44811:1466724767
<sip:public-ip-addr-1:5060;nat=yes;ftag=dd9bbf561d35ee06o0;lr=on>
sip:public-ip-addr-1:5060;nat=yes;ftag=dd9bbf561d35ee06o0;lr=on
P-MsgFlags: 0
UA: Linksys/PAP2-3.1.9(LSa)
P-Email-Address: test at test.com
.
v=0
o=- 9200357 9200357 IN IP4 192.168.1.241
s=-
c=IN IP4 192.168.1.241
t=0 0
m=audio 16420 RTP/AVP 0 2 4 8 18 96 97 98 100 101
a=rtpmap:0 PCMU/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:4 G723/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729a/8000
a=rtpmap:96 G726-40/8000
a=rtpmap:97 G726-24/8000
a=rtpmap:98 G726-16/8000
a=rtpmap:100 NSE/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:30
a=sendrecv
>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:99): req.method = <INVITE>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:100): req.user = <115>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:101): req.domain =
<public-ip-addr-1>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:102): req.dstip =
<public-ip-addr-1>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:103): req.port = <5070>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:104): req.r_uri = <
sip:115 at public-ip-addr-1:5070>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:105): req.from_uri = <
sip:1000 at 192.168.1.241:5060>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:106): req.from = <Brandon1 <
sip:1000 at test.mydomain.com>>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:107): req.to = <<
sip:115 at test.mydomain.com>>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:108): req.callid = <
81e2d596-978fccc6 at 192.168.1.241>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:109): req.from_tag =
<dd9bbf561d35ee06o0>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:110): req.to_tag = <>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:113): cseq_str = <101>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:119): cseq = <101>(101)
(7856) DEBUG: execute (AmInterfaceHandler.cpp:121): req.key =
<44811:1466724767>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:122): req.route =
<<sip:public-ip-addr-1:5060;nat=yes;ftag=dd9bbf561d35ee06o0;lr=on>>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:123): req.next_hop =
<sip:public-ip-addr-1:5060;nat=yes;ftag=dd9bbf561d35ee06o0;lr=on>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:128): hdrs = <P-MsgFlags: 0
UA: Linksys/PAP2-3.1.9(LSa)
P-Email-Address: test at test.com
>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:133): body = <v=0
o=- 9200357 9200357 IN IP4 192.168.1.241
s=-
c=IN IP4 192.168.1.241
t=0 0
m=audio 16420 RTP/AVP 0 2 4 8 18 96 97 98 100 101
a=rtpmap:0 PCMU/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:4 G723/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729a/8000
a=rtpmap:96 G726-40/8000
a=rtpmap:97 G726-24/8000
a=rtpmap:98 G726-16/8000
a=rtpmap:100 NSE/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:30
a=sendrecv
>
(7856) DEBUG: execute (AmInterfaceHandler.cpp:144): Request OK: dispatch it!
(7856) DEBUG: postEvent (AmEventQueue.cpp:48): AmEventQueue: trying to post
event
(7856) DEBUG: postEvent (AmEventQueue.cpp:56): AmEventQueue: event posted
(7856) DEBUG: processEvents (AmEventQueue.cpp:69): before processing event
(7856) DEBUG: process (AmSession.cpp:421): AmSession::process
(7856) DEBUG: process (AmSession.cpp:425): Session received SIP Event
(7856) DEBUG: onSipRequest (AmSession.cpp:472): onSipRequest: method =
INVITE
(7856) DEBUG: parse_sdp_media (AmSdp.cpp:632): next_line=<a=rtpmap:0
PCMU/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:4 G723/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729a/8000
a=rtpmap:96 G726-40/8000
a=rtpmap:97 G726-24/8000
a=rtpmap:98 G726-16/8000
a=rtpmap:100 NSE/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:30
a=sendrecv
>
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:0 PCMU/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=0;
enc=PCMU; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:2 G726-32/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=2;
enc=G726-32; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:4 G723/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=4;
enc=G723; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:8 PCMA/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=8;
enc=PCMA; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:18 G729a/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=18;
enc=G729a; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:96 G726-40/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=96;
enc=G726-40; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:97 G726-24/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=97;
enc=G726-24; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:98 G726-16/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=98;
enc=G726-16; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:100 NSE/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=100;
enc=NSE; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:101 telephone-event/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=101;
enc=telephone-event; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=fmtp:101 0-15
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=ptime:30
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:740): unknown attribute
definition 'ptime:30'
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=sendrecv
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:745): flag definition is not
yet supported (sendrecv)
(7856) DEBUG: parse_sdp_media (AmSdp.cpp:651): ret=0; next_line=<>
(7856) DEBUG: getCompatiblePayload (AmSdp.cpp:341): payload found:
0/PCMU/8000
(7856) DEBUG: getCompatiblePayload (AmSdp.cpp:344): using global address:
192.168.1.241
(7856) DEBUG: negotiate (AmSession.cpp:247): remote party supports telephone
events (pt=101)
(7856) DEBUG: setRAddr (AmRtpStream.cpp:346): RTP remote address set to
192.168.1.241:16420
(7856) DEBUG: init (AmRtpAudio.cpp:146): AmRtpAudio::init(...)
(7856) DEBUG: acceptAudio (AmSession.cpp:607): Sending Rtp data to
192.168.1.241/16420
(7856) DEBUG: updateStatusReply (AmSipDialog.cpp:86): reply: transaction
found!
(7856) DEBUG: updateStatusReply (AmSipDialog.cpp:125): req.method = INVITE;
t.method = INVITE
(7856) DEBUG: init (AmCtrlInterface.cpp:231): AmUnixCtrlInterface::init @
/tmp/5D08F0A1-4552226600080041-08108600
(7856) DEBUG: write_to_socket (AmUtils.cpp:588): sending:
<:t_reply:/tmp/5D08F0A1-4552226600080041-08108600
200
OK
44811:1466724766
193812C5-45522256000F0C97-08103000
Contact: <sip:115 at public-ip-addr-1:5070>
Content-Type: application/sdp
.
v=0
o=username 0 0 IN IP4 public-ip-addr-1
s=session
c=IN IP4 public-ip-addr-1
t=0 0
m=audio 10022 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
.

>
(7856) DEBUG: write_to_socket (AmUtils.cpp:614): write to unix socket:
completed
(7856) DEBUG: cacheMsg (AmCtrlInterface.cpp:186): recv-ed: <200 Succeeded>
(7856) DEBUG: processEvents (AmEventQueue.cpp:71): event processed
(7856) DEBUG: processEvents (AmEventQueue.cpp:69): before processing event
(7856) DEBUG: process (AmSession.cpp:421): AmSession::process
(7856) DEBUG: process (AmSession.cpp:425): Session received SIP Event
(7856) DEBUG: onSipRequest (AmSession.cpp:472): onSipRequest: method =
INVITE
(7856) DEBUG: parse_sdp_media (AmSdp.cpp:632): next_line=<a=rtpmap:0
PCMU/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:4 G723/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729a/8000
a=rtpmap:96 G726-40/8000
a=rtpmap:97 G726-24/8000
a=rtpmap:98 G726-16/8000
a=rtpmap:100 NSE/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:30
a=sendrecv
>
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:0 PCMU/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=0;
enc=PCMU; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:2 G726-32/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=2;
enc=G726-32; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:4 G723/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=4;
enc=G723; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:8 PCMA/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=8;
enc=PCMA; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:18 G729a/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=18;
enc=G729a; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:96 G726-40/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=96;
enc=G726-40; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:97 G726-24/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=97;
enc=G726-24; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:98 G726-16/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=98;
enc=G726-16; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:100 NSE/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=100;
enc=NSE; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=rtpmap:101 telephone-event/8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:693): sdp attribute: pt=101;
enc=telephone-event; cr=8000
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=fmtp:101 0-15
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=ptime:30
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:740): unknown attribute
definition 'ptime:30'
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:658): parse_sdp_attribute:
s=sendrecv
(7856) DEBUG: parse_sdp_attribute (AmSdp.cpp:745): flag definition is not
yet supported (sendrecv)
(7856) DEBUG: parse_sdp_media (AmSdp.cpp:651): ret=0; next_line=<>
(7856) DEBUG: getCompatiblePayload (AmSdp.cpp:341): payload found:
0/PCMU/8000
(7856) DEBUG: getCompatiblePayload (AmSdp.cpp:344): using global address:
192.168.1.241
(7856) DEBUG: negotiate (AmSession.cpp:247): remote party supports telephone
events (pt=101)
(7856) DEBUG: setRAddr (AmRtpStream.cpp:346): RTP remote address set to
192.168.1.241:16420
(7856) DEBUG: init (AmRtpAudio.cpp:146): AmRtpAudio::init(...)
(7856) DEBUG: acceptAudio (AmSession.cpp:607): Sending Rtp data to
192.168.1.241/16420
(7856) DEBUG: updateStatusReply (AmSipDialog.cpp:86): reply: transaction
found!
(7856) DEBUG: updateStatusReply (AmSipDialog.cpp:125): req.method = INVITE;
t.method = INVITE
(7856) DEBUG: init (AmCtrlInterface.cpp:231): AmUnixCtrlInterface::init @
/tmp/75EE09BE-4552226600080514-08108600
(7856) DEBUG: write_to_socket (AmUtils.cpp:588): sending:
<:t_reply:/tmp/75EE09BE-4552226600080514-08108600
200
OK
44811:1466724767
193812C5-45522256000F0C97-08103000
Contact: <sip:115 at public-ip-addr-1:5070>
Content-Type: application/sdp
.
v=0
o=username 0 0 IN IP4 public-ip-addr-1
s=session
c=IN IP4 public-ip-addr-1
t=0 0
m=audio 10022 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
.

>
(7856) DEBUG: write_to_socket (AmUtils.cpp:614): write to unix socket:
completed
(7856) DEBUG: cacheMsg (AmCtrlInterface.cpp:186): recv-ed: <200 Succeeded>
(7856) DEBUG: processEvents (AmEventQueue.cpp:71): event processed
(7856) DEBUG: run (AmSession.cpp:292): 81e2d596-978fccc6 at 192.168.1.241
dlg.getUACTransPending() = 0


Here is my config for "proxy B" the transaction handling with SEMS that
"proxy A" sends to:
#
# $Id: ser.cfg,v 1.25.2.1 2005/02/18 14:30:44 andrei Exp $
#
# ser for sems configuration

# ----------- global configuration parameters ------------------------

debug=3         # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes        # (cmd line: -E)

check_via=no    # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
port=5070
children=4

unix_sock="/tmp/openser_sems_sock"
# ------------------ module loading ----------------------------------

mpath="/usr/local/lib/openser/modules"

loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "textops.so"
loadmodule "avpops.so"
# ----------------- setting module-specific parameters ---------------

# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
modparam("avpops", "avp_aliases", "email=i:67")
modparam("tm", "pass_provisional_replies", 1)
# appends for INVITE to voicemail
modparam("tm", "tw_append",
"voicemail_headers:UA=$hdr(User-Agent);P-Email-Address=$avp(s:email)")

# appends for dtmf per INFO
modparam("tm", "tw_append",
"info_append:Content-Length=$hdr(Content-Length);Content-Type=$hdr(Content-Type);$rb")

# main routing logic

route{

        # initial sanity checks -- messages with
        # max_forwards==0, or excessively long requests
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                return;
        };
        if (msg:len >=  2048 ) {
                sl_send_reply("513", "Message too big");
                return;
        };

        if (method != "ACK" && method != "INVITE" && method != "BYE"
                && method != "CANCEL" && method != "INFO" ){
                        log("unsupported method\n");
                        sl_send_reply("500","unsupported method");
                        return;
        }
        # we record-route all messages -- to make sure that
        # subsequent messages will go through our proxy; that's
        # particularly good if upstream and downstream entities
        # use different transport protocol
        record_route();

        # subsequent messages withing a dialog should take the
        # path determined by record-routing
        # make transaction
        if (loose_route()) {
                # mark routing logic in request
                append_hf("P-hint: rr-enforced\r\n");
                if (!t_relay()) {
                        sl_reply_error();
                }
                return;
        };

        if (!t_newtran()){
                log("could not create transaction\n");
                sl_send_reply("500","could not create transaction");
                return;
        }

        # actively absorb ACKs
        if (method == "ACK") {
                t_relay();
                return;
        }

        # pass INFO to SEMS
        if (method=="INFO") {
                if(!t_write_unix("/tmp/sems_sock","sems/info_append")){
                        log("could not contact sems\n");
                        t_reply("500","could not contact media server");
                }
        }

        if (uri =~ "sip:101.*@") {
                if (!t_write_unix("/tmp/sems_sock","myapp")){
                        log("could not contact media server\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }

        if (uri =~ "sip:102.*@") {
                if (!t_write_unix("/tmp/sems_sock","myconfigurableapp")){
                        log("could not contact media server\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }

        if (uri =~ "sip:103.*@") {
                if (!t_write_unix("/tmp/sems_sock","myannounceapp")){
                        log("could not contact media server\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }


        if (uri =~ "sip:104.*@") {
                if (!t_write_unix("/tmp/sems_sock","myjukebox")){
                        log("could not contact media server\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }


        if (uri =~ "sip:105.*@") {
                if (!t_write_unix("/tmp/sems_sock","mycc")){
                        log("could not contact media server\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }


        if (uri =~ "sip:106.*@") {
                if (!t_write_unix("/tmp/sems_sock","ivr_announce")){
                        log("could not contact media server\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }






############ default sems apps
        if (uri =~ "sip:110.*@") {
                if (!t_write_unix("/tmp/sems_sock","echo")){
                        log("could not contact echo\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }


        if (uri =~ "sip:111.*@") {
                if (!t_write_unix("/tmp/sems_sock","announcement")){
                        log("could not contact announcement\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }

        if (uri =~ "sip:112.*@") {
                if (!t_write_unix("/tmp/sems_sock","conference")){
                        log("could not contact conference\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }


        if (uri =~ "sip:113.*@") {
                if (!t_write_unix("/tmp/sems_sock","mailbox")){
                        log("could not contact mailbox\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }

        if (uri =~ "sip:114.*@") {
                if (!t_write_unix("/tmp/sems_sock","early_announce")){
                        log("could not contact early_announce\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }

        if (uri =~ "sip:115.*@") {
                # load email avp with some email address
                avp_write("test at test.com","$avp(s:email)");
                # use voicemail_headers append to pass it to sems
                if
(!t_write_unix("/tmp/sems_sock","voicemail/voicemail_headers")){
                        log("could not contact voicemail\n");
                        t_reply("500","could not contact media server");
                        return;
                }
                return;
        }


        t_reply("404","Not found");
}


Thank you, any and all help is appreciated, thanks again!
-- 
Brandon Armstead
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20061108/f23fb711/attachment.htm>


More information about the sr-users mailing list