[Freeswitch-users] freeswitch as SBC and kamailio - no route

rod kawarod at laposte.net
Fri Aug 28 22:43:24 PDT 2009


Ok,

I found what's happening. I probably did some change on the wiki to 
start reflect the new configuration, without having time enough to check 
the configuration. There is a mistake in your dialplan configuration. 
You should put this instead:

wrong line:

<action application="set" data="ROUTE_GW=${sip_redirect_contact_user_0}"/>

please correct with:
<action application="set" data="ROUTE_GW=${sip_redirect_contact_host_0}"/>


This should match PEER_01 in dialplan instead of trying matching 
France at PEER_01.

Let me know if this is right now.

rod

Hristo Benev a écrit :
>  Hello Rod,
>
> I did the change.
>
> Here is extract of console:
> -----------------------------------------------------------------------------------------
> variable_continue_on_fail: [true]
> variable_sip_h_X-ROUTE: [LOOKUP]
> variable_export_vars: [sip_h_X-ROUTE]
> variable_signal_bond: [a66d089a-93ee-11de-ab7a-094dff0ede20]
> variable_sip_redirect_contact_0: [sip:France at PEER_01]
> variable_sip_redirected_to: [sip:France at PEER_01]
> variable_sip_redirect_contact_user_0: [France] <-------------------------------------------
> variable_sip_redirect_contact_host_0: [PEER_01]
> variable_sip_redirect_dialstring_0: [sofia/internal/sip:France at PEER_01]
> variable_sip_redirect_dialstring: [sofia/internal/sip:France at PEER_01]
> variable_proto_specific_hangup_cause: [sip:503]
> variable_sip_hangup_phrase: [DNS Error]
> variable_originate_disposition: [NORMAL_TEMPORARY_FAILURE]
> variable_ROUTE_GW: [France]
> variable_AREA: [France]
> variable_current_application: [info]
> ------------------------------------------------------------------------------------------
> I have different value it is actually the description field as shown here:
>
> --------------------------------
>  /opt/kamailio/sbin/kamctl cr show
> cr carrier names
> +----+---------+
> | id | carrier |
> +----+---------+
> |  1 | default |
> +----+---------+
> cr domain names
> +----+---------+
> | id | domain  |
> +----+---------+
> |  1 | default |
> +----+---------+
> cr routes
> +----+---------+--------+-------------+-------+------+------+-------+--------------+----------------+----------------+-------------+
> | id | carrier | domain | scan_prefix | flags | mask | prob | strip | rewrite_host | rewrite_prefix | rewrite_suffix | description |
> +----+---------+--------+-------------+-------+------+------+-------+--------------+----------------+----------------+-------------+
> |  1 |       1 |      1 | 1000        |     0 |    0 |    1 |     0 | PEER_01      |                |                | France      |
> +----+---------+--------+-------------+-------+------+------+-------+--------------+----------------+----------------+-------------+
> -----------------------------------------
>
> And here is what I have in kamailio:
> -------------------------------------------------------------------------------------
> ####### Routing Logic ########
>
>
> # main request routing logic
>
> route{
>
>         if (!mf_process_maxfwd_header("10")) {
>                 sl_send_reply("483","Too Many Hops");
>                 exit;
>         }
>
>         t_check_trans();
>
>         if ($rU==NULL) {
>                 # request with no Username in RURI
>                 sl_send_reply("484","Address Incomplete");
>                 exit;
>         }
>
>         # LOOKUP ROUTE TABLE WHEN ASKED BY HEADER: X-ROUTE:LOOKUP
>         if (is_method("INVITE") && $hdr(X-ROUTE)=="LOOKUP"){
>                 if(!cr_route("default", "default", "$rU", "$rU", "call_id","$avp(s:route_desc)")){
>                      #xlog("ROUTING FAILED: no route found for $rU");
>                      sl_send_reply("604", "Unable to route this call");
>                      exit;
>                 } else {
>                      xlog("LOOKUP FOUND: $rd $avp(s:route_desc)");
>                      avp_pushto("$ru/username", "$avp(s:route_desc)");
>                      sl_send_reply("302", "$rd");
>                      exit;
>                 }
>         }
> }
> ----------------------------------------------------------------------------------
>
> Another question...
> In that part of FreeSwitch dialplan.xml
>
> -----------------------------------
>   <context name="ROUTING">
>
>     <extension name="PEER_01">
>       <condition field="${sip_h_X-ROUTE}" expression="PEER_01">
>         <action application="set" data="hangup_after_bridge=true"/>
>
> -----------------------------------
>
> X-ROUTE maybe should be replaced with ROUTE_GW otherwise there is no way the regex is true.
>
>
> As for thanks - for sure by default they are also for the developers of both apps.
> I'm new in freeSwitch and/or Kamailio for now I'm still testing and learning so it will be nice to have something working to start with.
>
>
>
>  >-------- Оригинално писмо --------
>  >От:  rod 
>  >Относно: Re: [Freeswitch-users] freeswitch as SBC and kamailio - no route
>  >До: freeswitch-users at lists.freeswitch.org
>  >Изпратено на: Петък, 2009, Август 28 09:54:00 EEST
>
>  >Hello,
>  >
>  >the trace seems good.
>  >If you check the answer from Kamailio, you'll see that Kamailio answers 
>  >with "302 PEER_01".
>  >
>  >As Michael Collins stated before, you can get the variable containing 
>  >"PEER_01", then this variable is stored in a custom variable.
>  >
>  >In your dialplan, may you please add:
>  >
>  >, just before the transfer line, eg:
>  >
>  > 
>  >         
>  >         
>  >         
>  >         
>  >         
>  >         
>  >	 
>  >         
>  >      
>  >
>  >
>  >Using application Info, you'll see on the console (or CDR) the list of 
>  >variables used for this call.  You should see the content of 
>  >"${sip_redirect_contact_user_0}" that should contain  the value 
>  >"PEER_01". Please check this and let me know.
>  >
>  >For the new configuration file, no problem for sharing. But as I wrote 
>  >on the wiki page, I worked on this setup cause LCR module was not 
>  >available when I start working on FS, nor I'm a good programmer to write 
>  >a server side HTTP script (used by xml_curl) that could scale to my needs.
>  >
>  >I enhanced a bit this configuration with support for fallback routing, 
>  >almost realtime graph (every minutes using www.cacti.net and some 
>  >functions in FS like limit_hash) of number of concurrent calls per AREA, 
>  >PEER...
>  >
>  >Thanks for "the good tutorial", but don't forget the dev team who did 
>  >this great product ;-)
>  >
>  >rod.
>  >
>  >
>  >Hristo Benev a écrit :
>  >>  I assume you asked for port 5062 since I do not have any traffic on 5060 (I have one IP and my internal sip port is 5090 and external 5080).
>  >>
>  >> If you need additional info I'll provide it.
>  >>
>  >> Here is trace:
>  >>
>  >> ngrep -d any -nn -i '1000' port 5062 -W byline
>  >> interface: any
>  >> filter: (ip or ip6) and ( port 5062 )
>  >> match: 1000
>  >> #
>  >> U 10.10.10.10:5090 -> 127.0.0.1:5062
>  >> INVITE sip:1000 at 127.0.0.1:5062 SIP/2.0.
>  >> Via: SIP/2.0/UDP 10.10.10.10:5090;rport;branch=z9hG4bKtrDyU1US5X5tj.
>  >> Max-Forwards: 69.
>  >> From: "Extension 1001" ;tag=978g69jZaFpBD.
>  >> To: .
>  >> Call-ID: 7f0eff2d-0dbf-122d-bfb0-612c8433bc7c.
>  >> CSeq: 119574771 INVITE.
>  >> Contact: .
>  >> User-Agent: FreeSWITCH-mod_sofia/1.0.4-exported.
>  >> Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY, REFER, UPDATE, REGISTER, INFO, PUBLISH.
>  >> Supported: timer, precondition, path, replaces.
>  >> Allow-Events: talk, presence, dialog, call-info, sla, include-session-description, presence.winfo, message-summary, refer.
>  >> Content-Type: application/sdp.
>  >> Content-Disposition: session.
>  >> Content-Length: 429.
>  >> X-ROUTE: LOOKUP.
>  >> Remote-Party-ID: "Extension 1001" ;party=calling;screen=yes;privacy=off.
>  >> .
>  >> v=0.
>  >> o=FreeSWITCH 1251355692 1251355693 IN IP4 10.10.10.10.
>  >> s=FreeSWITCH.
>  >> c=IN IP4 10.10.10.10.
>  >> t=0 0.
>  >> m=audio 30522 RTP/AVP 0 115 107 9 8 3 101 13.
>  >> a=rtpmap:0 PCMU/8000.
>  >> a=rtpmap:115 G7221/32000.
>  >> a=fmtp:115 bitrate=48000.
>  >> a=rtpmap:107 G7221/16000.
>  >> a=fmtp:107 bitrate=32000.
>  >> a=rtpmap:9 G722/8000.
>  >> a=rtpmap:8 PCMA/8000.
>  >> a=rtpmap:3 GSM/8000.
>  >> a=rtpmap:101 telephone-event/8000.
>  >> a=fmtp:101 0-16.
>  >> a=rtpmap:13 CN/8000.
>  >> a=ptime:20.
>  >>
>  >> #
>  >> U 127.0.0.1:5062 -> 10.10.10.10:5090
>  >> SIP/2.0 302 PEER_01.
>  >> Via: SIP/2.0/UDP 10.10.10.10:5090;rport=5090;branch=z9hG4bKtrDyU1US5X5tj.
>  >> From: "Extension 1001" ;tag=978g69jZaFpBD.
>  >> To: ;tag=458fb4012080e656b6742c09466dabcd.31c8.
>  >> Call-ID: 7f0eff2d-0dbf-122d-bfb0-612c8433bc7c.
>  >> CSeq: 119574771 INVITE.
>  >> Contact: sip:France at PEER_01.
>  >> Server: Kamailio (1.5.2-notls (i386/linux)).
>  >> Content-Length: 0.
>  >> .
>  >>
>  >> #
>  >> U 10.10.10.10:5090 -> 127.0.0.1:5062
>  >> ACK sip:1000 at 127.0.0.1:5062 SIP/2.0.
>  >> Via: SIP/2.0/UDP 10.10.10.10:5090;rport;branch=z9hG4bKtrDyU1US5X5tj.
>  >> Max-Forwards: 69.
>  >> From: "Extension 1001" ;tag=978g69jZaFpBD.
>  >> To: ;tag=458fb4012080e656b6742c09466dabcd.31c8.
>  >> Call-ID: 7f0eff2d-0dbf-122d-bfb0-612c8433bc7c.
>  >> CSeq: 119574771 ACK.
>  >> Content-Length: 0.
>  >> .
>  >>
>  >>
>  >>
>  >>
>  >>
>  >>  >-------- Оригинално писмо --------
>  >>  >От:  Hristo Benev 
>  >>  >Относно: Re: [Freeswitch-users] freeswitch as SBC and kamailio - no route
>  >>  >До: freeswitch-users at lists.freeswitch.org
>  >>  >Изпратено на: Четвъртък, 2009, Август 27 14:58:53 EEST
>  >>
>  >>  > 
>  >>  >Bojnour,
>  >>  >
>  >>  >I'll send a trace ASAP.
>  >>  >
>  >>  >What I see is that SIP header does not get updated -> regex is not true then it does not go to the peer. (I assume that is coming from kamailio config)
>  >>  >
>  >>  >I'm really interested to see the updates of the project.
>  >>  >
>  >>  >Thank you for the good tutorial.
>  >>  >
>  >>  >Hristo
>  >>  >
>  >>  >
>  >>  > >-------- Оригинално писмо --------
>  >>  > >От:  rod 
>  >>  > >Относно: Re: [Freeswitch-users] freeswitch as SBC and kamailio - no route
>  >>  > >До: freeswitch-users at lists.freeswitch.org
>  >>  > >Изпратено на: Четвъртък, 2009, Август 27 09:41:05 EEST
>  >>  >
>  >>  > >Hi Hristo,
>  >>  > >
>  >>  > >I'm the author of this setup and wiki page. I did a lot of modifications 
>  >>  > >on this setup (alternative routing if failure essentially) but don't 
>  >>  > >have too much time to update the wiki.
>  >>  > >
>  >>  > >May you please send me an ngrep trace when you call 1000:
>  >>  > >
>  >>  > >ngrep -d any -nn -i '1000' port 5060 -W byline 
>  >>  > >
>  >>  > >I will check what's happening.
>  >>  > >Do you have an entry for 1000 in your mysql database ?
>  >>  > >
>  >>  > >regards,
>  >>  > >rod
>  >>  > >
>  >>  > >Hristo Benev a écrit :
>  >>  > >>  
>  >>  > >> It seems that the problem is on kamailio configuration.
>  >>  > >> Will ask on their list.
>  >>  > >>
>  >>  > >> But to test i try to connect to my asterisk server and i receive 407 proxy authentication required.
>  >>  > >>
>  >>  > >> I have it setup as friend in asterisk, but still ???
>  >>  > >>
>  >>  > >> Any ideas?
>  >>  > >>
>  >>  > >> Thanks,
>  >>  > >>
>  >>  > >>
>  >>  > >>  >-------- Оригинално писмо --------
>  >>  > >>  >От:  Hristo Benev 
>  >>  > >>  >Относно: Re: [Freeswitch-users] freeswitch as SBC and kamailio - no route
>  >>  > >>  >До: freeswitch-users at lists.freeswitch.org
>  >>  > >>  >Изпратено на: Сряда, 2009, Август 26 22:02:13 EEST
>  >>  > >>
>  >>  > >>  > I think that the problem is here:
>  >>  > >>  >-------------------------
>  >>  > >>  >2009-08-26 22:56:52.725878 [INFO] mod_dialplan_xml.c:315 Processing 1001->1000 in context ROUTING
>  >>  > >>  >Dialplan: sofia/internal/1001 at 209.71.254.33 parsing [ROUTING->PEER_01] continue=false
>  >>  > >>  >Dialplan: sofia/internal/1001 at 209.71.254.33 Regex (FAIL) [PEER_01] ${sip_h_X-ROUTE}(LOOKUP) =~ /PEER_01/ break=on-false
>  >>  > >>  >2009-08-26 22:56:52.728289 [INFO] switch_core_state_machine.c:136 No Route, Aborting
>  >>  > >>  >--------------------------
>  >>  > >>  >
>  >>  > >>  >Actually Regex FAIL
>  >>  > >>  >
>  >>  > >>  >I'm not familiar, but is this stating that ${sip_h_X-ROUTE} should be PEER_01 for success?
>  >>  > >>  >Here is my  default.xml:
>  >>  > >>  >----------------
>  >>  > >>  >
>  >>  > >>  >
>  >>  > >>  >
>  >>  > >>  >  
>  >>  > >>  >
>  >>  > >>  >     
>  >>  > >>  >      
>  >>  > >>  >         
>  >>  > >>  >         
>  >>  > >>  >         
>  >>  > >>  >         
>  >>  > >>  >         
>  >>  > >>  >         
>  >>  > >>  >         
>  >>  > >>  >      
>  >>  > >>  >    
>  >>  > >>  >
>  >>  > >>  >   
>  >>  > >>  >
>  >>  > >>  >  
>  >>  > >>  >
>  >>  > >>  >    
>  >>  > >>  >      
>  >>  > >>  >        
>  >>  > >>  >        
>  >>  > >>  >        
>  >>  > >>  >        
>  >>  > >>  >        
>  >>  > >>  >        
>  >>  > >>  >        
>  >>  > >>  >        
>  >>  > >>  >      
>  >>  > >>  >    
>  >>  > >>  >
>  >>  > >>  >  
>  >>  > >>  >
>  >>  > >>  >
>  >>  > >>  >
>  >>  > >>  >--------------------------
>  >>  > >>  >
>  >>  > >>  >
>  >>  > >>  >
>  >>  > >>  > >-------- Оригинално писмо --------
>  >>  > >>  > >От:  Brian West 
>  >>  > >>  > >Относно: Re: [Freeswitch-users] freeswitch as SBC and kamailio - no route
>  >>  > >>  > >До: freeswitch-users at lists.freeswitch.org
>  >>  > >>  > >Изпратено на: Сряда, 2009, Август 26 19:47:37 EEST
>  >>  > >>  >
>  >>  > >>  > >We do not blindly follow 302's as that is a dangerous thing to do. 
>  >>  > >>  >You have to process all 302's in the dialplan. 
>  >>  > >>  >Set this on your sofia profile
>  >>  > >>  >You can set these variables sip_redirect_profile,
>  >>  > >>  >sip_redirect_context,
>  >>  > >>  >sip_redirect_dialplan,
>  >>  > >>  >When a redirect happens you get these variables - sip_redirect_contact_%d,
>  >>  > >>  >sip_redirected_to,
>  >>  > >>  >sip_redirect_contact_user_%d,
>  >>  > >>  >sip_redirect_contact_host_%d,
>  >>  > >>  >sip_redirect_contact_params_%d,
>  >>  > >>  >sip_redirect_dialstring_%d,
>  >>  > >>  >sip_redirect_dialstring,
>  >>  > >>  >sip_redirected_byThen its up to you to process the redirect in your dialplan, If you don't set the
>  >>  > >>  >sip_redirect_context then it'll default to redirected context and XML as the dialplan./bOn Aug 26, 2009, at 11:37 AM, Hristo Benev wrote:HelloI followed the tutorialhttp://wiki.freeswitch.org/wiki/SBC_SetupI have following problem when I dial 1000 Kamalio reports 302, but freeswitch does not routeWhere to look for problems?
>  >>  > >>  > >
>  >>  > >>  >
>  >>  > >>  >_______________________________________________
>  >>  > >>  >FreeSWITCH-users mailing list
>  >>  > >>  >FreeSWITCH-users at lists.freeswitch.org
>  >>  > >>  >http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>  >>  > >>  >UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>  >>  > >>  >http://www.freeswitch.org
>  >>  > >>  >
>  >>  > >>
>  >>  > >> _______________________________________________
>  >>  > >> FreeSWITCH-users mailing list
>  >>  > >> FreeSWITCH-users at lists.freeswitch.org
>  >>  > >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>  >>  > >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>  >>  > >> http://www.freeswitch.org
>  >>  > >>   
>  >>  > >
>  >>  > >_______________________________________________
>  >>  > >FreeSWITCH-users mailing list
>  >>  > >FreeSWITCH-users at lists.freeswitch.org
>  >>  > >http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>  >>  > >UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>  >>  > >http://www.freeswitch.org
>  >>  > >
>  >>  >
>  >>  >_______________________________________________
>  >>  >FreeSWITCH-users mailing list
>  >>  >FreeSWITCH-users at lists.freeswitch.org
>  >>  >http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>  >>  >UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>  >>  >http://www.freeswitch.org
>  >>  >
>  >>
>  >> _______________________________________________
>  >> FreeSWITCH-users mailing list
>  >> FreeSWITCH-users at lists.freeswitch.org
>  >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>  >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>  >> http://www.freeswitch.org
>  >>   
>  >
>  >_______________________________________________
>  >FreeSWITCH-users mailing list
>  >FreeSWITCH-users at lists.freeswitch.org
>  >http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>  >UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>  >http://www.freeswitch.org
>  >
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>   




More information about the FreeSWITCH-users mailing list