Module: kamailio
Branch: master
Commit: 6389c98d29eeb7f61547bb68ec9d59e4f47b7552
URL: https://github.com/kamailio/kamailio/commit/6389c98d29eeb7f61547bb68ec9d59e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-11-15T20:58:31+01:00
dispatcher: docs for xavp_dst_mode to store socket string in dst xavp
---
Modified: src/modules/dispatcher/doc/dispatcher_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/6389c98d29eeb7f61547bb68ec9d59e…
Patch: https://github.com/kamailio/kamailio/commit/6389c98d29eeb7f61547bb68ec9d59e…
---
diff --git a/src/modules/dispatcher/doc/dispatcher_admin.xml b/src/modules/dispatcher/doc/dispatcher_admin.xml
index 94e7062705..79da1e8b07 100644
--- a/src/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/src/modules/dispatcher/doc/dispatcher_admin.xml
@@ -344,10 +344,15 @@ modparam("dispatcher", "force_dst", 1)
sock - the socket pointer.
</listitem>
<listitem>
+ socket - the socket string - it iadded only if xavp_dst_mode has bit 2 set
+ (value 2).
+ </listitem>
+ <listitem>
dstid - the destination unique id (in case of call load distribution algorithm).
</listitem>
<listitem>
- attrs - the attributes - they are added if xavp_dst_mode does not have the bit 1 set.
+ attrs - the attributes - they are added if xavp_dst_mode does not have
+ the bit 1 set (value 1).
</listitem>
</itemizedlist>
</para>
@@ -358,11 +363,13 @@ modparam("dispatcher", "force_dst", 1)
</para>
<example>
<title>Set the <quote>xavp_dst_mode</quote> parameter</title>
- <programlisting format="linespecific">
- ...
- modparam("dispatcher", "xavp_dst_mode", 1)
- ...
- </programlisting>
+<programlisting format="linespecific">
+...
+ modparam("dispatcher", "xavp_dst_mode", 1)
+...
+ modparam("dispatcher", "xavp_dst_mode", 2)
+...
+</programlisting>
</example>
</section>
<section id="dispatcher.p.xavp_ctx">
Greetings,
I'm using the delete record feature as described in section 9.2.9
<http://www.asipto.com/pub/kamailio-devel-guide/#c09f_delete> of the
Kamailio SIP Server v3.2.0 Development Guide. When I try to delete the
entire table without any filtering, as shown in the code below, DB_REDIS
fails. Is this a bug?
Thank you in advance for your help,
Bob
*Log*
DEBUG: db_redis [redis_connection.c:118]: db_redis_connect(): connecting to
redis at 127.0.0.1:6379
DEBUG: db_redis [redis_connection.c:171]: db_redis_connect(): connection
opened to redis://127.0.0.1:6379/5
DEBUG: db_redis [redis_connection.c:232]: db_redis_new_connection():
connection opened to redis://127.0.0.1:6379/5
DEBUG: db_redis [redis_dbase.c:2019]: db_redis_delete(): deleting from
prefix (table) 'mohqcalls'
DEBUG: db_redis [redis_dbase.c:524]: db_redis_build_query_keys(): build
query keys
DEBUG: db_redis [redis_dbase.c:295]: db_redis_find_query_key(): checking
for existence of entry key 'call_id' in query
DEBUG: db_redis [redis_dbase.c:306]: db_redis_find_query_key(): found key
in entry key
DEBUG: db_redis [redis_dbase.c:123]: db_redis_val2str(): converting string
value 'a1960c88-640f2e0f-bf639d1a(a)10.197.126.143' with len 41 to str
DEBUG: db_redis [redis_dbase.c:338]: db_redis_find_query_key(): entry key
so far is 'mohqcalls:entry::a1960c88-640f2e0f-bf639d1a@10.197.126.143'
DEBUG: db_redis [redis_dbase.c:543]: db_redis_build_query_keys(): found
suitable entry key '
mohqcalls:entry::a1960c88-640f2e0f-bf639d1a@10.197.126.143' for query
DEBUG: db_redis [redis_dbase.c:617]: db_redis_build_query_keys(): building
manual keys
DEBUG: db_redis [redis_dbase.c:254]: db_redis_build_entry_manual_keys():
checking for existence of entry key 'call_id' in query to get manual key
DEBUG: db_redis [redis_dbase.c:259]: db_redis_build_entry_manual_keys():
found key in entry key
DEBUG: db_redis [redis_dbase.c:1297]: db_redis_perform_delete(): delete all
keys
DEBUG: db_redis [redis_dbase.c:1303]: db_redis_perform_delete(): delete key
'mohqcalls:entry::a1960c88-640f2e0f-bf639d1a@10.197.126.143'
DEBUG: db_redis [redis_connection.c:32]: print_query(): Query dump:
DEBUG: db_redis [redis_connection.c:34]: print_query(): EXISTS
DEBUG: db_redis [redis_connection.c:34]: print_query():
mohqcalls:entry::a1960c88-640f2e0f-bf639d1a@10.197.126.143
DEBUG: db_redis [redis_table.c:154]: db_redis_key_list2arr(): returning 2
entries
DEBUG: db_redis [redis_connection.c:279]: db_redis_command_argv(): query
has 2 args
DEBUG: db_redis [redis_connection.c:32]: print_query(): Query dump:
DEBUG: db_redis [redis_connection.c:34]: print_query(): HMGET
DEBUG: db_redis [redis_connection.c:34]: print_query():
mohqcalls:entry::a1960c88-640f2e0f-bf639d1a@10.197.126.143
DEBUG: db_redis [redis_table.c:154]: db_redis_key_list2arr(): returning 2
entries
DEBUG: db_redis [redis_connection.c:279]: db_redis_command_argv(): query
has 2 args
ERROR: db_redis [redis_dbase.c:1352]: db_redis_perform_delete(): Failed to
fetch type entry: ERR wrong number of arguments for 'hmget' command
ERROR: db_redis [redis_dbase.c:1460]: db_redis_perform_delete(): failed to
perform the delete
ERROR: db_redis [redis_dbase.c:2076]: db_redis_delete(): failed to do the
query
WARNING: mohqueue [mohq_db.c:278]: delete_call_rec(): delete_call_rec:
Unable to delete row from mohqcalls
*Code*
db_func_t *pdb = pmod_data->pdb;
pdb->use_table (pconn, &pmod_data->pcfg->db_ctable);
if (pdb->delete (pconn, 0, 0, 0, 0) < 0)
{
LM_WARN ("%sUnable to delete all rows from %s\n", pfncname,
pmod_data->pcfg->db_ctable.s);
}
<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests.
If you have questions about using Kamailio or related to its configuration file,
ask on sr-users mailing list:
* http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing
C code, ask on sr-dev mailing list
* http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Please try to fill this template as much as possible for any issue. It helps the
developers to troubleshoot the issue.
If you submit a feature request (or enhancement), you can delete the text of
the template and only add the description of what you would like to be added.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment).
-->
### Description
<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
I received a wireshark trace from a team member showing that a tel: uri was translated to a sip: uri in a very strange (invalid) way:
INVITE tel:491234567891;phone-context=ims.mnc001.mcc001.3gppnetwork.org
Was translated to:
INVITE sip:491234567891;phone-context=ims.mnc001.mcc001.3gppnetwork.org@ims.mnc001.mcc001.3gppnetwork.org;user=phone
### Troubleshooting
I first thought this was definitely an error, and only the phone number should be copied to the sip: uri. But, on further reading of the specification, (https://www.ietf.org/rfc/rfc3261.txt), I see that it is in fact legal to leave all parameters in. Though, when the phone-context parameter is simply a domain, it would at least seem the cleanest thing would be to remove it when the exact same domain is also inserted after the @ in the sip message.
So, looking to find where the message is translated, I saw in the scscf.cfg configuration file that there is a translation specified.
I found that "tel2sip" is mapped to the C function of the same name tel2sip()
In this function, the translation will do exactly what I found in the trace, in other words, it will leave in all parameters separated by semi-colon, inserted before the @ symbol.
But, reading the spec, I see that the spec is not being followed in any case. The spec states that all parameters included when translating, must be switched to alphabetic order, with the exception that
isdn-subaddress and post-dial, must occur first and in that order. There is no code in tel2sip() to perform that sorting.
Also, the parser removes '(', ')', '.', and '-' in the phone number, as specified, but, these same characters could be scattered anywhere in invalid places, and they are just silently removed, '+' can scattered anywhere and it is just left alone, Other characters can be scattered anywhere and they will just be left as-is, no error. So, I feel there should be some minimal checking of the phone number, trying to follow the spec (if we could just execute the BNF from the spec!).
#### Reproduction
<!--
If the issue can be reproduced, describe how it can be done.
-->
This can be reproduced by sending a tel: uri with parameters inserted separated by semicolon.
#### Debugging Data
<!--
If you got a core dump, use gdb to extract troubleshooting data - full backtrace,
local variables and the list of the code at the issue location.
gdb /path/to/kamailio /path/to/corefile
bt full
info locals
list
If you are familiar with gdb, feel free to attach more of what you consider to
be relevant.
-->
```
(none)
```
#### Log Messages
<!--
Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->
```
(none)
```
#### SIP Traffic
<!--
If the issue is exposed by processing specific SIP messages, grab them with ngrep or save in a pcap file, then add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->
```
See attached file
```
### Possible Solutions
<!--
If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix.
-->
The solution would be to modify tel2sip(), adding the sorting of parameters, putting the two exceptions first if they exist, before inserting back into the string.
We should also throw errors on obvious bad formatting and ilegal characters, etc, in the input tel: uri
Should we remove the "phone-context" if it is a domain and also exactly the same as the domain inserted after the @?
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.0.0-dev5 (x86_64/linux) da4ef4-dirty
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: da4ef4 -dirty
compiled on 10:37:40 May 12 2017 with gcc 5.4.0
```
SIP spec:
https://www.ietf.org/rfc/rfc3261.txtWireshark output:
![wireshark-tel2sip](https://user-images.githubusercontent.com/4886876/27705203-cfd3c150-5cd2-11e7-9f77-1664a51e7ac3.png)
```
In RFC 3966, Tel URI format:
The "tel" URI has the following syntax:
telephone-uri = "tel:" telephone-subscriber
telephone-subscriber = global-number / local-number
global-number = global-number-digits *par
local-number = local-number-digits *par context *par
par = parameter / extension / isdn-subaddress
isdn-subaddress = ";isub=" 1*uric
extension = ";ext=" 1*phonedigit
context = ";phone-context=" descriptor
descriptor = domainname / global-number-digits
global-number-digits = "+" *phonedigit DIGIT *phonedigit
local-number-digits =
*phonedigit-hex (HEXDIG / "*" / "#")*phonedigit-hex
domainname = *( domainlabel "." ) toplabel [ "." ]
domainlabel = alphanum
/ alphanum *( alphanum / "-" ) alphanum
toplabel = ALPHA / ALPHA *( alphanum / "-" ) alphanum
parameter = ";" pname ["=" pvalue ]
pname = 1*( alphanum / "-" )
pvalue = 1*paramchar
paramchar = param-unreserved / unreserved / pct-encoded
unreserved = alphanum / mark
mark = "-" / "_" / "." / "!" / "~" / "*" /
"'" / "(" / ")"
pct-encoded = "%" HEXDIG HEXDIG
param-unreserved = "[" / "]" / "/" / ":" / "&" / "+" / "$"
phonedigit = DIGIT / [ visual-separator ]
phonedigit-hex = HEXDIG / "*" / "#" / [ visual-separator ]
visual-separator = "-" / "." / "(" / ")"
alphanum = ALPHA / DIGIT
reserved = ";" / "/" / "?" / ":" / "@" / "&" /
"=" / "+" / "$" / ","
uric = reserved / unreserved / pct-encoded
```
* **Operating System**:
<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `uname -a`)
-->
```
# uname -a
Linux epc-enablers 4.4.0-51-generic #72-Ubuntu SMP Thu Nov 24 18:29:54 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1173