Hi,
>From kamailio documentation, the usage of hashtable is given as :
modparam("htable", "htable", "a=>size=4;")
...
$sht(a=>test) = 1;
$sht(a=>$ci::srcip) = $si;
I get it that in the first statement, a is the hashtable, a new
key-value pair is added to one of its empty bucket (test,1).
What is happening in the second statement?
--
-Cheers
-Arif
As a continuation of my project, I am trying to set up Kamailio as a Websocket bridge to Asterisk. The asterisk instance is running as localhost, with its own websocket support disabled, but otherwise has accounts with all of the avfp and dtls settings for
websockets. Additionally, I have removed the bindaddr=127.0.0.1 from sip.conf and instead put a deny=0.0.0.0/0.0.0.0 and permit=127.0.0.1/255.255.255.0 in order to restrict SIP signaling to localhost. This allows asterisk to bypass rtpproxy when signaling
through a websocket. I have already established calls originating from the browser. However, I have an issue with the registration.
In my setup, Kamailio receives the REGISTER from whatever source, and forwards this through UDP to Asterisk, after the multiple-domain transformation. Therefore, Asterisk sees the following in its SIP port (all traffic through localhost):
REGISTER sip:pbx.villacis.com SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bKc1c5.cb49f656197d0ba16f2a1661dd6a44cc.0
Via: SIP/2.0/WSS r01r0mla9hdp.invalid;rport=47307;received=192.168.3.2;branch=z9hG4bK9309681
Max-Forwards: 69
To: <sip:avillacisIM_pbx.villacis.com@127.0.0.1:5080>
From: "Alex Villac..s" <sip:avillacisIM_pbx.villacis.com@127.0.0.1:5080>;tag=b5c0lq4kac
Call-ID: vp2akar0aqfmgfa6m1taau
CSeq: 82 REGISTER
Contact: <sip:fnuql6ft@192.168.3.2:47307;transport=ws>;reg-id=1;+sip.instance="<urn:uuid:6b0c58ee-bdc5-47c0-aff0-963132dc0cad>";expires=600
Allow: ACK,CANCEL,BYE,OPTIONS,INFO,NOTIFY,INVITE,MESSAGE
Supported: path,gruu,outbound
User-Agent: SIP.js/0.6.2
Content-Length: 0
Asterisk answers this through UDP, and Kamailio forwards it through the websocket:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bKc1c5.cb49f656197d0ba16f2a1661dd6a44cc.0;received=127.0.0.1;rport=5060
Via: SIP/2.0/WSS r01r0mla9hdp.invalid;rport=47307;received=192.168.3.2;branch=z9hG4bK9309681
From: "Alex Villac..s" <sip:avillacisIM_pbx.villacis.com@127.0.0.1:5080>;tag=b5c0lq4kac
To: <sip:avillacisIM_pbx.villacis.com@127.0.0.1:5080>;tag=as5ae2df76
Call-ID: vp2akar0aqfmgfa6m1taau
CSeq: 82 REGISTER
Server: Asterisk PBX 11.12.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Expires: 600
Contact: <sip:fnuql6ft@192.168.3.2:47307;transport=ws>;expires=600
Date: Thu, 28 Aug 2014 22:21:15 GMT
Content-Length: 0
Then Asterisk sends this through UDP, and Kamailio again forwards it through the websocket:
NOTIFY sip:fnuql6ft@192.168.3.2:47307;transport=ws SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bK4d60f167;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@127.0.0.1:5080>;tag=as43c12840
To: <sip:fnuql6ft@192.168.3.2:47307;transport=ws>
Contact: <sip:asterisk@127.0.0.1:5080>
Call-ID: 04deeb0068a847fa514d748c7d9993c5@127.0.0.1:5080
CSeq: 102 NOTIFY
User-Agent: Asterisk PBX 11.12.0
Event: message-summary
Content-Type: application/simple-message-summary
Content-Length: 89
Messages-Waiting: no
Message-Account: sip:*97@127.0.0.1:5080
Voice-Message: 0/0 (0/0)
Since I have not implemented handling of voicemail indications, the browser answers this:
SIP/2.0 405 Method Not Allowed
Via: SIP/2.0/UDP 127.0.0.1:5080;branch=z9hG4bK4d60f167;rport=5080
To: <sip:fnuql6ft@192.168.3.2:47307;transport=ws>;tag=ggu5etber9
From: "asterisk" <sip:asterisk@127.0.0.1:5080>;tag=as43c12840
Call-ID: 04deeb0068a847fa514d748c7d9993c5@127.0.0.1:5080
CSeq: 102 NOTIFY
Supported: outbound
Content-Length: 0
After that, Asterisk wants to send an OPTIONS packet. From the point of view of Asterisk (sip set debug on), it is already sent, but never gets a response. However, tcpdump shows that the packet is never sent through the localhost interface in the first
place. It is also not sent through any other interface. My guess is that since the REGISTER has a contact with transport=ws , Asterisk wants to send this through a websocket (which is disabled). So I could have to generate a contact without transport=ws .
I have worked around this by setting qualify=no in the account for the websocket, but I would like a better solution, one that allows the OPTIONS packet to reach the browser, and to get the response. What is the proper way to deal with this?
Hi,
I have the following setup:
UAC ---> LB ---> Proxy ---> GW
In NAT scenarios the loadbalancer detects it, but the proxy communicates
with the RTP proxy. I want to send the original caller IP as detected by
the loadbalancer (and transported to the proxy) to the RTP proxy.
As far as I understand the documentation of the rtpproxy module, I could
call rtpproxy_manage with a second parameter, indicating which IP address
should be sent to the RTP proxy. I tried sending a pseudovariable, both
within quotes or not, or even a static string. But when I look at those
messages sent to the RTP proxy, there's always the IP from where the SIP
packet was received (the loadbalancer IP) in the request.
Previously we used the "r" parameter, sending the original IP from the SDP
to the proxy. But due to strange behavior of some UACs, we want to get rid
of that.
Do I misunderstand the second parameter?
This is what the documentation says:
* ip_address* - new SDP IP address.
Unfortunately, I couldn't find any example using this.
Best Regards,
Sebastian
Hi All,
I wonder if some one could help me to diagnose a recurring issue?
It happens at random times/intervals and under varying load. But always,
just before the time of crash, I see the same critical error in log:
CRITICAL: dialog [dlg_hash.c:841]: log_next_state_dlg(): bogus event 6 in
state 1 for dlg 0xb0632134 [1367:5814] with clid '
0695dd7a346188dd24e7520e6c01092c(a)sip.sipcentric.com' and tags 'as77c89620'
''
Analysing the core dump reveals:
Core was generated by `/usr/sbin/kamailio -P /var/run/kamailio.pid -m 128
-M 4 -u kamailio -g kamailio'.
Program terminated with signal 11, Segmentation fault.
#0 0x081a737c in parse_uri (buf=0x3a70006e <Address 0x3a70006e out of
bounds>, len=275, uri=0xbfa2fd2c) at parser/parse_uri.c:389
389 scheme=buf[0]+(buf[1]<<8)+(buf[2]<<16)+(buf[3]<<24);
(gdb) frame 1
#1 0x008fe5dd in dialog_publish (state=0x903f37 "Trying", ruri=0xb0b5fd00,
entity=0xb0632188, peer=0xb0632190, callid=0xb0632180, initiator=1,
lifetime=7200, localtag=0x0, remotetag=0x0, localtarget=0x0,
remotetarget=0x0, do_pubruri_localcheck=1) at dialog_publish.c:275
275 if (parse_uri(ruri->s, ruri->len, &ruri_uri) < 0) {
(gdb) p *ruri
$1 = {s = 0x3a70006e <Address 0x3a70006e out of bounds>, len = 275}
(gdb) up
#2 0x008ff277 in dialog_publish_multi (state=0x903f37 "Trying",
ruris=0xb0b5fd00, entity=0xb0632188, peer=0xb0632190, callid=0xb0632180,
initiator=1, lifetime=7200, localtag=0x0, remotetag=0x0,
localtarget=0x0, remotetarget=0x0, do_pubruri_localcheck=1) at
dialog_publish.c:387
387
dialog_publish(state,&(ruris->s),entity,peer,callid,initiator,lifetime,localtag,remotetag,localtarget,remotetarget,do_pubruri_localcheck);
(gdb) p *ruris
$2 = {s = {s = 0x3a70006e <Address 0x3a70006e out of bounds>, len = 275},
next = 0x0}
(gdb) up
#3 0x0090187a in __dialog_created (dlg=0xb0632134, type=2,
_params=0x6db064) at pua_dialoginfo.c:470
470 dialog_publish_multi("Trying", dlginfo->pubruris_caller,
&(dlg->from_uri), (include_req_uri)?&(dlg->req_uri):&(dlg->to_uri),
&(dlg->callid), 1, dlginfo->lifetime, 0, 0, 0, 0,
send_publish_flag==-1?1:0);
(gdb) p *dlginfo->pubruris_caller
$3 = {s = {s = 0x31590014 <Address 0x31590014 out of bounds>, len = 275},
next = 0xb0b5fd00}
(gdb) p *dlginfo->pubruris_caller->next
$4 = {s = {s = 0x3a70006e <Address 0x3a70006e out of bounds>, len = 275},
next = 0x0}
In config, for pua_dialoginfo we are enabling the option "use_pubruri_avps"
and setting "pubruri_caller_avp" and "pubruri_callee_avp" accordingly.
Therefore, in pua_dialoginfo.c it is using get_str_list() function to set
dlginfo->pubruris_caller from the avp.
Could this be some race condition or something completely different?
Thanks in advance,
Charles
--
www.sipcentric.com
Follow us on twitter @sipcentric <http://twitter.com/sipcentric>
Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered
office: Faraday Wharf, Innovation Birmingham Campus, Holt Street,
Birmingham Science Park, Birmingham B7 4BB.
Hi,
I want to append the origin header of my incoming websockets to the SIP INVITES. I tried something like the below but didnt work:
if (ws_handle_handshake()) { if(method=="INVITE"){ insert_hf("Origin: $hdr(Origin)"); } exit; }
Is there any other way to do it ?
Hello,
When I try to execute the /etc/init.d/kamailio start, I've this error :
[root@gtk:~][Mon 18/08/2014 16:21:58]
# /etc/init.d/kamailio start
Not starting Kamailio SIP server: invalid configuration file! failed
failed
ERROR: loading config file(/usr/local/etc/kamaiilio/kamailio.cfg): No
such file or directory failed
failed
Thank you for your help,
Best Regards,
Djamel BAHAMID.
Hello,
if you are on sr-dev list, you should have seen the last commits to
dialog module, which add support for remote profiles.
As most of you know (or at least the users of dialog module), profiles
are used to group active calls, their main purposes being counting
dialogs belonging to a profile for implementing active call limits
(e.g., all calls in the system, call from/to a specif user/address).
It was working on a single Kamailio instance, but one could use other
meanings to interact with other kamailio instance to get the number of
calls across multiple instances.
The purpose of remote profiles is to make the whole process easier and
more transparent for config file, simplifying the maintenance.
A remote profile is an item stored in local profile list not bound to a
local dialog. At this moment, dialog module in master branch exports a
function dlg_remote_profile() that allows to add/remove a remote profile.
The next step is to build the notification system between kamailio
instances. There are couple of options, as well as questions, that I
want to discuss before going to implement the mechanism. There are two
major aspects to care of:
A) Distribution, I thought of two options for it:
1) using dmq module to publish the operations done with local profiles
(add/remove) -- this seems to be the natural choice right now, Charles
Chance is also willing to put effort in this direction
This will be coded inside the module, so config won't be affected much
(eventually some extra parameters of dialog flags).
2) add event routes for adding/removing a local profile. The attributes
of the profile can be made available via some PV, then in config use
what so ever option (e.g., http query, json rpc, etc) for distributing
the information.
This will require changes in config file and might not be trivial for
new users
B) Persistence, with the options:
1) store remote profiles in local database.
It is good for restart, but if there is big downtime, then some
notifications can be lost and the list of remote profiles might be
inaccurate
2) keep in memory only and at startup send a 'request-for-update' to the
other instances -- these instances will send the list of their local
profiles.
It can take a bit between request-for-update and receiving data from the
other servers -- during this interval, the checks of overall call limits
might not give the desired answer
Of course, there can be enhancements/combinations, but it has to be
analysed if the benefit worth the complexity. For 1), store also the IP
of each remote profile and then interrogate for each profile to see if
its still active. For 2), add a mechanism to reject new calls until the
request-for-update is completed.
Anyone having other ideas or comments to the above?
Note that each profile got a unique id, so if you upgrade your dialog
module, profiles for existing active calls will not be loaded. Also, the
code was barely tested, report here any issue you have with dialog from
master branch.
Cheers,
Daniel
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA
Hi all,
I'm trying to configure a Kamailio server, and am having trouble getting
devices behind NAT receive calls. Looking at a SIP trace, nothing is
being received by the end point, even though Kamailio seems to be
sending out a response.
I've opened up my firewall rules, so that shouldn't be an issue.
If I call another endpoint which is behind the same NAT, it works
(although no audio), and looking at the trace, the SIP messaging is
coming from the Kamailio server (ie. not the other endpoint).
I've even tried using the default kamailio-advanced.cfg &
kamailio-basic.cfg both of which didn't work either.
I've attached the current config I'm working on, if someone could please
have a look through it, and see where I'm going wrong I'd highly
appreciate it.
Thanks
Adnan
Hi,
Is it possible to run kamailio without database support (even dbtext)?
Where can I find minimal configuration example with minimal modules
set only for forwarding any requests/responses from one ip address to
another one?
--
WBR,
Eugene Prokopiev
Hi,
I've got a piece of config code which should solve my problem, but i'm
not getting the code. It involves hashtable module. Here it goes :
modparam("htable", "htable", "a=>size=8;autoexpire=400")
modparam("htable", "htable", "b=>size=8;autoexpire=31")
Ok we have two hashtable , a and b, both has a "size" of 8.
Then,
else if(status == "503") {
if($sht(a=>alarm::503) == $null) $sht(a=>alarm::503)=0;
$sht(a=>alarm::$si::503) = $sht(a=>alarm::$si::503) + 1;
}
Here i get lost. what's "a=>alarm::503" and what's
"a=>alarm::$si::503"? What's there difference?
Next the code goes like :(its supposed be pseduocode)
$elem = the size of the sht array.
while($i < $elem) {
$src_ip = $sht(source_ip_array)[$i];
$i = $i +1;
sql_query("cb", "INSERT INTO alarm_data (create_date, type, total,
description, source_ip) VALUES(NOW(), 'Too Many 503',
$sht(a=>alarm::$src_ip::503), 'service unavailable', '$src_ip')");
}
Now i have couple of problems with this code
[1] what should be the value of $elem?
[2] $sht(source_ip_array)[$i]? what should be the value of source_ip_array?
The thing i'm trying to do is, when a 503 (Service unavailable) comes
to kamailio, I want to insert it into a database which records this.
--
-Cheers
-Arif