Hi Everyone,
We're running Kamailio 5.2.5 with XHTTP, Websocket and TLS extensions - for
the purpose of being able to provide WebRTC capability. The settings for
the HTTP request are quite default as set out below.
The SIP client we're using is SIP5ML in different web browsers. After a
successful start of Kamailio, it is possible to use SIP5ML and its features
- i.e. it REGISTER's properly, calls can be made, etc. After about a few
hours of running, Kamailio refuses to interact and abruptly closes the TCP
connection. The only solution (discovered so far) is to restart Kamailio,
which is not feasible on a server that is serving production needs. (On our
development server, where the load is only a fraction - this problem does
not occur).
When the problems does start to occur, in Wireshark I see:
1) Normal TLS negotiation and certificate exchange; followed by
2) SIP5ML initiating the initial HTTP GET
3) Kamailio responds to the upgrade with a 101/Switch Protocols.
(4- SIP5ML outputs a SIP REGISTER on a defunct socket as its was closed)
Immediately after the 101/Switching Protocol message is received, Kamailio
closes down the TCP connection with a FIN message. Nothing in the message
or Kamailio log files help to identify what module is responsible for this.
Would anyone have any advise where to look further? BTW, I don't see the
TCP connection being Reset in the exchanges - so any advise will be
appreciated.
Tom
event_route[xhttp:request] {
set_reply_close();
set_reply_no_connect();
if ($Rp != 8089) {
xlogl("L_CRIT", "HTTP request received on $Rp\n");
xhttp_reply("403", "Forbidden - 0x24", "", "");
exit;
}
xlogl("L_CRIT", "HTTP Request Received\n");
if ($hdr(Upgrade)=~"websocket"
&& $hdr(Connection)=~"Upgrade"
&& $rm=~"GET") {
# Validate Host - make sure the client is using the correct
# alias for WebSockets
if ($hdr(Host) == $null || !is_myself("sip:" + $hdr(Host))) {
xlogl("L_CRIT", "Bad host $hdr(Host)\n");
xhttp_reply("403", "Forbidden - 0x25", "", "");
exit;
}
# ws_handle_handshake() exits (no further configuration file
# processing of the request) when complete.
if (ws_handle_handshake())
{
# Optional... cache some information about the
# successful connection
exit;
}
}
xhttp_reply("404", "Resource Not Found - 0x27", "", "");
}
event_route[websocket:closed] {
xlogl("L_CRIT", "WebSocket connection from $si:$sp has closed\n");
}
> Oops. No, it’s not a bug, it’s just that the URI isn’t the only value present in $ct.
>
> Try $(ct{nameaddr.uri}{uri.host})
Yup, that fixed it. Thanks again!
I have another question about how I’m applying these to some routing logic but I’ll start a new thread for that in a bit.
HI!
Seems to be, http_async client is not compatible with http2 servers.
I'm having like
kamailio_1 | 15(20) INFO: http_async_client [http_multi.c:238]:
debug_cb(): [cURL] Connection #0 to host relay-api.pbxservice.com left
intact
kamailio_1 | 15(20) ERROR: <core> [core/parser/parse_fline.c:264]:
parse_first_line(): parse_first_line: bad message (offset: 11)
kamailio_1 | 15(20) ERROR: <core> [core/parser/msg_parser.c:681]:
parse_msg(): ERROR: parse_msg: message=<HTTP/2 404
kamailio_1 | date: Thu, 14 Nov 2019 18:31:34 GMT
....
kamailio_1 | 15(20) ERROR: <core> [core/parser/msg_parser.c:337]:
parse_headers(): bad header field [(null)]
kamailio_1 | 15(20) ERROR: <core> [core/parser/msg_parser.c:1274]:
get_body(): failed to parse to end of headers
But plain http_client worked good (not async for sure)
kamailio 5.3.0
--
Best regards,
Igor
Greetings,
I'm trying to parse some URI info on Kamailio but i'm having some troubles
the URI transformations.
Here i have two examples of URIS from which i'm trying to extract
username(with user parameters included) and URI Parameters :
- sip:123456789;test=param@1.1.1.1
- sip:123456789;test=param@1.1.1.1;user=phone
In order to test this i made the following code :
$var(URI) = "sip:123456789;test=param@1.1.1.1";
xerr("DEBUG 1 : URI $var(URI)");
$var(User) = $(var(URI){uri.user});
$var(Parameters) = $(var(URI){uri.params});
xerr("DEBUG 1 : User = $var(User)");
xerr("DEBUG 1 : Parameters = $var(Parameters)");
$var(URI) = "sip:123456789;test=param@1.1.1.1;user=phone";
xerr("DEBUG 2 : URI $var(URI)"); ;
$var(User) = $(var(URI){uri.user});
$var(Parameters) = $(var(URI){uri.params});
xerr("DEBUG 2 : User = $var(User)");
xerr("DEBUG 2 : Parameters = $var(Parameters)");
The result is the following :
DEBUG 1 : URI sip:123456789;test=param@1.1.1.1
DEBUG 1 : User = 123456789;test=param
DEBUG 1 : Parameters =
DEBUG 2 : URI sip:123456789;test=param@1.1.1.1;user=phone
DEBUG 2 : User = 123456789
DEBUG 2 : Parameters = user=phone
If the URI has parameters, the User parameters won't be included in the
User part.
Is this a bug or is it working as intended? I'm running Kamailio 5.2.0 .
Thank you for your time.
Best Regards,
Duarte Rocha
Hello everyone,
I have a potentially silly beginners question: how can I parse the contact port field and act on it in my routing logic?
I know that the $ct variable contains the entire contact header and I can print it in an xlog() call. However, I’d like to do something like the following in my routing logic:
. . . SIP CONTENT
Contact: <sip:someaccount@192.168.86.104:5062>;expires=1800
. . . CONFIG LOGIC
#!define PORT_SERVICE1 5061
#!define PORT_SERVICE2 5062
route {
if ( src_port == PORT_SERVICE1 ) {
xlog(“L_INFO”, “Received $rm from SERVICE1\n”);
} else if ( src_port == PORT_SERVICE2 ) {
xlog(“L_INFO”, “Received $rm from SERVICE2\n”);
}
}
I realize that src_port is not the correct value to compare against. I want to compare against the originating contact’s port value.
How can I extract the port field from $ct?
Many thanks in advance and apologies for the beginners question. I’ve googled for what I think I’m trying to do without any real results on functions or tokenizers, etc. I’m using Kamailio 5.3.0.
Regards,
-Michael
I am using kamailio 5.3.
Ovidiu Sas, i will try this tomorrow today is bit late. Maybe it could work.
David Villasmil , i know i can use SQLOPS but i was thinking of easier
method of doing this.
By successful REGISTER i mean save only REGISTER attempt that authenticated
correctly at SIP server and in 200 OK a binding was returned.
Same if the binding is later removed i would like remove it from database.
I need this because when i run REGISTER over kamailio to destination SIP
server i see all register from same IP.
I need to be able to check what was the real source IP of client REGISTER.
Regards,
Tomasz
pt., 15 lis 2019 o 00:16 Mike from ApoloCore <mike(a)apolocore.com>
napisał(a):
> I am using kamailio 5.3.
>
> Ovidiu Sas, i will try this tomorrow today is bit late. Maybe it could
> work.
>
> David Villasmil , i know i can use SQLOPS but i was thinking of easier
> method of doing this.
> By successful REGISTER i mean save only REGISTER attempt that
> authenticated correctly at SIP server and in 200 OK a binding was returned.
> Same if the binding is later removed i would like remove it from database.
> I need this because when i run REGISTER over kamailio to destination SIP
> server i see all register from same IP.
> I need to be able to check what was the real source IP of client REGISTER.
>
> Regards,
> Tomasz
>
>
> czw., 14 lis 2019 o 23:33 Ovidiu Sas <osas(a)voipembedded.com> napisał(a):
>
>> Try to use save() when you process the 200 ok reply for REGISTER in
>> the reply route.
>>
>> Regards,
>> Ovidiu Sas
>>
>> On Thu, Nov 14, 2019 at 3:40 PM Voip support <voipexpert0(a)gmail.com>
>> wrote:
>> >
>> > I setup kamailio to forward REGISTER packets using dispatcher to two
>> servers main and backup.
>> >
>> > The routing logic is quite simple i use the dispatcher probing
>> mechanism to detect if my main dispatcher set id (one server) is active or
>> inactive once it detect a failure all packets are sent to secondary SIP
>> server to achieve High Availability.
>> >
>> > I am looking for module or a way to save into kamailio database client
>> information such as IP address, register username (from FROM header),
>> digest username (authorization username), call-id for successful
>> registration.
>> >
>> > I tried to use registrar module but once i used function
>> save("location") the client was registered on kamailio and packets was not
>> forwarded to main/secondary SIP server (like dispatcher stopped working,
>> the destination did not override).
>> >
>> > REGISTER is sent to SIP URI of kamailio.
>> >
>> > Please let me know if you have any idea how to make this data update in
>> database (insert an entry on fresh successfull REGISTER, delete on expired
>> or removed binding).
>> >
>> > Best regards,
>> > Tomasz
>> >
>> > _______________________________________________
>> > Kamailio (SER) - Users Mailing List
>> > sr-users(a)lists.kamailio.org
>> > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>>
>> --
>> VoIP Embedded, Inc.
>> http://www.voipembedded.com
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users(a)lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
>
I setup kamailio to forward REGISTER packets using dispatcher to two
servers main and backup.
The routing logic is quite simple i use the dispatcher probing mechanism to
detect if my main dispatcher set id (one server) is active or inactive once
it detect a failure all packets are sent to secondary SIP server to achieve
High Availability.
I am looking for module or a way to save into kamailio database client
information such as IP address, register username (from FROM header),
digest username (authorization username), call-id for
successful registration.
I tried to use registrar module but once i used function save("location")
the client was registered on kamailio and packets was not forwarded to
main/secondary SIP server (like dispatcher stopped working, the destination
did not override).
REGISTER is sent to SIP URI of kamailio.
Please let me know if you have any idea how to make this data update in
database (insert an entry on fresh successfull REGISTER, delete on expired
or removed binding).
Best regards,
Tomasz
Hi,
I have multiple Kamailio instances using dispatcher using alg “7” - hash
over the content of PVs string, both using the same dispatcher list.
Is it reasonable to expect both Kamailio, given the same hash_pvar, to
select the same host from the same set?
Looking at the source I do not see any reason why not, but I am getting
different results from the two Kamailio servers. The only difference
between them is different minor version numbers - 4.3.4 and 4.3.7
I want to ensure that calls with the same hash_pvar value go to the same
backend no matter which Kamailio processes the request.
Thanks!
-Barry Flanagan
Yep
version_table
Set the name of the table holding the table version. Useful if the
proxy is sharing a database within a project and during upgrades.
Default value is “version”.
Example of usage:
version_table="version44"
That's what I was looking for, perfect!
Yes, I added accountcode and notes to my table for internal use, was
just making notes on columns I need on the new version upgrade.
Thanks.
JR
On Tue, Jun 18, 2019 at 2:17 PM Daniel-Constantin Mierla
<miconda(a)gmail.com> wrote:
>
> Hello,
>
> like Alex said, you can have two version tables, one for each versions
> of kamailio you play with and use in config the core parameter to set
> the name of that table.
>
> I am actually writing to say that address table never had accountcode
> and notes columns. Likely they were added in your deployment for other
> purposes or either the default column names were changed. The default
> column names are listed at:
>
> -
> https://kamailio.org/docs/db-tables/kamailio-db-5.2.x.html#gen-db-address
>
> These were the same for rather long time, iirc the recent version number
> changed mainly due to with modifications done to the size, not due to
> new columns.
>
> Cheers,
> Daniel
>
> On 18.06.19 20:50, JR Richardson wrote:
> > Hey All,
> >
> > I'm doing some upgrades and noticed database table version numbers
> > have increased.
> >
> > database table adjustments:
> > | address | production ver 3 | upgrade 5.2 ver 6 | need to add
> > accountcode and notes column
> > | dispatcher | production ver 3 | upgrade 5.2 ver 4 | need to add attr column
> > | trusted | production ver 5 | upgrade 5.2 ver 6 | need to add
> > ruri_pattern and priority column
> >
> > I run mysql master/slave so I'm concerned about the master database
> > not having the correct version numbers or can I just update the
> > version number in the table when I do the upgrade of the kamailio
> > versions?
> >
> > Thanks.
> >
> > JR