[SR-Users] route[LOCATION] is it bug?

2017-08-03 Thread Aidar Kamalov
Hello, I 'm new in kamailio.

I have kamailio with dispatcher and two asterisks. Endpoints register to
kamailio. Calls beetwen endpoints going through dispatcher to asterisks.
Calls to other destination rejected by kamailio with 404.
But If i put  xlog("") or xwarn in route[LOCATION] in if
(!lookup("location")) block (default kamailio 5.0.2 config) calls to other
destination goes through dispatcher to asterisks. I cant't understand WHY?
:(
(sorry for my bad English)


route[LOCATION] {
#!ifdef WITH_SPEEDDIAL
# search for short dialing - 2-digit extension
if($rU=~"^[0-9][0-9]$") {
if(sd_lookup("speed_dial")) {
route(SIPOUT);
}
}
#!endif

#!ifdef WITH_ALIASDB
# search in DB-based aliases
if(alias_db_lookup("dbaliases")) {
route(SIPOUT);
}
#!endif
$avp(oexten) = $rU;

if (!lookup("location")) {
xwarn("method ($rm) r-uri ($ru)\n");   ##
HERE ##
$var(rc) = $rc;

route(TOVOICEMAIL);
t_newtran();
switch ($var(rc)) {
case -1:
case -3:
send_reply("404", "Not Found");
exit;
case -2:
send_reply("405", "Method Not Allowed");
exit;
}
}

# when routing via usrloc, log the missed calls also
if (is_method("INVITE")) {
setflag(FLT_ACCMISSED);
}

if(!ds_is_from_list()) {
route(DISPATCH);
}
route(RELAY);
exit;
}

-- 
Aydar A. Kamalov
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Issue in Dialplan Module

2017-08-03 Thread Logeshwaran G
Input Please!!

On Thu, Aug 3, 2017 at 5:08 PM, Logeshwaran G 
wrote:

> Thanks a lot!
>
> But for my scenario,
>
> If I am Dialling 0009199, need to remove the first three digits
> 000, so the call should go to 9199.
>
> I am stucked to create the rule for the above scenario, Kindly help me for
> the same.
>
> Kind Regards,
> Logeshwaran
>
> On Thu, Aug 3, 2017 at 4:48 PM, Daniel Tryba  wrote:
>
>> On Thu, Aug 03, 2017 at 04:00:45PM +0530, Logeshwaran G wrote:
>> >
>> > ++--++--+---+---+---
>> +--+---+
>> > | id | dpid | pr | match_op | match_exp | match_len | subst_exp |
>> repl_exp
>> > | attrs |
>> > ++--++--+---+---+---
>> +--+---+
>> > |  1 |1 |  1 |1 | ^000$ | 0 | ^000$ |
>> > |   | 111
>> > ++--++--+---+---+---
>> +--+---+
>> >
>> > The above rule replacing only the 000, If we Dial 000 its omitting,
>> > While Dialing 000 its replacing that with 111.
>>
>> IN a regexp ^ matches the beginning of the line/string, and $ matches
>> the end.
>>
>> So "^000$" only matches exactly "000" and not "000"
>> Remove the $ to match strings begining with 000.
>>
>> ___
>> Kamailio (SER) - Users Mailing List
>> sr-users@lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] [ *SPAM* 5.1 ] Re: carrierroute and failure route

2017-08-03 Thread Yu Boot

I use this in WITHINDLG to handle reINVITEs

else if ( is_method("INVITE") ) {
record_route();

or T.38 fax behind NAT doesn't work at all.

03.08.2017 15:14, Sebastian Damm пишет:

Hi,

On Thu, Aug 3, 2017 at 12:48 PM, Yu Boot  wrote:

You should only call record_route() in the initial call setup, never
again after the 200 OK. Then you should be fine.




___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] carrierroute and failure route

2017-08-03 Thread Sebastian Damm
Hi,

On Thu, Aug 3, 2017 at 12:48 PM, Yu Boot  wrote:
> First one works OK, but if second route triggers, the following disaster
> occurs (tshark dump) https://pastebin.com/00Ayty36

it's not really a disaster. The Mediant2000 sends out a reINVITE after
the call was established. The client responds with a 200 OK, but then
the ACK is sent to the wrong request URI. While in the reINVITE the
request URI was "sip:200@172.16.0.158:5060;alias=1.2.176.33~5060~1",
it is "sip:200@172.16.0.158:5060" later in the ACK.

My guess is you're record routing your packets even in loose routing.
And you're not doing adding contact aliases there. I've seen before
that clients then re-learn their route to the other side and fuck up
loose routing.

You should only call record_route() in the initial call setup, never
again after the 200 OK. Then you should be fine.

Regards,
Sebastian

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] carrierroute and failure route

2017-08-03 Thread ycaner
Hello
200 Ok couldnt reach somewhere. it is hard to understand what is going. YOu
can use sngrep for tshark to understand better.

Maybe there is nat issue

https://github.com/irontec/sngrep/wiki/Installing-Binaries#centos--fedora--rhel



--
View this message in context: 
http://sip-router.1086192.n5.nabble.com/carrierroute-and-failure-route-tp160803p160805.html
Sent from the Users mailing list archive at Nabble.com.

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Issue in Dialplan Module

2017-08-03 Thread Logeshwaran G
Hi,

I am facing an Problem in Dialplan Module.

Scenario:

I am Dialling 00091xx number, I need to remove only the prefix 000,
then the call placement will be 91xx.

My dialplan rule:
==
MariaDB [kamailio]> select * from dialplan;
++--++--+---+---+---+--+---+
| id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp
| attrs |
++--++--+---+---+---+--+---+
|  1 |1 |  1 |1 | ^000$ | 0 | ^000$ |
|   |
++--++--+---+---+---+--+---+


But the prefix 000 is not replaced. Please Guide me to Resolve this issue.
Do I need to change somet rules??

Additional info:
=

But, With additional to the above dialplan data rule I used the below rule.

++--++--+---+---+---+--+---+
| id | dpid | pr | match_op | match_exp | match_len | subst_exp | repl_exp
| attrs |
++--++--+---+---+---+--+---+
|  1 |1 |  1 |1 | ^000$ | 0 | ^000$ |
|   | 111
++--++--+---+---+---+--+---+

The above rule replacing only the 000, If we Dial 000 its omitting,
While Dialing 000 its replacing that with 111.

Thanks & Regards,
Logeshwaran
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Kamailio inserting Quote " mark in SIP header

2017-08-03 Thread Sebastian Damm
Hi,

On Thu, Aug 3, 2017 at 3:26 AM, Arslan Saeed  wrote:
> We are seeing that Kamailio's nat_helper_module function  of
> add_rcv_param(),  inserts " (quote)  mark to some of the SIP headers (as
> below in the contact header in sip 200 OK response)
>
> Contact:
> ;expires=172
>
> We got few SIP UAs that are  complaining about the quote mark inclusion in
> contact header and responding back with SIP 400 bad syntax status code.
>
> Requesting views / suggestions from community about this behavior of
> kamailio and any workarounds available.

Indeed the quotes are put around the received address by nathelper -
and that has been the case since the initial commit. However, the same
param is for example added by the path module, but without quotes.

I have created a Pull request removing those quotes. However, I did
not try the change locally. Maybe you can grab the patch from here and
apply it to your Kamailio:
https://github.com/kamailio/kamailio/pull/1203

I've never used this function and don't know what it I could use it
for. We only use the add_contact_alias() function for appending the
received information. This information is later used when sending
incoming calls to registered clients.

HTH
Sebastian

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] Using a number as htable key name

2017-08-03 Thread Jan Hazenberg

Hello,

I'm trying to use a htable to reroute some numbers but when i'm trying 
to use kamcmd to add a entry where the element name is a number instead 
of a string i get a 500 error



kamcmd htable.seti force_number 1234 1
error: 500 - Not enough parameters (htable name, key name and value)

Also with quotes i get the 500 error:
kamcmd htable.seti force_number "1234" 1
error: 500 - Not enough parameters (htable name, key name and value)

But this works:
kamcmd htable.seti force_number a1234 1


Is there a way to escape this so i can use a number as element name?

Regards,

Jan Hazenberg

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Fwd: kemi lua routing block as route in standart cfg

2017-08-03 Thread Yuriy Gorlichenko
Thank you for your response! Probably it was at 5.0.x kemi guide.
But anyway Domt uderstand how to call it.

I need tm:local reqest,
Websockets event_route and dialog. Thats it)


On Aug 3, 2017 08:15, "Daniel-Constantin Mierla"  wrote:

> Hello,
>
> where is that TBD note? It needs to be adjusted, probably it is a leftover
> from first days of this feature.
>
> The failure_route, branch_route and onreply_route can be now natively in
> the embedded language, see the Lua script example I provide with the link
> in my previous email.
>
> If you are using event_route blocks, let me know which and I can say if
> they are available -- many of them are, but some are missing, as I am not
> using all the modules available and didn't have the time to dig in all of
> them.
>
> Cheers,
> Daniel
>
> On 02.08.17 13:42, Yuriy Gorlichenko wrote:
>
>
> thx. I just thought that it's possibe to concatenate both engines together.
>
> So this is my last question regardng kemi:
>
> Main goal why i still not use kemi at the my projects is a:
>
> TBD: the options for specific event_route blocks. Meanwhile, should work
> using hybrid configuration with request_route/reply_route/… in embedded
> interpreter and the other routing blocks in native kamailio.cfg.
>
> As i uderstand it is not possible to use event_route in a kemi. only
> native. If yes - do you expect t ointegrate this part of routes at the kemi
> interface in future?
>
>
>
> 2017-08-02 14:36 GMT+03:00 Daniel-Constantin Mierla :
>
>> Hello,
>>
>> if you want to do routing in lua via kemi, the kamailio.cfg has only the
>> passive part (global parameters, loading modules and modparams) and the
>> active part (routing blocks) is a separate file written in the desired
>> scripting language (e.g., lua). See examples:
>>
>>   - https://github.com/kamailio/kamailio/blob/master/misc/exampl
>> es/kemi/kamailio-basic-kemi.cfg
>>
>>   - https://github.com/kamailio/kamailio/blob/master/misc/exampl
>> es/kemi/kamailio-basic-kemi-lua.lua
>>
>> If you still want to have the native kamailio.cfg with its routing
>> blocks, but executed some Lua scripts inline, see app_lua exported
>> functions:
>>
>>   - http://www.kamailio.org/docs/modules/5.1.x/modules/app_lua.h
>> tml#app_lua.f.lua_run
>>
>> Cheers,
>> Daniel
>>
>> On 02.08.17 13:28, Yuriy Gorlichenko wrote:
>>
>> Hi, no
>> I wanna include  lua routes part at existing kamailio.cfg file
>>
>> Just wanna rewrite some route with lua code using kemi because lua more
>> flexible for my needs, but want to call this route at the cfg file.
>>
>> like
>> kamailio.cfg
>> ...
>> route {
>> [MY_SUPER_ROUTE_IN_LUA]
>> }
>> ...
>>
>> Where MY_SUPER_ROUTE_IN_LUA is a route written with kemi on lua language.
>>
>>
>> 2017-08-02 14:10 GMT+03:00 Daniel-Constantin Mierla :
>>
>>> Hello,
>>>
>>>
>>> On 02.08.17 12:02, Yuriy Gorlichenko wrote:
>>> > Hello. I found how to implement lua routimg logic with
>>> > cfgengine but didn't found how to include cimple route in lua at the
>>> > cfg file
>>> >
>>> > Presume i have routing logic and want to include
>>> > my_super_custom_route written with Kemo on lua.  How i need to set up
>>> > my config for it work with both engines?
>>> >
>>> I am not sure I understand what you try to do. The path to yiour Lua
>>> script with routing logic has to be set via modparam of app_lua module.
>>>
>>> Are you trying to include a lua file in another lua file?
>>>
>>> Cheers,
>>> Daniel
>>>
>>> --
>>> Daniel-Constantin Mierla
>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>> Kamailio Advanced Training - www.asipto.com
>>> Kamailio World Conference - www.kamailioworld.com
>>>
>>>
>>
>>
>> ___
>> Kamailio (SER) - Users Mailing 
>> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>> --
>> Daniel-Constantin Mierlawww.twitter.com/miconda -- 
>> www.linkedin.com/in/miconda
>> Kamailio Advanced Training - www.asipto.com
>> Kamailio World Conference - www.kamailioworld.com
>>
>>
>
>
>
> ___
> Kamailio (SER) - Users Mailing 
> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierlawww.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio Advanced Training - www.asipto.com
> Kamailio World Conference - www.kamailioworld.com
>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users