Skip to content

AUTH_DIAMETER module

This module implements SIP authentication and authorization with DIAMETER server, namely DIameter Server Client (DISC).

NOTE: diameter support was developed for DISC (DIameter Server Client project at http://developer.berlios.de/projects/disc/). This project seems to be no longer maintained and DIAMETER specifications were updated in the meantime. Thus, the module is obsolete and needs rework to be usable with opendiameter or other DIAMETER servers.

The digest authentication mechanism is presented in next figure.

Digest Authentication
...
a) First phase of Digest Authentication for SIP:
+----+ SIP INVITE +=====+ DIAMETER +------+ +------+
| | no Auth hdr #/////# AA-Request | | | |
| |---------1--->#/////#-------2------->| |---2-->| |
|UAC | #UAS//# |DClnt | |DSrv |
| |<-----4-------#(SER)#<------3--------|(DISC)|<--3---|(DISC)|
| | 401 #/////# DIAMETER | | | |
+----+ Unauthorized +=====+ AA-Answer +------+ +------+
Result-Code=4001
b) Second phase of Digest Authentication for SIP:
+----+ SIP INVITE +=====+ DIAMETER +------+ +----+
| | Auth hdr #/////# AA-Request | | | |
| |--------1---->#/////#-------2------>| |---2-->| |
|UAC | #UAS//# |DClnt | |DSrv|
| |<-------4-----#(SER)#<------3-------| |<--3---| |
| | 200 OK #/////# DIAMETER | | | |
+----+ +=====+ AA-Answer +------+ +----+
Result-Code=2001
...

The following modules must be loaded before this module:

  • sl - used to send stateless replies.

The following libraries or applications must be installed before running OpenSIPS with this module loaded:

  • None.

Hostname of the machine where the DIAMETER Client is running.

Default value is “localhost”.

Set diameter_client_host parameter
...
modparam("auth_diameter", "diameter_client_host", "10.10.10.10")
...

Port number where the DIAMETER Client is listening.

Default value is “3000”.

Set diameter_client_port parameter
...
modparam("auth_diameter", "diameter_client_port", 3000)
...

Specifies whether the domain name part of URI is used when checking the user’s privileges.

Default value is “0 (0==false and 1==true )”.

Set use_domain parameter
...
modparam("auth_diameter", "use_domain", 1)
...

SIP Server checks for authorization having a DIAMETER server in backend. If no credentials are provided inside the SIP request then a challenge is sent back to UAC. If the credentials don’t match the ones computed by DISC then “403 Forbidden” is sent back.

Negative codes may be interpreted as follows:

  • -5 (generic error) - some generic error occurred and no reply was sent out;
  • -3 (stale nonce) - stale nonce;

Meaning of the parameters is as follows:

  • realm - the realm to be use for authentication and authorization. The string may contain pseudo variables.

This function can be used from REQUEST_ROUTE.

diameter_www_authorize usage
...
if(!diameter_www_authorize("siphub.net"))
{ /* user is not authorized */
exit;
};
...

SIP Proxy checks for authorization having a DIAMETER server in backend. If no credentials are provided inside the SIP request then a challenge is sent back to UAC. If the credentials don’t match the ones computed by DISC then “403 Forbidden” is sent back. For more about the negative return codes, see the above function.

Meaning of the parameters is as follows:

  • realm - the realm to be use for authentication and authorization. The string may contain pseudo variables.

This function can be used from REQUEST_ROUTE.

diameter_proxy_authorize usage
...
if(!diameter_proxy_authorize("siphub.net"))
{ /* user is not authorized */
exit;
};
...

The method performs group membership checking with DISC.

Meaning of the parameters is as follows:

  • who - what header to be used to get the SIP URI that is wanted to be checked being member in a certain group. It can be: “Request-URI”, “From”, “To” or “Credentials”.
  • group - the group name where to check if the user is part of.

This function can be used from REQUEST_ROUTE.

diameter_is_user_in usage
...
if(!diameter_is_user_in("From", "voicemail"))
{ /* user is not authorized */
exit;
};
...

Notes about installation and running.

Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)

#NameDevScoreCommitsLines++Lines—
1.Elena-Ramona Modroiu364360716
2.Bogdan-Andrei Iancu (@bogdan-iancu)3019374392
3.Daniel-Constantin Mierla (@miconda)15135244
4.Stefan Darius (@dariusstefan)7327029
5.Andrei Pelinescu-Onciul531914
6.Henning Westerholt (@henningw)5377
7.Elena-Ramona Modroiu42193
8.Anatoly Pidruchny312523
9.Jan Janak (@janakj)312222
10.Razvan Crainea (@razvancrainea)3122

All remaining contributors: Konstantin Bokarius, Jesus Rodrigues, Edson Gellert Schubert.

(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)

(2) including any documentation-related commits, excluding merge commits

(3) ignoring whitespace edits, renamed files and auto-generated files

#NameCommit Activity
1.Stefan Darius (@dariusstefan)Jun 2026 - Jul 2026
2.Razvan Crainea (@razvancrainea)Jun 2026 - Jun 2026
3.Bogdan-Andrei Iancu (@bogdan-iancu)Sep 2003 - Nov 2008
4.Daniel-Constantin Mierla (@miconda)Nov 2006 - Mar 2008
5.Konstantin BokariusMar 2008 - Mar 2008
6.Edson Gellert SchubertFeb 2008 - Feb 2008
7.Elena-Ramona ModroiuOct 2005 - Feb 2008
8.Henning Westerholt (@henningw)Sep 2007 - Dec 2007
9.Jesus RodriguesDec 2007 - Dec 2007
10.Anatoly PidruchnyApr 2007 - Apr 2007

All remaining contributors: Jan Janak (@janakj), Andrei Pelinescu-Onciul, Elena-Ramona Modroiu.

(1) including any documentation-related commits, excluding merge commits

Last edited by: Razvan Crainea (@razvancrainea), Bogdan-Andrei Iancu (@bogdan-iancu), Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Elena-Ramona Modroiu, Henning Westerholt (@henningw), Anatoly Pidruchny, Elena-Ramona Modroiu.

All documentation files (i.e. .md extension) are licensed under the Creative Common License 4.0