Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diversion header #81

Open
BceBoJlog opened this issue Jul 27, 2021 · 9 comments
Open

Diversion header #81

BceBoJlog opened this issue Jul 27, 2021 · 9 comments

Comments

@BceBoJlog
Copy link

BceBoJlog commented Jul 27, 2021

Hi!
Sniffer parses and adds numbers to the database only from the URIs of the "From" and "To" headers.
The numbers from the "Diversion" headers are not analyzed and are not written to the database.
As a result, it is impossible to find calls by the forwarding number in the database and analyze all calls forwarded from the required number.

@stuart-edge
Copy link

In my case, the call with a diversion header is completely ignored.
Scenario: 61272091827 called 0414674199 and was diverted to 61294964040

INVITE sip:[email protected];user=phone SIP/2.0
Max-Forwards: 70
Session-Expires: 3600;refresher=uac
Min-SE: 600
Supported: 100rel,timer
To: sip:[email protected];user=phone
From: sip:[email protected];tag=3871712453-1200387854
P-Asserted-Identity: sip:[email protected];user=phone
Call-ID: [email protected]
CSeq: 1 INVITE
Allow: PUBLISH,MESSAGE,UPDATE,PRACK,SUBSCRIBE,REFER,INFO,NOTIFY,REGISTER,OPTIONS,BYE,INVITE,ACK,CANCEL
Via: SIP/2.0/UDP 203.134.21.10:5060;branch=z9hG4bK1d765e14f40bac7a5014e9b4b395b868
Contact: sip:[email protected]:5060;tgrp=C20-OLC1BQBNCVC
Diversion: sip:[email protected];reason=no-answer;privacy=off;counter=1
Content-Type: application/sdp
Accept: application/sdp
Content-Length: 365

@voipmonitor
Copy link
Owner

hi please attach pcap

@stuart-edge
Copy link

61272091827-61414674199-61294964040.zip

I have some entries in filter_telnum. I tried adding two more entries to cover the numbers in the diversion header but it didn't make any difference.
mysql> select * from filter_telnum;
+----+-------------+-----------+-----------+------+------+------+----------+------+-------+------+------+--------+---------+--------------+------+-----------+
| id | prefix | fixed_len | direction | rtp | rtcp | sip | register | dtmf | graph | wav | skip | script | mos_lqo | hide_message | note | remove_at |
+----+-------------+-----------+-----------+------+------+------+----------+------+-------+------+------+--------+---------+--------------+------+-----------+
| 49 | 61294964040 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | NULL | NULL |
| 50 | 61294964026 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | NULL | NULL |
| 51 | 61272091827 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | NULL | NULL |
| 52 | 0414674199 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | NULL | NULL |
+----+-------------+-----------+-----------+------+------+------+----------+------+-------+------+------+--------+---------+--------------+------+-----------+
4 rows in set (0.00 sec)

@stuart-edge
Copy link

I was having a look at rfc5806 (Diversion Indication in SIP)
If you were to add diversion information you would have to allow for multiple diversion headers.
See the second call in the attached pcap
Diversion: "Stuart Edge" sip:[email protected];reason="deflection";counter=2;privacy=off,"Test Phone" sip:[email protected];reason="unconditional";counter=1;privacy=off

call-4083-4044-0414674199.display.info.on.pcap.zip

To cover all the diversion details you may want add a new database table. EG. cdr_diversion
Perhaps something like this:
describe cdr_diversion;
+------------------+-----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+-----------------------+------+-----+---------+----------------+
| ID | bigint(20) unsigned | NO | PRI | NULL | auto_increment |
| cdr_ID | bigint(20) unsigned | NO | MUL | NULL | |
| diverter | varchar(255) | NO | | NULL | |
| diverter_domain | varchar(255) | NO | | NULL | |
| diverter_name | varchar(255) | NO | | NULL | |
| reason | varchar(255) | NO | | NULL | |
| counter | smallint(5) unsigned | YES | | NULL | |
| limit | smallint(5) unsigned | YES | | NULL | |
| privacy | varchar(255) | YES | | NULL | |
| screen | varchar(255) | YES | | NULL | |
| extension | varchar(255) | YES | | NULL | |
+------------------+-----------------------+------+-----+---------+----------------+

I am happy to help and provide further examples or help with whatever you need.

@voipmonitor
Copy link
Owner

within one sip session there can be multiple diversion headers with different content? Creating new table would be nice but it would be too much data if the only thing to extract and store would be the 61294964026 number?

@stuart-edge
Copy link

stuart-edge commented Sep 16, 2022

Yes, one SIP session can have multiple diversion headers with different content.
There are often multiple diversions.
There are multiple parameters in each diversion.
So a new database table would be the best way to record this information.

I have been dealing with this quite a lot during recent times. Australian carriers have been very strict on correct diversion information in an effort to reduce SPAM calls.
There are many spammers who use fake caller IDs to make calls.
If someone is attempting a call via a carrier and they do not own the caller ID they are using, the call is rejected.
EG.
If a call from a carrier A to carrier B arrives with a caller ID +61294964040 but carrier B recognises this call ID belongs to Carrier B, Carrier B will reject the call because the caller ID shouldn’t be coming from carrier A.
To avoid valid call being rejected, diversion headers must provide the path of the call.

In the scenario below:
61272091827 called 0493363501
0493363501 diverted (reason-no-answer) to 0414674199
0414674199 diverted (reason=unknown) to 61294964040

INVITE sip:[email protected];user=phone SIP/2.0
Max-Forwards: 70
Session-Expires: 3600;refresher=uac
Min-SE: 600
Supported: 100rel,timer
To: sip:[email protected];user=phone
From: sip:[email protected];tag=3872015738-350219619
P-Asserted-Identity: sip:[email protected];user=phone
Call-ID: [email protected]
CSeq: 1 INVITE
Allow: PUBLISH,MESSAGE,UPDATE,PRACK,SUBSCRIBE,REFER,INFO,NOTIFY,REGISTER,OPTIONS,BYE,INVITE,ACK,CANCEL
Via: SIP/2.0/UDP 203.134.5.10:5060;branch=z9hG4bKd8d3644ae6d77678a012416bc27a1cda
Contact: sip:[email protected]:5060;tgrp=C20-OLC1BQBNCVC
Diversion: sip:[email protected];reason=no-answer;privacy=off;counter=1
Diversion: sip:[email protected];reason=unknown;privacy=off;counter=1

Content-Type: application/sdp
Accept: application/sdp
Content-Length: 363

In a call centre environment we often see counter=2 (or 3) if the calls have been forward from agent to agent the externally.

@voipmonitor
Copy link
Owner

ok thank you. We have put it into the list of features which is quite long.

@stuart-edge
Copy link

stuart-edge commented Sep 20, 2022 via email

@stuart-edge
Copy link

stuart-edge commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants