Hello,
I just need to count the number of a specific character in a string.
For example I want to count the number of "a" in the following string :
"bbbaddaa34"
I searched among transformations but didn't find such tool.
Any help would be appreciated.
Thanks
Ali
Hi,
I am trying to change only the "display name" of the FROM header using uac_replace_from().However, the value is not being changed (see below)
request_route { .... xlog ("L_INFO", "fu=$fu"); uac_replace_from("pbx", ""); xlog ("L_INFO", "fu=$fu");
# authentication route(AUTH); ....}
Am I missing anything? Any help in this regard would be greatly appreciated.
Thanks,Al
After enabling and deciphering debugging it appears there may be a bug. I
also reviewed https://tools.ietf.org/html/rfc5658#section-6
I cross-referenced my pcap to ensure I was looking at the reINVITE and see:
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: rr
[loose.c:785]: after_loose(): *Topmost route URI:
'sip:xx.xxx.x.xx;lr;r2=on;ftag=a30a720a;did=b75.65a1;nat=yes' is me*
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: <core>
[socket_info.c:583]: grep_sock_info(): grep_sock_info - checking if
host==us: 11==11 && [xx.xxx.x.xx] == [xx.xxx.x.xx]
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: <core>
[socket_info.c:587]: grep_sock_info(): grep_sock_info - checking if port
5060 (advertise 0) matches port 5061
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: <core>
[socket_info.c:583]: grep_sock_info(): grep_sock_info - checking if
host==us: 11==11 && [xx.xxx.x.xx] == [xx.xxx.x.xx]
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: <core>
[socket_info.c:587]: grep_sock_info(): grep_sock_info - checking if port
5070 (advertise 0) matches port 5061
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: <core>
[socket_info.c:583]: grep_sock_info(): grep_sock_info - checking if
host==us: 11==11 && [xx.xxx.x.xx] == [xx.xxx.x.xx]
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: <core>
[socket_info.c:587]: grep_sock_info(): grep_sock_info - checking if port
5090 (advertise 0) matches port 5061
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: <core>
[socket_info.c:583]: grep_sock_info(): grep_sock_info - checking if
host==us: 11==11 && [xx.xxx.x.xx] == [xx.xxx.x.xx]
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: <core>
[socket_info.c:587]: grep_sock_info(): grep_sock_info - checking if port
5061 (advertise 0) matches port 5061
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: <core>
[parser/msg_parser.c:106]: get_hdr_field(): found end of header
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: rr
[loose.c:181]: find_next_route(): *No next Route HF found*
Jun 16 15:01:29 xxxxxxxxxxxxx /usr/sbin/kamailio[643]: DEBUG: rr
[loose.c:847]: after_loose(): no next URI found
There is definitely another Route header immediately below the one found
above, but find_next_route() doesn't find it
. I added my own debugging to loose.c and
if ((_m->last_header->type!=HDR_ROUTE_T) || (_m->last_header==*_hdr)) {
LM_DBG("No next Route HF found\n");
LM_DBG("_m->last_header->type: %d\n", _m->last_header->type);
return 1;
}
logs find_next_route(): _m->last_header->type: 12 which is
HDR_CONTENTLENGTH_T which is indeed the LAST header in the message. We have
done very little work in the Kamailio source...just some database escaping
in odbc for things to work properly with our database engine...but unless
I'm missing something isn't it very wrong to be looking at the last header
right here? I may attempt to figure out the message and/or hdr_field data
structures and change it. It may also be that the issue doesn't occur when
find_next_route is called with a valid _hdr which does seem to search for
the "next" one vs going straight to the final header in the entire message.
If this is getting overly complicated for this mailing list please let me
know...
Ryan
On Tue, Jun 16, 2015 at 11:40 AM, Ryan Kendrick <kendrick.ryan.c(a)gmail.com>
wrote:
>
> We are using Kamailio 4.2.5 as a registrar and proxy between many
> dispersed end-users of a soft phone app and our calling platform / switch.
>
> Until now we have used udp exclusively but are trying to introduce tcp
> between end-users and Kamailio, leaving udp between Kam and our
> switch...while maintaining the ability for some end-users to use udp to Kam.
>
> With some simple address checks I am able to always send to our switch
> over udp. If all end-users used tcp I could send everything else tcp, but I
> need to maintain udp support.
>
> The specific problem I am having is on a reINVITE such as this one from
> our platform to the a-leg:
>
> INVITE sip:xxxxxx@xxxxxxxxxxxxx:42679;user=phone SIP/2.0
> Via: SIP/2.0/UDP
> xxxxxxxxxxxxx:5060;branch=z9hG4bK218cc8e12ll5035f67INV6a67885312aad
> Max-Forwards: 35
> Route: <sip:xxxxxxxxxxx;lr;r2=on;ftag=daba971c;did=b57.4872;nat=yes>
> Route:
> <sip:xxxxxxxxxxx:5070;transport=tcp;lr;r2=on;ftag=daba971c;did=b57.4872;nat=yes>
> Contact: <sip:xxxxxxxxxx@xxxxxxxxxxxxx:5060>
> To: "xxxxxx"<sip:xxxxxx@xxxxxxxxxxxxxxxxxxxxxxxxxxx:5070>;tag=daba971c
> From: <sip:xxxxxxxxxx@xxxxxxxxxxxxxxxxxxxxxxxxxxx
> :5070>;tag=6a678853-co76461-INS002
> Call-ID: MDI4ZmFjNmZhN2Y1NWE2ZTViNTkyZGUwNWE2YzUzYmU
> CSeq: 7646101 INVITE
> Allow:
> INVITE,ACK,CANCEL,BYE,REFER,OPTIONS,NOTIFY,SUBSCRIBE,PRACK,INFO,UPDATE
> Content-Type: application/sdp
> Date: Mon, 15 Jun 2015 20:10:18 GMT
> User-Agent: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Content-Length: 262
>
> As you might notice, we have rr:enable_double_rr set:
>
> *There are some situations when the server needs to insert two
> Record-Route header fields instead of one. For example when using two
> disconnected networks or doing cross-protocol forwarding from UDP->TCP.
> This parameter enables inserting of 2 Record-Routes. The server will later
> remove both of them. *
>
> and I believe it is necessary to keep this way. Without it Kamailio
> doesn't even see the reINVITE...the switch probably tries tcp and that's
> not setup between the two.
>
> The invite above is sent to the a-leg over udp but I would expect and need
> it to be tcp in this case. The reINVITE is part of an existing dialog. We
> call loose_route() followed by some simple bflag setting and flag checking,
> t_on_reply(), ... then t_relay().
>
> I do have a functional workaround but would prefer to avoid such manual
> handling by utilizing built-in functionality properly.
>
> #
> # relay the message
> #
> if(route(TEST_TOGW)) {
> if (!t_relay_to_udp()) {
> sl_reply_error();
> }
> }
> else {
> if ($(hdr(Route)[-1]) =~ "tcp") {
> if(!t_relay_to_tcp()) {
> sl_reply_error();
> }
> }
> else if (!t_relay()) {
> sl_reply_error();
> }
> }
>
> I'm not 100% sure how reliable or fast this will be, but it does work so
> far in my simple tests.
>
> Is loose_route supposed to see and use the transport=tcp but isn't for
> some reason? It seems like the right thing to do to me. If not, is there
> anything else I can/should be doing in the tm and/or rr modules to make
> Kamailio realize it needs to send this message over TCP? If not in those
> two modules is there some recommended way perhaps via registrar or usrloc
> etc. to make Kamailio remember/store when a user is connected via TCP and
> be able to do a quick lookup before sending to them? Anything else I'm
> missing or not thinking of?
>
> Please let me know if I can further explain and rest assured any
> assistance will be much appreciated!!!
>
Hi Guys,
Has anyone recently performed tests on kamailio 4.2 running up to 200 CPS?
It would be great to know the hardware requirements for this setup.
Thanks
Jon
Hi,
TM forward ACK statelessly (see log below), so there is no call of
installed callback on TMCB_REQUEST_(IN)SENT in siptrace module, so I can't
see way how to log ACK sent packet.
Any work around to get sent ACK logged?
DEBUG: sl [sl_funcs.c:388]: sl_filter_ACK(): DEBUG : sl_filter_ACK: to late
to be a local ACK!
DEBUG: <script>: 408:172.16.23.130:5060 <-- 198.51.100.137:52150 ACK
sip:8807@127.0.0.1:5080;transport=udp
DEBUG: <script>: 425: start trace ACK
DEBUG: siptrace [siptrace.c:1865]: pipport2su(): the port string is 52150
DEBUG: siptrace [siptrace.c:1865]: pipport2su(): the port string is 5060
DEBUG: siptrace [siptrace.c:1677]: trace_send_hep_duplicate(): setting up
the socket_info
DEBUG: <script>: 542: WITHINDLG: loose_route set du='sip:172.16.23.130:5070
;lr;ftag=1029663405'
DEBUG: <script>: 369: RELAY ACK sip:8807@127.0.0.1:5080;transport=udp
[4194308]
DEBUG: tm [t_lookup.c:1312]: t_newtran(): DEBUG: t_newtran: msg id=4 ,
global msg id=3 , T on entrance=0xffffffff
DEBUG: tm [t_lookup.c:466]: t_lookup_request(): t_lookup_request: start
searching: hash=34522, isACK=1
DEBUG: tm [t_lookup.c:424]: matching_3261(): DEBUG: *RFC3261 transaction
matching failed*
DEBUG: tm [t_lookup.c:648]: t_lookup_request(): DEBUG: t_lookup_request: no
transaction found
DEBUG: tm [t_funcs.c:279]: t_relay_to(): SER: forwarding ACK statelessly
DEBUG: <script>: 821:172.16.23.130:5060 --> 172.16.23.130:5070 ACK
sip:8807@127.0.0.1:5080;transport=udp
Regards,
Seudin Kasumovic
Hi,
A bulk registration has been added to the "location" table:*************************** 1. row *************************** id: 113 ruid: uloc-55808d5a-33bc-1 username: pbx domain: NULL contact: sip:pbx@10.10.10.157:5060;bnc received: NULL path: NULL expires: 2015-06-17 10:08:42 q: -1.00 callid: 1-15061(a)10.10.10.157 cseq: 2last_modified: 2015-06-17 09:08:42 flags: 0 cflags: 0 user_agent: SIPp/Win32 socket: udp:10.10.10.160:5060 methods: NULL instance: NULL reg_id: 01 row in set (0.00 sec)
An outgoing call (SIPOUT) is made from a 10-digit number of the pbx:
Request-Line: INVITE sip:9191111111@example.net:5060 SIP/2.0From: sipp <sip:8181111111@home.net>;tag=1To: <sip:9191111111@example.net:5060>Proxy-Authorization: Digest username="pbx",realm="myhome.net",uri="sip:10.10.10.160:5060",nonce="???",response="??",algorithm=MD5
Even though I changed the value of $fU to "pbx", Kamailio does not authenticate the username and response with a 407 "Proxy Auth Required" response:
route[AUTH] {... if (is_method("REGISTER") || from_uri==myself) { # authenticate requests $var(fU) = $fU; $fU = "pbx"; if (!auth_check("$fd", "subscriber", "1")) { auth_challenge("$fd", "0"); exit; } # user authenticated - remove auth header if(!is_method("REGISTER|PUBLISH")) consume_credentials(); } ... $fU = $var(fU);
#!endif return;}
Is this the correct approach to process outgoing call for bulk registration username?Any help in this regard would be greatly appreciated
Thanks,Al
Hello,
I am running across the same issue as described here:
http://lists.sip-router.org/pipermail/sr-users/2015-February/086796.html
Was there a resolution to this issue? I come across this issue fairly regularly. Unlike the OP, however, I do not have any luck by retrying my query: when I place my http_query within a while loop and keep 1-second delays between calls, all consistently fail with error 28. After long pauses, http_query()s start to work as expected.
I think that previous thread mentions DNS as a possible culprit. Is http_query using libcurl's preferred resolver, or is it using Kamailio's built-in DNS cache? I really doubt my local resolver is cause of the issue here.
Any insight is appreciated. Thanks!
Armen