... | ... |
@@ -274,8 +274,6 @@ modparam("ims_auth", "max_nonce_reuse", 1) |
274 | 274 |
</example> |
275 | 275 |
</section> |
276 | 276 |
|
277 |
- </section> |
|
278 |
- |
|
279 | 277 |
<section> |
280 | 278 |
<title><varname>add_authinfo_hdr</varname> (integer)</title> |
281 | 279 |
|
... | ... |
@@ -404,8 +402,8 @@ modparam("ims_auth", "av_check_only_impu", 1) |
404 | 402 |
<programlisting format="linespecific"> |
405 | 403 |
... |
406 | 404 |
if (!www_authorize("kamailio.org", "subscriber")) { |
407 |
- www_challenge("kamailio.org", "1"); |
|
408 |
-}; |
|
405 |
+ www_challenge(""REG_MAR_REPLY"", "kamailio.org", "1"); |
|
406 |
+}; |
|
409 | 407 |
... |
410 | 408 |
</programlisting> |
411 | 409 |
</example> |
... | ... |
@@ -421,7 +419,7 @@ if (!www_authorize("kamailio.org", "subscriber")) { |
421 | 419 |
</section> |
422 | 420 |
|
423 | 421 |
<section> |
424 |
- <title><function moreinfo="none">ims_www_challenge(realm, |
|
422 |
+ <title><function moreinfo="none">ims_www_challenge(route_block, realm, |
|
425 | 423 |
table)</function></title> |
426 | 424 |
|
427 | 425 |
<para>Name alias: proxy_authorize(realm, table)</para> |
... | ... |
@@ -441,6 +439,9 @@ if (!www_authorize("kamailio.org", "subscriber")) { |
441 | 439 |
<para>Meaning of the parameters is as follows:</para> |
442 | 440 |
|
443 | 441 |
<itemizedlist> |
442 |
+ <listitem> |
|
443 |
+ <para>Route block to resume after async MAR Diameter reply.</para> |
|
444 |
+ </listitem> |
|
444 | 445 |
<listitem> |
445 | 446 |
<para><emphasis>realm</emphasis> - Realm is a opaque string that the |
446 | 447 |
user agent should present to the user so he can decide what username |
... | ... |
@@ -472,15 +473,39 @@ if (!www_authorize("kamailio.org", "subscriber")) { |
472 | 473 |
<programlisting format="linespecific"> |
473 | 474 |
... |
474 | 475 |
if (!proxy_authorize("$fd", "subscriber)) { |
475 |
- proxy_challenge("$fd", "1"); # Realm will be autogenerated |
|
476 |
+ proxy_challenge(""REG_MAR_REPLY","$fd"); # Realm will be autogenerated |
|
476 | 477 |
}; |
477 | 478 |
... |
479 |
+ ... |
|
480 |
+route[REG_MAR_REPLY] |
|
481 |
+{ |
|
482 |
+ #this is async so to know status we have to check the reply avp |
|
483 |
+ xlog("L_DBG","maa_return code is $avp(s:maa_return_code)\n"); |
|
484 |
+ |
|
485 |
+ switch ($avp(s:maa_return_code)){ |
|
486 |
+ case 1: #success |
|
487 |
+ xlog("L_DBG", "MAR success - 401/407 response sent from module\n"); |
|
488 |
+ break; |
|
489 |
+ case -1: #failure |
|
490 |
+ xlog("L_ERR", "MAR failure - error response sent from module\n"); |
|
491 |
+ break; |
|
492 |
+ case -2: #error |
|
493 |
+ xlog("L_ERR", "MAR error - sending error response now\n"); |
|
494 |
+ t_reply("500", "MAR failed"); |
|
495 |
+ break; |
|
496 |
+ default: |
|
497 |
+ xlog("L_ERR", "Unknown return code from MAR, value is [$avp(s:uaa_return_code)]\n"); |
|
498 |
+ t_reply("500", "Unknown response code from MAR"); |
|
499 |
+ break; |
|
500 |
+ } |
|
501 |
+ exit; |
|
502 |
+} |
|
478 | 503 |
</programlisting> |
479 | 504 |
</example> |
480 | 505 |
</section> |
481 | 506 |
|
482 | 507 |
<section> |
483 |
- <title><function moreinfo="none">ims_proxy_challenge(realm, |
|
508 |
+ <title><function moreinfo="none">ims_proxy_challenge(route_block, realm, |
|
484 | 509 |
table)</function></title> |
485 | 510 |
|
486 | 511 |
<para>Name alias: proxy_authorize(realm, table)</para> |
... | ... |
@@ -500,6 +525,9 @@ if (!proxy_authorize("$fd", "subscriber)) { |
500 | 525 |
<para>Meaning of the parameters is as follows:</para> |
501 | 526 |
|
502 | 527 |
<itemizedlist> |
528 |
+ <listitem> |
|
529 |
+ <para>Route block to resume after async MAR Diameter reply.</para> |
|
530 |
+ </listitem> |
|
503 | 531 |
<listitem> |
504 | 532 |
<para><emphasis>realm</emphasis> - Realm is a opaque string that the |
505 | 533 |
user agent should present to the user so he can decide what username |
... | ... |
@@ -531,9 +559,33 @@ if (!proxy_authorize("$fd", "subscriber)) { |
531 | 559 |
<programlisting format="linespecific"> |
532 | 560 |
... |
533 | 561 |
if (!proxy_authorize("$fd", "subscriber)) { |
534 |
- proxy_challenge("$fd", "1"); # Realm will be autogenerated |
|
562 |
+ proxy_challenge("REG_MAR_REPLY","$fd", "1"); # Realm will be autogenerated |
|
535 | 563 |
}; |
536 | 564 |
... |
565 |
+route[REG_MAR_REPLY] |
|
566 |
+{ |
|
567 |
+ #this is async so to know status we have to check the reply avp |
|
568 |
+ xlog("L_DBG","maa_return code is $avp(s:maa_return_code)\n"); |
|
569 |
+ |
|
570 |
+ switch ($avp(s:maa_return_code)){ |
|
571 |
+ case 1: #success |
|
572 |
+ xlog("L_DBG", "MAR success - 401/407 response sent from module\n"); |
|
573 |
+ break; |
|
574 |
+ case -1: #failure |
|
575 |
+ xlog("L_ERR", "MAR failure - error response sent from module\n"); |
|
576 |
+ break; |
|
577 |
+ case -2: #error |
|
578 |
+ xlog("L_ERR", "MAR error - sending error response now\n"); |
|
579 |
+ t_reply("500", "MAR failed"); |
|
580 |
+ break; |
|
581 |
+ default: |
|
582 |
+ xlog("L_ERR", "Unknown return code from MAR, value is [$avp(s:uaa_return_code)]\n"); |
|
583 |
+ t_reply("500", "Unknown response code from MAR"); |
|
584 |
+ break; |
|
585 |
+ } |
|
586 |
+ exit; |
|
587 |
+} |
|
588 |
+... |
|
537 | 589 |
</programlisting> |
538 | 590 |
</example> |
539 | 591 |
</section> |