[OpenSER-Users] Problem with Mediaproxy
Dan-Cristian Bogos
dan.bogos at gmail.com
Tue Dec 11 10:11:23 CET 2007
Daniel,
Can you post also your mediaproxy configuration?
Perhaps as test case you should start mediaproxy in foreground
(mediaproxy.py --no-fork) and check what comes out.
DanB
On Dec 7, 2007 1:59 PM, Daniel <d.grotti at gmail.com> wrote:
> Hi,
> this is my call flow (from client side making the call: 192.168.10.224):
>
> The INVITE received by 192.168.0.167 (sent by 192.168.10.224 and processed
> by proxy) has SDP body with PRIVATE IP and PORT.
>
> -----------------------------------------------------------------------------------
>
> # 192.162.10.224 ----> PROXY
>
> Request-Line: INVITE sip:franco.callegati at PROXY_IP SIP/2.0
> Message Header
> Via: SIP/2.0/UDP
> 192.168.10.224:64244;branch=z9hG4bK-d87543-9947ff15e2520b54-1--d87543-
> Max-Forwards: 70
> Contact: <sip:daniel.grotti at 192.168.10.224:64244>
> To: "franco.callegati"<sip:franco.callegati at PROXY_IP>
> From: "casa"<sip:daniel.grotti at PROXY _IP>;tag=4554424c
> Call-ID: YjRmZjU3ODAwMjIxMDU0MDUwNDllYzUwNmZiYTJjMmE.
> CSeq: 2 INVITE
> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE,
> SUBSCRIBE, INFO
> Content-Type: application/sdp
> Proxy-Authorization: Digest
> username="1000",realm="PROXY_IP",nonce="47593c9fa32034a66fdb7493ff499c7215d4d8db",uri="sip:franco.callegati at PROXY_IP",response="82d21af18029aa02388869088c3619d2",algorithm=MD5
> User-Agent: X-Lite release 1011s stamp 41150
> Content-Length: 374
> Message body
> Session Description Protocol
> Session Description Protocol Version (v): 0
> Owner/Creator, Session Id (o): - 8 2 IN IP4 192.168.10.224
> Session Name (s): CounterPath X-Lite 3.0
> Connection Information (c): IN IP4 192.168.10.224
> Time Description, active time (t): 0 0
> Media Description, name and address (m): audio 53624 RTP/AVP 107
> 119 100 106 0 105 98 8 101
> Media Attribute (a): fmtp:101 0-15
> Media Attribute (a): rtpmap:107 BV32/16000
> Media Attribute (a): rtpmap:119 BV32-FEC/16000
> Media Attribute (a): rtpmap:100 SPEEX/16000
> Media Attribute (a): rtpmap:106 SPEEX-FEC/16000
> Media Attribute (a): rtpmap:105 SPEEX-FEC/8000
> Media Attribute (a): rtpmap:98 iLBC/8000
> Media Attribute (a): rtpmap:101 telephone-event/8000
> Media Attribute (a): sendrecv
>
> # PROXY -----> 192.162.10.224
>
> Status-Line: SIP/2.0 100 Trying
> Message Header
> Via: SIP/2.0/UDP
> 192.168.10.224:64244;branch=z9hG4bK-d87543-9947ff15e2520b54-1--d87543-;rport=28943;received=
> 85.18.14.25
> To: "franco.callegati"<sip:franco.callegati at PROXY_IP>
> From: "casa"<sip:daniel.grotti at PROXY_IP>;tag=4554424c
> Call-ID: YjRmZjU3ODAwMjIxMDU0MDUwNDllYzUwNmZiYTJjMmE.
> CSeq: 2 INVITE
> Server: OpenSER (1.3.0-pre1-notls (i386/linux))
> Content-Length: 0
>
> # PROXY -----> 192.162.10.224
>
> Status-Line: SIP/2.0 180 Ringing
> Message Header
> Via: SIP/2.0/UDP
> 192.168.10.224:64244;received=85.18.14.25;branch=z9hG4bK-d87543-9947ff15e2520b54-1--d87543-;rport=28943
> Record-Route: <sip:PROXY_IP:5060;lr;nat=yes;ftag=4554424c>
> Contact:
> <sip:franco.callegati at 85.18.14.25:42214;rinstance=96888d44783df4a0>
> To: "franco.callegati"<sip: franco.callegati at PROXY_IP>;tag=d06d8b2d
> From: "casa"<sip:daniel.grotti at PROXY_IP>;tag=4554424c
> Call-ID: YjRmZjU3ODAwMjIxMDU0MDUwNDllYzUwNmZiYTJjMmE.
> CSeq: 2 INVITE
> User-Agent: X-Lite release 1011s stamp 41150
> Content-Length: 0
>
>
> # PROXY -----> 192.162.10.224
>
> Status-Line: SIP/2.0 200 OK
> Message Header
> Via: SIP/2.0/UDP
> 192.168.10.224:64244;received=85.18.14.25;branch=z9hG4bK-d87543-9947ff15e2520b54-1--d87543-;rport=28943
> Record-Route: <sip:PROXY_IP:5060;lr;nat=yes;ftag=4554424c>
> Contact:
> <sip:franco.callegati at 85.18.14.25:42214;rinstance=96888d44783df4a0>
> To: "franco.callegati"<sip:franco.callegati at PROXY_IP>;tag=d06d8b2d
> From: "casa"<sip: daniel.grotti at PROXY_IP>;tag=4554424c
> Call-ID: YjRmZjU3ODAwMjIxMDU0MDUwNDllYzUwNmZiYTJjMmE.
> CSeq: 2 INVITE
> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE,
> SUBSCRIBE, INFO
> Content-Type: application/sdp
> User-Agent: X-Lite release 1011s stamp 41150
> Content-Length: 372
> Message body
> Session Description Protocol
> Session Description Protocol Version (v): 0
> Owner/Creator, Session Id (o): - 7 2 IN IP4 192.168.0.167
> Session Name (s): CounterPath X-Lite 3.0
> Connection Information (c): IN IP4 192.168.0.167
> Time Description, active time (t): 0 0
> Media Description, name and address (m): audio 45566 RTP/AVP 107
> 119 100 106 0 105 98 8 101
> Media Attribute (a): fmtp:101 0-15
> Media Attribute (a): rtpmap:107 BV32/16000
> Media Attribute (a): rtpmap:119 BV32-FEC/16000
> Media Attribute (a): rtpmap:100 SPEEX/16000
> Media Attribute (a): rtpmap:106 SPEEX-FEC/16000
> Media Attribute (a): rtpmap:105 SPEEX-FEC/8000
> Media Attribute (a): rtpmap:98 iLBC/8000
> Media Attribute (a): rtpmap:101 telephone-event/8000
> Media Attribute (a): sendrecv
>
> 192.162.10.224 ----> PROXY
>
> Request-Line: ACK
> sip:franco.callegati at 85.18.14.25:42214;rinstance=96888d44783df4a0 SIP/2.0
> Message Header
> Via: SIP/2.0/UDP
> 192.168.10.224:64244;branch=z9hG4bK-d87543-66641951d8357408-1--d87543-
> Max-Forwards: 70
> Route: <sip:PROXY_IP:5060;lr;nat=yes;ftag=4554424c>
> Contact: <sip:daniel.grotti at 192.168.10.224:64244>
> To: "franco.callegati"<sip:franco.callegati at PROXY_IP>;tag=d06d8b2d
> From: "casa"<sip:daniel.grotti at PROXY _IP>;tag=4554424c
> Call-ID: YjRmZjU3ODAwMjIxMDU0MDUwNDllYzUwNmZiYTJjMmE.
> CSeq: 2 ACK
> Proxy-Authorization: Digest
> username="1000",realm="PROXY_IP",nonce="47593c9fa32034a66fdb7493ff499c7215d4d8db",uri="sip:
> franco.callegati at PROXY_IP",response="82d21af18029aa02388869088c3619d2",algorithm=MD5
> User-Agent: X-Lite release 1011s stamp 41150
> Content-Length: 0
>
>
> RTP STREAM BETWEEN CLIENTS (MEDIAPROXY DOESN'T WORK)
>
> CALL ENDED
>
> ----------------------------------------------------------------------------------------------------------------------
>
> this is my config file:
>
> debug=3
> fork=yes
> log_stderror=yes
>
> listen=PROXY_IP
> port=5060
> children=4
>
> dns=no
> rev_dns=no
> disable_dns_blacklist=yes
>
> mpath="/usr/SER_proxy//lib/openser/modules/"
>
> #------------------------------------------------------
> # Load Module
> #------------------------------------------------------
>
> loadmodule "mysql.so"
> loadmodule "auth.so"
> loadmodule "auth_db.so"
> loadmodule "sl.so"
> loadmodule "tm.so"
> loadmodule "rr.so"
> loadmodule "maxfwd.so"
> loadmodule "usrloc.so"
> loadmodule "registrar.so"
> loadmodule "mi_fifo.so"
> loadmodule "uri.so"
> loadmodule "uri_db.so"
> loadmodule "domain.so"
> loadmodule "mediaproxy.so"
> loadmodule "nathelper.so"
> loadmodule "textops.so"
> loadmodule "xlog.so"
> loadmodule "cpl-c.so"
> loadmodule "alias_db.so"
>
>
> #----------------------------------------------------------
> # Parameters
> #----------------------------------------------------------
>
> modparam("auth_db|uri_db|usrloc|domain|alias_db", "db_url",
> "mysql://topenser:openserrw@localhost/topenser")
>
> modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
>
> modparam("auth_db", "calculate_ha1", yes)
> modparam("auth_db", "password_column", "password")
>
> modparam("usrloc", "db_mode", 2)
> modparam("usrloc", "nat_bflag", 6)
>
> modparam("rr", "enable_full_lr", 1)
>
> modparam("alias_db", "use_domain", 1)
>
> # REGISTRAR MODULE
> modparam("registrar", "max_contacts", 2) # max number of contacts
> per URI
> modparam("registrar", "append_branches", 0) # if 0: R-URI will be
> overwritten with the highest-q rated contact and the rest will be left
> unprocessed.
> modparam("registrar", "default_q", 1000) # default contacts
> q-value set as 1
> modparam("registrar", "received_avp","$avp(i:42)")
>
> # URI_DB MODULE
> modparam("uri_db", "use_uri_table", 1) # Specify if the "uri"
> table should be used for checkings instead of "subscriber" table
>
>
> # CPL MODULE
> modparam("cpl-c", "db_url", "mysql://topenser:openserrw@localhost/topenser")
> modparam("cpl-c", "cpl_table", "cpl")
> modparam("cpl-c", "cpl_dtd_file", "/usr/src/openser-
> 1.2.2-notls/modules/cpl-c/cpl-06.dtd")
> modparam("cpl-c", "lookup_domain", "location")
> modparam("cpl-c","lookup_append_branches",1)
> modparam("cpl-c","proxy_route", 10)
>
> #NATHELPER MODULE
> modparam("nathelper", "rtpproxy_disable_tout", 120)
> modparam("nathelper", "rtpproxy_tout", 2)
> modparam("nathelper", "natping_interval", 30)
> modparam("nathelper", "ping_nated_only", 1)
> modparam("nathelper", "received_avp", "$avp(i:42)")
> modparam("nathelper", "sipping_method", "OPTIONS") # Use OPTIONS every
> 10sec to keep NAT alive
> modparam("nathelper", "sipping_bflag", 6)
> modparam("nathelper", "sipping_from", "sip:PROXY_IP")
>
> #MEDIAPROXY MODULE
> modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy.sock")
> modparam("mediaproxy", "sip_asymmetrics",
> "/usr/local/etc/openser/sip-asymmetric-clients")
> modparam("mediaproxy", "rtp_asymmetrics",
> "/usr/local/etc/openser/rtp-asymmetric-clients")
>
> # TM MODULE
> modparam("tm", "fr_inv_timer", 120)
>
>
> #------------------------------------------------------------
> #MAIN ROUTE
> #-----------------------------------------------------------
>
> route {
> xlog("L_DBG", "INFO: NEW REQUEST - METHOD=$rm R-URI=$ru FROM=$fu TO=$tu
> IP=$si ID=$ci\n");
> #------------------------------------
> # Sanity checks
> #------------------------------------
> if (!mf_process_maxfwd_header("10"))
> { sl_send_reply("483", "Too much Hops");
> exit;
> };
>
> if (msg:len >= 2048)
> { sl_send_reply("513", "Message too big");
> exit;
> };
> #------------------------------------
> # RECORD-ROUTE
> #------------------------------------
>
> if(method=="INVITE" && client_nat_test("7"))
> {
> record_route_preset ("PROXY_IP:5060;nat=yes");
> xlog("L_DBG", "INFO: RECORD-ROUTE WITH NAT");
> }
> else if (method!="REGISTER")
> {
> record_route();
> };
>
> #----------------------------------------
> # CALL TEAR DOWN
> #----------------------------------------
> if (method=="BYE")
> {
> end_media_session();
> };
> if (method=="CANCEL")
> {
> end_media_session();
> };
>
> #--------------------------------------------
> # LOOSE ROUTE
> #--------------------------------------------
> if (loose_route())
> {
> xlog("L_DBG", "INFO: LOOSE ROUTE");
> if (method=="INVITE")
> {
> if (!proxy_authorize("","subscriber"))
> { proxy_challenge("","0");
> exit;
> }
> else if (!check_from())
> { sl_send_reply("403","Unauthorized");
> exit;
> };
> consume_credentials();
>
> if (client_nat_test("7") || search("^Route:.*nat=yes"))
> { setbflag(7);
> use_media_proxy();
> };
> };
>
> route(1);
> exit;
> };
> #-------------------------------------------------
> #CALL TYPE PROCESSING
> #-------------------------------------------------
> if (!uri==myself)
> { route(1);
> exit;
> };
>
> if (uri==myself)
> {
> if (method=="REGISTER")
> { xlog("L_DBG", "INFO: REGISTER Message received");
> route(2);
> exit;
> };
> if (method=="ACK")
> { route(1);
> exit;
> };
> if (method=="INVITE")
> {
> xlog("L_DBG", "INFO: INVITE Message received");
> route(3);
> exit;
> };
> if (method=="MESSAGE")
> {
> xlog("L_DBG", "INFO: MESSAGE method received");
> route(4);
> exit;
> };
>
>
> lookup("aliases");
> if (!uri==myself)
> { route(1);
> exit;
> };
>
> if (!lookup("location"))
> { sl_send_reply("404", "Destination not found");
> exit;
> };
>
> };
>
> route(1);
> }
>
> #--------------------------------------------------------
> # REGISTER PROCESSING
> #--------------------------------------------------------
> route[2]
> {
> # Check credentials
>
> if(!www_authorize("","subscriber"))
> { www_challenge("","0");
> exit;
> }
> else if(!check_to())
> { sl_send_reply("401", "Unauthorized");
> exit;
> };
>
> consume_credentials();
>
> # Check client natted - if yes, set flag 6
> if (!search("^Contact:[ ]*\*") && client_nat_test("7"))
> {
> setbflag(6);
> xlog("L_DBG","INFO: Registration behind NAT");
> xlog("L_DBG","INFO: Bflag 6, related to BRANCH=$T_branch_idx, is
> setted as $bf");
> fix_nated_register();
> force_rport();
> };
>
> if(!save("location"))
> { sl_reply_error();
> xlog("L_DBG", "Registration of [$fU] Failed");
> };
>
> xlog("L_DBG", "INFO: Registration of [$fU] Complete.");
> xlog("L_DBG", "INFO: 200 OK has been sended");
> }
>
> #----------------------------------------------------------
> # INVITE PROCESSING
> #----------------------------------------------------------
> route[3]
> {
> sl_send_reply("100", "Trying");
> # Check if caller is natted, if yes set flag 7, rewrite Contact HF with
> Proxy address
> if(client_nat_test("7"))
> {
> setbflag(7);
> xlog("L_DBG", "INFO: CLIENT INVITE BEHIND NAT");
> xlog("L_DBG","NOTICE: Bflag 7, related to BRANCH=$T_branch_idx of
> this INVITE, is setted as $bf");
> if(force_rport())
> {
> xlog("L_DBG","INFO: rport FORCED");
> };
> if(fix_nated_contact())
> {
> xlog("L_DBG","INFO: Contact HF is now [$ct]");
> };
> # append_hf("P-hint: INVITE behind NAT \n");
> };
> # Check Credentials
>
> if(!proxy_authorize("","subscriber"))
> { proxy_challenge("","0");
> exit;
> }
>
> else if (!check_from())
> { sl_send_reply("403", "Unauthorized");
> exit;
> };
>
> lookup("aliases");
> if(uri!=myself)
> { route(1);
> exit;
> };
>
> consume_credentials();
>
> # Check if r-URI is an alias. If yes, rewrite RURI with User's URI
> if(!alias_db_lookup("dbaliases"))
> {
> xlog("L_DBG", "The [$ru] is not an alias");
> };
>
> # Use Caller CPL "Outgoing" Script, if exist
>
> if(!cpl_run_script("outgoing", "force_stateful"))
> {
> sl_send_reply("500","Outgoing CPL script execution
> failed");
> exit;
> };
> # Find destination user and re-write R-URI with its Contact
>
> if (!lookup("location"))
> { sl_send_reply("404", "Destination not found");
> exit;
> };
>
> xlog("L_DBG", "INFO: LOCATION HAS BEEN FOUND");
> xlog("L_DBG","INFO: R-URI is now [$ru]");
>
> t_on_reply("1");
>
> # Use CPL "Incoming" script of the destination client
> if(!cpl_run_script("incoming","force_stateful"))
> {
> sl_send_reply("500", "Incoming CPL script execution
> failed");
> exit;
> };
> route(11);
> route(1);
> }
>
>
> # --------------------------------
> # PROXY ROUTE - CPL SCRIPT LOADED
> # --------------------------------
> route[10]
> {
> xlog("L_DBG", "INFO: ROUTE 10 - PROXY ROUTE \n");
> # append_hf("P-hint: CPL ROUTE 10 - PROXY-ROUTE\n");
> if (isbflagset(6) || isbflagset(7))
> {
> xlog("L_DBG", "INFO: flag 6 or 7 setted \n");
> if(!isbflagset(8))
> {
> setbflag(8);
> };
> if(use_media_proxy())
> {
> xlog("L_DBG","NOTICE: MEDIAPROXY in use for the CALLER!!");
> # append_hf("P-hint: Mediaproxy in USE for the Caller\n");
> };
> };
> }
> # -----------------------------
> # CONTROL FLAG - NO CPL SCRIPT
> # -----------------------------
> route[11]
> {
> xlog("L_DBG", "INFO: ROUTE 11 - NO CPL SCRIPT");
> # append_hf("P-hint: ROUTE 11 \n");
> if(isbflagset(6) || isbflagset(7))
> {
> xlog("L_DBG", "INFO: flag 6 or 7 setted");
> if(!isbflagset(8))
> {
> setbflag(8);
> };
> if(use_media_proxy())
> {
> xlog("L_DBG","NOTICE: mediaproxy in use for
> the caller!!");
> # append_hf("P-hint: MEDIAPROXY in USE for the
> CALLER\n");
> };
> };
> }
>
> # --------------------------------------------------
> # MESSAGE PROCESSING
> # --------------------------------------------------
> route[4]
> {
> if (uri!=myself)
> { sl_send_reply ("403", "Forbidden");
> exit;
> };
> if (!lookup("location"))
> { sl_send_reply("404", "Destination not found");
> exit;
> };
> route(1);
> }
>
> #----------------------------------------------------
> # RELEY ROUTE
> #----------------------------------------------------
> route[1]
> {
> if (!t_relay("0x01")) # don't send 100 trying
> {
> if (method=="INVITE" || method=="ACK")
> {
> end_media_session();
> xlog("L_DBG","INFO: MEDIA SESSION ENDED");
> };
>
> sl_reply_error();
> xlog("L_DBG", "INFO: SENT ERROR REPLY");
> };
> }
>
> #---------------------------------------------------------------------
> # On Reply Route
> #---------------------------------------------------------------------
>
> onreply_route[1]
> {
> xlog("L_DBG","INFO : ONREPLY ROUTE");
> # append_hf("P-hint: ONREPLY ROUTE \n");
> if (status=~"(180)|(183)|2[0-9][0-9]")
> {
> if (isbflagset(8) && !search("^Content-Lenght:[ ]*0"))
> {
>
> if(use_media_proxy())
> {
> xlog("L_DBG","INFO: MEDIAPROXY in use for the
> CALLED!");
> # append_hf("P-hint: Media Proxy in use for the
> Callee!\n");
> };
> };
> };
> if (client_nat_test("7") && status=~"(180)|(183)|(200)")
> {
> fix_nated_contact();
>
> xlog("L_DBG","INFO: CONTACT HF has been CHANGED");
> # append_hf("P-hint: CALLEE'S CONTACT HF has benn CHANGED\n");
>
> };
> }
>
> ----------------------------------------------------------------------------------------------------------------------
>
>
>
>
> Regards,
> Daniel
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Hi Daniel,
>
> Can u post your openser configuration as well as a complete ngrep
> trace for the calls you have problems with?
>
> DanB
>
>
>
> --
> Daniel Grotti
> ________________________
> e-mail : d.grotti at gmail.com
> _______________________________________________
> Users mailing list
> Users at lists.openser.org
> http://lists.openser.org/cgi-bin/mailman/listinfo/users
>
>
More information about the sr-users
mailing list