Resources.DocsTipsFaqs History

Show minor edits - Show changes to markup

April 24, 2013, at 07:07 PM by 213.233.101.41 -
Changed lines 1-73 from:

Resources -> Documentation -> Tips and FAQa


(:toc-float Table of Content:)


Tips

How to do certain things.

How to recalculate ha1 and ha1b

When you change the domain column in the subscriber table, you have to recalculate ha1 and ha1b fields. In order to do that you must have the password of each subscriber. It is stored in the 'password' column if you have set STORE_PLAINTEXT_PW=1 in opensipsctlrc (default).

HA1 is a MD5 hash of "username:domain:password". For example, if you have created a SIP account 1000@mydomain.com using password 123456, then HA1 is the MD5 hash of "1000:mydomain.com:123456" (without quotes). On the other hand HA1B is the MD5 hash of "username@domain:domain:password"; so using the same example above, HA1B would be the MD5 hash of "1000@mydomain.com:mydomain.com:123456" (without quotes).

To recalculate and update ha1 and ha1b columns in the subscriber table, just execute the following sql statement in mysql:

update subscriber
set ha1 = md5(concat(username, ':', domain, ':', password)),
ha1b = md5(concat(username, '@', domain, ':', domain, ':', password))

Note: the above is only true if you have "use_domain" enabled for auth_db _and_ you do not use a static challenge parameter for www_authorize.

If you use a static challenge for www_authorize (i.e. the first parameter of www_authorize is not the empty string), then HA1 is MD5("username:challenge:password") and HA1B is MD5("username@challenge:challenge:password"). If the challenge parameter of www_authorize is empty, OpenSIPS automatically selects the domain as the challenge value, which gives the solution presented above.

If "use_domain" is false, then the HA1B field must be computed based on "username@:domain:password" or "username@:challenge:password", depending on whether challenge is empty or defined, respectively.

PHP example to communicate via mi_xmlrpc
#!/usr/bin/php
<?php
$params[] = "dialog:";
$params[] = "tm:";
$method = "get_statistics";
$request = xmlrpc_encode_request($method,$params);

$context = stream_context_create(array('http' => array(
   'method' => "POST",
   'header' => "Content-Type: text/xml",
   'content' => $request
)));
$file = file_get_contents("http://example.opensips.org:8080/RPC2", false, $context);
$response = xmlrpc_decode($file);
if (is_array($response)) {
   trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
   print_r($response);
}
?>
Add a new tip here

FAQS

Answers to the most frequent questions

Changing FROM header

Q) How does one change the FROM Header in OpenSIPS ?

A) Use the uac_replace_from() function in the uac module

Recalculating HA1 and HA1B hashes when adding a subscriber

Q) How do I re-calculate the ha1 and halb values in the subscriber table for a new subscriber?

A) Run the following mysql operation:

update subscriber set ha1 = md5(concat(username, ':', domain, ':', password)), ha1b = md5(concat(username, '@', domain, ':', domain, ':', password))

This will automatically update the ha1 and ha1b fields for all subscribers.

to:

(:redirect Documentation.TipsFAQ quiet=1 :)

February 09, 2011, at 06:28 AM by Tyler - added ha1 & ha1b tips
Changed lines 63-73 from:

A) Use the uac_replace_from() function in the uac module

to:

A) Use the uac_replace_from() function in the uac module

Recalculating HA1 and HA1B hashes when adding a subscriber

Q) How do I re-calculate the ha1 and halb values in the subscriber table for a new subscriber?

A) Run the following mysql operation:

update subscriber set ha1 = md5(concat(username, ':', domain, ':', password)), ha1b = md5(concat(username, '@', domain, ':', domain, ':', password))

This will automatically update the ha1 and ha1b fields for all subscribers.

March 15, 2010, at 11:10 AM by 81.180.102.217 -
Changed lines 1-63 from:

DgfLI4 <a href="http://rbkwkxmgkzwd.com/">rbkwkxmgkzwd</a>, [url=http://mhvxmuvsqwjt.com/]mhvxmuvsqwjt[/url], [link=http://tuzzngrmsryr.com/]tuzzngrmsryr[/link], http://rfvjvsrtwiis.com/

to:

Resources -> Documentation -> Tips and FAQa


(:toc-float Table of Content:)


Tips

How to do certain things.

How to recalculate ha1 and ha1b

When you change the domain column in the subscriber table, you have to recalculate ha1 and ha1b fields. In order to do that you must have the password of each subscriber. It is stored in the 'password' column if you have set STORE_PLAINTEXT_PW=1 in opensipsctlrc (default).

HA1 is a MD5 hash of "username:domain:password". For example, if you have created a SIP account 1000@mydomain.com using password 123456, then HA1 is the MD5 hash of "1000:mydomain.com:123456" (without quotes). On the other hand HA1B is the MD5 hash of "username@domain:domain:password"; so using the same example above, HA1B would be the MD5 hash of "1000@mydomain.com:mydomain.com:123456" (without quotes).

To recalculate and update ha1 and ha1b columns in the subscriber table, just execute the following sql statement in mysql:

update subscriber
set ha1 = md5(concat(username, ':', domain, ':', password)),
ha1b = md5(concat(username, '@', domain, ':', domain, ':', password))

Note: the above is only true if you have "use_domain" enabled for auth_db _and_ you do not use a static challenge parameter for www_authorize.

If you use a static challenge for www_authorize (i.e. the first parameter of www_authorize is not the empty string), then HA1 is MD5("username:challenge:password") and HA1B is MD5("username@challenge:challenge:password"). If the challenge parameter of www_authorize is empty, OpenSIPS automatically selects the domain as the challenge value, which gives the solution presented above.

If "use_domain" is false, then the HA1B field must be computed based on "username@:domain:password" or "username@:challenge:password", depending on whether challenge is empty or defined, respectively.

PHP example to communicate via mi_xmlrpc
#!/usr/bin/php
<?php
$params[] = "dialog:";
$params[] = "tm:";
$method = "get_statistics";
$request = xmlrpc_encode_request($method,$params);

$context = stream_context_create(array('http' => array(
   'method' => "POST",
   'header' => "Content-Type: text/xml",
   'content' => $request
)));
$file = file_get_contents("http://example.opensips.org:8080/RPC2", false, $context);
$response = xmlrpc_decode($file);
if (is_array($response)) {
   trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
   print_r($response);
}
?>
Add a new tip here

FAQS

Answers to the most frequent questions

Changing FROM header

Q) How does one change the FROM Header in OpenSIPS ?

A) Use the uac_replace_from() function in the uac module

March 14, 2010, at 05:01 PM by mbbezd - mbORAQUTMDI
March 14, 2010, at 05:01 PM by mbbezd - mbORAQUTMDI
Changed line 1 from:

kabdqZ <a href="http://fuqqsyayhdvj.com/">fuqqsyayhdvj</a>, [url=http://yavzsefbeuaj.com/]yavzsefbeuaj[/url], [link=http://fbzdpsfstuvc.com/]fbzdpsfstuvc[/link], http://lmfqsmvuhufc.com/

to:

DgfLI4 <a href="http://rbkwkxmgkzwd.com/">rbkwkxmgkzwd</a>, [url=http://mhvxmuvsqwjt.com/]mhvxmuvsqwjt[/url], [link=http://tuzzngrmsryr.com/]tuzzngrmsryr[/link], http://rfvjvsrtwiis.com/

March 14, 2010, at 03:00 PM by qqfkhhnj - rseOAfXzkKNnyRSFGi
Changed lines 1-63 from:

Resources -> Documentation -> Tips and FAQa


(:toc-float Table of Content:)


Tips

How to do certain things.

How to recalculate ha1 and ha1b

When you change the domain column in the subscriber table, you have to recalculate ha1 and ha1b fields. In order to do that you must have the password of each subscriber. It is stored in the 'password' column if you have set STORE_PLAINTEXT_PW=1 in opensipsctlrc (default).

HA1 is a MD5 hash of "username:domain:password". For example, if you have created a SIP account 1000@mydomain.com using password 123456, then HA1 is the MD5 hash of "1000:mydomain.com:123456" (without quotes). On the other hand HA1B is the MD5 hash of "username@domain:domain:password"; so using the same example above, HA1B would be the MD5 hash of "1000@mydomain.com:mydomain.com:123456" (without quotes).

To recalculate and update ha1 and ha1b columns in the subscriber table, just execute the following sql statement in mysql:

update subscriber
set ha1 = md5(concat(username, ':', domain, ':', password)),
ha1b = md5(concat(username, '@', domain, ':', domain, ':', password))

Note: the above is only true if you have "use_domain" enabled for auth_db _and_ you do not use a static challenge parameter for www_authorize.

If you use a static challenge for www_authorize (i.e. the first parameter of www_authorize is not the empty string), then HA1 is MD5("username:challenge:password") and HA1B is MD5("username@challenge:challenge:password"). If the challenge parameter of www_authorize is empty, OpenSIPS automatically selects the domain as the challenge value, which gives the solution presented above.

If "use_domain" is false, then the HA1B field must be computed based on "username@:domain:password" or "username@:challenge:password", depending on whether challenge is empty or defined, respectively.

PHP example to communicate via mi_xmlrpc
#!/usr/bin/php
<?php
$params[] = "dialog:";
$params[] = "tm:";
$method = "get_statistics";
$request = xmlrpc_encode_request($method,$params);

$context = stream_context_create(array('http' => array(
   'method' => "POST",
   'header' => "Content-Type: text/xml",
   'content' => $request
)));
$file = file_get_contents("http://example.opensips.org:8080/RPC2", false, $context);
$response = xmlrpc_decode($file);
if (is_array($response)) {
   trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
   print_r($response);
}
?>
Add a new tip here

FAQS

Answers to the most frequent questions

Changing FROM header

Q) How does one change the FROM Header in OpenSIPS ?

A) Use the uac_replace_from() function in the uac module

to:

kabdqZ <a href="http://fuqqsyayhdvj.com/">fuqqsyayhdvj</a>, [url=http://yavzsefbeuaj.com/]yavzsefbeuaj[/url], [link=http://fbzdpsfstuvc.com/]fbzdpsfstuvc[/link], http://lmfqsmvuhufc.com/

December 06, 2009, at 11:53 PM by NormB -
Changed line 44 from:

$file = file_get_contents("http://opensips.example.com:8080/RPC2", false, $context);

to:

$file = file_get_contents("http://example.opensips.org:8080/RPC2", false, $context);

December 06, 2009, at 11:48 PM by NormB -
Added line 17:

[@

Changed lines 21-22 from:
to:

@]

Added lines 30-52:
PHP example to communicate via mi_xmlrpc
#!/usr/bin/php
<?php
$params[] = "dialog:";
$params[] = "tm:";
$method = "get_statistics";
$request = xmlrpc_encode_request($method,$params);

$context = stream_context_create(array('http' => array(
   'method' => "POST",
   'header' => "Content-Type: text/xml",
   'content' => $request
)));
$file = file_get_contents("http://opensips.example.com:8080/RPC2", false, $context);
$response = xmlrpc_decode($file);
if (is_array($response)) {
   trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
   print_r($response);
}
?>
October 02, 2009, at 04:02 AM by Stéphane Alnet - Added comment about use_domain for ha1b
Added lines 21-26:

Note: the above is only true if you have "use_domain" enabled for auth_db _and_ you do not use a static challenge parameter for www_authorize.

If you use a static challenge for www_authorize (i.e. the first parameter of www_authorize is not the empty string), then HA1 is MD5("username:challenge:password") and HA1B is MD5("username@challenge:challenge:password"). If the challenge parameter of www_authorize is empty, OpenSIPS automatically selects the domain as the challenge value, which gives the solution presented above.

If "use_domain" is false, then the HA1B field must be computed based on "username@:domain:password" or "username@:challenge:password", depending on whether challenge is empty or defined, respectively.

July 10, 2009, at 07:21 PM by nesken -
Added lines 10-22:
How to recalculate ha1 and ha1b

When you change the domain column in the subscriber table, you have to recalculate ha1 and ha1b fields. In order to do that you must have the password of each subscriber. It is stored in the 'password' column if you have set STORE_PLAINTEXT_PW=1 in opensipsctlrc (default).

HA1 is a MD5 hash of "username:domain:password". For example, if you have created a SIP account 1000@mydomain.com using password 123456, then HA1 is the MD5 hash of "1000:mydomain.com:123456" (without quotes). On the other hand HA1B is the MD5 hash of "username@domain:domain:password"; so using the same example above, HA1B would be the MD5 hash of "1000@mydomain.com:mydomain.com:123456" (without quotes).

To recalculate and update ha1 and ha1b columns in the subscriber table, just execute the following sql statement in mysql:

update subscriber set ha1 = md5(concat(username, ':', domain, ':', password)), ha1b = md5(concat(username, '@', domain, ':', domain, ':', password))

Deleted line 23:
January 12, 2009, at 11:38 AM by 81.180.102.217 -
Changed lines 19-21 from:

How does one change the FROM Header in OpenSIPS ?

Use the uac_replace_from() function in the uac module

to:

Q) How does one change the FROM Header in OpenSIPS ?

A) Use the uac_replace_from() function in the uac module

January 12, 2009, at 11:38 AM by 81.180.102.217 -
Changed lines 17-19 from:

1) How does one change the FROM Header in OpenSIPS ?

A) Use the uac_replace_from() function in the uac module

to:
Changing FROM header

How does one change the FROM Header in OpenSIPS ?

Use the uac_replace_from() function in the uac module

January 12, 2009, at 11:32 AM by 122.169.104.151 -
Changed lines 17-18 from:
Add a new faq here
to:

1) How does one change the FROM Header in OpenSIPS ?

A) Use the uac_replace_from() function in the uac module

January 12, 2009, at 11:05 AM by 81.180.102.217 -
Changed line 1 from:

Resources -> Documentation -> Tips & FAQa

to:

Resources -> Documentation -> Tips and FAQa

January 12, 2009, at 11:05 AM by 81.180.102.217 -
Added lines 1-18:

Resources -> Documentation -> Tips & FAQa


(:toc-float Table of Content:)


Tips

How to do certain things.

Add a new tip here

FAQS

Answers to the most frequent questions

Add a new faq here

Page last modified on April 24, 2013, at 07:07 PM