[SR-Users] Relaying ACK to Asterisk

Daniel-Constantin Mierla miconda at gmail.com
Wed Oct 1 14:27:10 CEST 2014


One option is to map usernames to domains using mtree or hashtable, then 
when a request comes in with IP, rewrite domain ($rd) -- something like:

if(uri==myself && is_ip("$rd")) ) {
     $rd = ...
}

Cheers,
Daniel

On 01/10/14 14:12, Igor Potjevlesch wrote:
> Hello,
>
> Multi-domain is used for backward compatibility with some customers.
> Also, some equipment don't support a domain name. So they must communicate
> directly with the IP address.
> That's why Kamailio must be reachable on these domains, but in the
> configuration, subscriber and location use the same domain.
>
> Unfortunately, Asterisk listens on the same IP address, but not the same
> port.
>
> Regards,
>
> Igor.
>
> -----Message d'origine-----
> De : sr-users-bounces at lists.sip-router.org
> [mailto:sr-users-bounces at lists.sip-router.org] De la part de
> Daniel-Constantin Mierla
> Envoyé : mercredi 1 octobre 2014 13:53
> À : Kamailio (SER) - Users Mailing List
> Objet : Re: [SR-Users] Relaying ACK to Asterisk
>
> Hello,
>
> if you have a multi-domain environment, how you can decide which domain is
> the user in if the address is the IP of the server? Or do you have unique
> usernames across all domains and the location is not in multi-domain mode?
>
> Cheers,
> Daniel
>
> On 01/10/14 11:18, Igor Potjevlesch wrote:
>> Hello,
>>
>> Any idea on how can I manage this? I'm still stuck in this issue.
>> If I remove the IP address from domain table, it works but many
>> REGISTER fails because the R-URI only contains
>> sip:<IP_KAMAILIO/ASTERISK> without the port.
>>
>> Many thanks for your help.
>>
>> Regards,
>>
>> Igor.
>>
>> -----Message d'origine-----
>> De : Igor Potjevlesch [mailto:igor.potjevlesch at gmail.com]
>> Envoyé : jeudi 25 septembre 2014 17:45 À : andres at telesip.net;
>> 'Kamailio (SER) - Users Mailing List'
>> Objet : RE: [SR-Users] Relaying ACK to Asterisk
>>
>> Yes you're right. But many SIP requests come with R-URI
>> sip:<IP_KAMAILIO/ASTERISK> without the port.
>> So the test "is_from_local" fails.
>>
>> Regards,
>>
>> Igor.
>>
>> -----Message d'origine-----
>> De : sr-users-bounces at lists.sip-router.org
>> [mailto:sr-users-bounces at lists.sip-router.org] De la part de Andres Envoyé
> :
>> jeudi 25 septembre 2014 15:54 À : Kamailio (SER) - Users Mailing List
>> Objet : Re: [SR-Users] Relaying ACK to Asterisk
>>
>> On 9/25/14, 9:17 AM, Igor Potjevlesch wrote:
>>> I just identified that if "IP_KAMAILIO/ASTERISK" is set into domain
>>> table,
>> As I said before, what you need to use is IP_KAMAILIO/ASTERISK:5060.
>> If you use it without the port, it will match also when directed to
>> your Asterisk server residing on the same IP and loop inside Kamalio
>> without being routed properly.
>>> the issue occured.
>>> If I delete this entry, the ACK is properly relayed.
>>>
>>> The thing is that I use domain table for this check in REQ_INIT:
>>> if (!has_totag()) {
>>>                    if (!is_uri_host_local()) {
>>>                            if (is_from_local() || allow_trusted()) {
>>>                                    xlog("L_WARN","time=[$Tf] call
>>> id=[$ci] call seq=[$cs] contact header=[$ct] from uri=[$fu] from
>>> tag=[$ft] request's method=[$rm] request's uri=[$ru] to uri=[$tu] to
>>> tag=[$tt] sip message id=[$mi] process id=[$pp] ip source=[$si]
>>> flags=[$mf],  From the trusted source\n");
>>>                                    return;
>>>                            }
>>>                            else{
>>>                                    xlog("L_WARN","time=[$Tf] call
>>> id=[$ci] call seq=[$cs] contact header=[$ct] from uri=[$fu] from
>>> tag=[$ft] request's method=[$rm] request's uri=[$ru] to uri=[$tu] to
>>> tag=[$tt] sip message id=[$mi] process id=[$pp] ip source=[$si]
>> flags=[$mf],  Relay Forbidden\n");
>>>                                    sl_send_reply("403", "Relay
> Forbidden");
>>>                            };
>>>                            exit;
>>>                    };
>>>            };
>>>
>>> Regards,
>>>
>>> Igor.
>>>
>>> -----Message d'origine-----
>>> De : Igor Potjevlesch [mailto:igor.potjevlesch at gmail.com]
>>> Envoyé : jeudi 25 septembre 2014 14:45 À : 'Kamailio (SER) - Users
>>> Mailing List'
>>> Objet : RE: [SR-Users] Relaying ACK to Asterisk
>>>
>>> Hello Klaus,
>>>
>>> Thank you for the translation ;)
>>> Here is the config:
>>>
>>> /* add local domain aliases */
>>> alias=sip.domain.tld
>>>
>>> /* uncomment and configure the following line if you want Kamailio to
>>>       bind on a specific interface/port/proto (default bind on all
>>> available) */
>>> listen=udp:IP_KAMAILIO/ASTERISK:5060
>>> listen=udp:IP_KAMAILIO_LAN:5060
>>>
>>> The 'domain' table is populated as follow:
>>> id | domain
>>> 1	<IP_KAMAILIO/ASTERISK>
>>> 2	sip.domain.tld
>>> 3	<hostname_server>
>>> 4	sip.domain.tld
>>>
>>> Regards,
>>>
>>> Igor.
>>>
>>>
>>> -----Message d'origine-----
>>> De : sr-users-bounces at lists.sip-router.org
>>> [mailto:sr-users-bounces at lists.sip-router.org] De la part de Klaus
>>> Darilion Envoyé : jeudi 25 septembre 2014 13:16 À : Kamailio (SER) -
>>> Users Mailing List Objet : Re: [SR-Users] Relaying ACK to Asterisk
>>>
>>> Something is going wrong here:
>>>
>>> On 24.09.2014 18:41, Igor Potjevlesch wrote:
>>>> DEBUG: rr [loose.c:90]: is_preloaded(): is_preloaded: No
>>> That's correct. The ACK is not pre-loaded (with a route set).
>>>
>>> Checking first local URI (either alias= or listen= statement)
>>>> DEBUG: <core> [socket_info.c:583]: grep_sock_info(): grep_sock_info
>>>> - checking if host==us: 14==14 && [<IP_KAMAILIO_ASTERISK>] ==
>>>> [<IP_KAMAILIO_ASTERISK>]
>>>> DEBUG: <core> [socket_info.c:587]: grep_sock_info(): grep_sock_info
>>>> - checking if port 5060 (advertise 0) matches port 4060
>>> Checking seconf local URI (either alias= or listen= statement)
>>>> DEBUG: <core> [socket_info.c:583]: grep_sock_info(): grep_sock_info
>>>> - checking if host==us: 14==12 && [<IP_KAMAILIO_ASTERISK>] ==
>>>> [192.168.0.19]
>>>> DEBUG: <core> [socket_info.c:587]: grep_sock_info(): grep_sock_info
>>>> - checking if port 5060 (advertise 0) matches port 4060
>>>> DEBUG: <core> [forward.c:448]: check_self(): check_self: host != me
>>> Correctly detects that the RURI does not address Kamailio, but
>>>
>>>> DEBUG: rr [loose.c:674]: after_strict(): Next hop:
>>>> 'sip:<IP_KAMAILIO_ASTERISK>;lr=on' is loose router
>>> This means, that check_self returned 1 (match) although it didn't
> matched.
>>> This means that the _check_self_func_list (forward.c) is populated
>>> and matches the RURI.
>>>
>>> Thus, the RURI does not match one of the "standard" aliases (the ones
>>> learned by the listen=... statements) but some other module
>>> registered a callback which returns MATCH, and thus Kamailio thinks
>>> the previous hop is a strict router:
>>>
>>>> DEBUG: rr [loose.c:724]: after_strict(): The last route URI:
>>>> 'sip:<IP_KAMAILIO_ASTERISK>;lr=on'
>>> please post your complete alias=.... and listen=... config.
>>>
>>> Further, I suspect that you register additional aliases via "domain"
>>> or "corex" module and these additional aliases match the RURI. So
>>> review your domain and corex configuration.
>>>
>>> regards
>>> Klaus
>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
>>> list sr-users at 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 at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>> --
>> Technical Support
>> http://www.cellroute.net
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
>> list sr-users at 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 at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> --
> Daniel-Constantin Mierla
> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda




More information about the sr-users mailing list