aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-sip.c
diff options
context:
space:
mode:
authorAndersBroman <anders.broman@ericsson.com>2018-01-15 14:49:51 +0100
committerMichael Mann <mmann78@netscape.net>2018-01-15 14:34:57 +0000
commit1b9de188ff78beaaac89aca32ca0e0f98dd98503 (patch)
treea68809f62cd177259207c260bdcdeeaf3e1a9aa8 /epan/dissectors/packet-sip.c
parent282436a762927a5a5831c78de6133add25b5d566 (diff)
[SIP] Display tel uri in VoIP calls.
Change-Id: I0a4eb85abd75ed706ea519371f2c62b172c05297 Reviewed-on: https://code.wireshark.org/review/25326 Reviewed-by: Anders Broman <a.broman58@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-sip.c')
-rw-r--r--epan/dissectors/packet-sip.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index c8cdce855f..40ab998635 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -1285,9 +1285,18 @@ export_sip_pdu(packet_info *pinfo, tvbuff_t *tvb)
}
+typedef enum
+{
+ SIP_URI_TYPE_ABSOLUTE_URI,
+ SIP_URI_TYPE_SIP,
+ SIP_URI_TYPE_TEL
+
+} sip_uri_type_enum_t;
+
/* Structure to collect info about a sip uri */
typedef struct _uri_offset_info
{
+ sip_uri_type_enum_t uri_type;
gint display_name_start;
gint display_name_end;
gint uri_start;
@@ -1308,6 +1317,7 @@ static void
sip_uri_offset_init(uri_offset_info *uri_offsets){
/* Initialize the uri_offsets */
+ uri_offsets->uri_type = SIP_URI_TYPE_ABSOLUTE_URI;
uri_offsets->display_name_start = -1;
uri_offsets->display_name_end = -1;
uri_offsets->uri_start = -1;
@@ -1349,8 +1359,15 @@ dissect_sip_uri(tvbuff_t *tvb, packet_info *pinfo _U_, gint start_offset,
uri_offsets->uri_start = current_offset;
/* Check if it's really a sip uri ( it might be a tel uri, parse that?) */
- if (tvb_strneql(tvb, current_offset, "sip", 3) != 0)
+ if (tvb_strneql(tvb, current_offset, "sip", 3) != 0){
+ if (uri_offsets->uri_end != -1) {
+ /* We know where the URI ends, set the offsets*/
+ return uri_offsets->name_addr_end;
+ }
return -1;
+ }
+
+ uri_offsets->uri_type = SIP_URI_TYPE_SIP;
if(uri_offsets->uri_end == -1)
{
@@ -1680,6 +1697,7 @@ dissect_sip_p_charging_func_addresses(tvbuff_t *tvb, proto_tree* tree, packet_in
* name-addr = [ display-name ] LAQUOT addr-spec RAQUOT
* addr-spec = SIP-URI / SIPS-URI / absoluteURI
* display-name = *(token LWS)/ quoted-string
+ * absoluteURI = scheme ":" ( hier-part / opaque-part )
*/
static gint
@@ -1833,6 +1851,10 @@ display_sip_uri (tvbuff_t *tvb, proto_tree *sip_element_tree, packet_info *pinfo
tvb, uri_offsets->uri_start, uri_offsets->uri_end - uri_offsets->uri_start + 1, ENC_UTF_8|ENC_NA);
uri_item_tree = proto_item_add_subtree(ti, *(uri->ett_uri));
+ if (uri_offsets->uri_type != SIP_URI_TYPE_SIP) {
+ return ti;
+ }
+
if(uri_offsets->uri_user_end > uri_offsets->uri_user_start) {
proto_tree_add_item(uri_item_tree, *(uri->hf_sip_user), tvb, uri_offsets->uri_user_start,
uri_offsets->uri_user_end - uri_offsets->uri_user_start + 1, ENC_UTF_8|ENC_NA);
@@ -3496,7 +3518,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info
display_sip_uri(tvb, sip_element_tree, pinfo, &uri_offsets, &sip_to_uri);
if((uri_offsets.name_addr_start != -1) && (uri_offsets.name_addr_end != -1)){
stat_info->tap_to_addr=tvb_get_string_enc(wmem_packet_scope(), tvb, uri_offsets.name_addr_start,
- uri_offsets.name_addr_end - uri_offsets.name_addr_start, ENC_UTF_8|ENC_NA);
+ uri_offsets.name_addr_end - uri_offsets.name_addr_start + 1, ENC_UTF_8|ENC_NA);
}
offset = uri_offsets.name_addr_end +1;
}
@@ -3559,7 +3581,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info
display_sip_uri(tvb, sip_element_tree, pinfo, &uri_offsets, &sip_from_uri);
if((uri_offsets.name_addr_start != -1) && (uri_offsets.name_addr_end != -1)){
stat_info->tap_from_addr=tvb_get_string_enc(wmem_packet_scope(), tvb, uri_offsets.name_addr_start,
- uri_offsets.name_addr_end - uri_offsets.name_addr_start, ENC_UTF_8|ENC_NA);
+ uri_offsets.name_addr_end - uri_offsets.name_addr_start + 1, ENC_UTF_8|ENC_NA);
}
offset = uri_offsets.name_addr_end +1;
}