Make number not available presentation also set screening to network provided.
authorRichard Mudgett <rmudgett@digium.com>
Sat, 24 Mar 2012 00:40:51 +0000 (00:40 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Sat, 24 Mar 2012 00:40:51 +0000 (00:40 +0000)
Q.951 indicates that when the presentation indicator is "Number not
available due to interworking" for a number then the screening indicator
field should be "Network provided".

* Made ast_party_id_presentation() return AST_PRES_NUMBER_NOT_AVAILABLE
when the presentation is "Number not available due to interworking".  This
fix makes Asterisk consistent and it also makes it consistent with earlier
branches as far as this presentation value is concerned.

* Made pri_to_ast_presentation() and ast_to_pri_presentation() conversions
handle the "Number not available due to interworking" case better in
sig_pri.c.  This change is possible because the minimum required libpri
version (v1.4.11) has the necessary defines in libpri.h.
........

Merged revisions 360309 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 360310 from http://svn.asterisk.org/svn/asterisk/branches/10

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360311 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/sig_pri.c
main/channel.c

index feb86fd..96bb03f 100644 (file)
@@ -447,35 +447,41 @@ static int pri_to_ast_presentation(int pri_presentation)
        int ast_presentation;
 
        switch (pri_presentation) {
-       case PRES_ALLOWED_USER_NUMBER_NOT_SCREENED:
-               ast_presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
+       case PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_UNSCREENED:
+               ast_presentation = AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_UNSCREENED;
                break;
-       case PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN:
-               ast_presentation = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
+       case PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_PASSED_SCREEN:
+               ast_presentation = AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_PASSED_SCREEN;
                break;
-       case PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN:
-               ast_presentation = AST_PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN;
+       case PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_FAILED_SCREEN:
+               ast_presentation = AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_FAILED_SCREEN;
                break;
-       case PRES_ALLOWED_NETWORK_NUMBER:
-               ast_presentation = AST_PRES_ALLOWED_NETWORK_NUMBER;
+       case PRI_PRES_ALLOWED | PRI_PRES_NETWORK_NUMBER:
+               ast_presentation = AST_PRES_ALLOWED | AST_PRES_NETWORK_NUMBER;
                break;
-       case PRES_PROHIB_USER_NUMBER_NOT_SCREENED:
-               ast_presentation = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
+
+       case PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED:
+               ast_presentation = AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED;
                break;
-       case PRES_PROHIB_USER_NUMBER_PASSED_SCREEN:
-               ast_presentation = AST_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN;
+       case PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_PASSED_SCREEN:
+               ast_presentation = AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_PASSED_SCREEN;
                break;
-       case PRES_PROHIB_USER_NUMBER_FAILED_SCREEN:
-               ast_presentation = AST_PRES_PROHIB_USER_NUMBER_FAILED_SCREEN;
+       case PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_FAILED_SCREEN:
+               ast_presentation = AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_FAILED_SCREEN;
                break;
-       case PRES_PROHIB_NETWORK_NUMBER:
-               ast_presentation = AST_PRES_PROHIB_NETWORK_NUMBER;
+       case PRI_PRES_RESTRICTED | PRI_PRES_NETWORK_NUMBER:
+               ast_presentation = AST_PRES_RESTRICTED | AST_PRES_NETWORK_NUMBER;
                break;
-       case PRES_NUMBER_NOT_AVAILABLE:
+
+       case PRI_PRES_UNAVAILABLE | PRI_PRES_USER_NUMBER_UNSCREENED:
+       case PRI_PRES_UNAVAILABLE | PRI_PRES_USER_NUMBER_PASSED_SCREEN:
+       case PRI_PRES_UNAVAILABLE | PRI_PRES_USER_NUMBER_FAILED_SCREEN:
+       case PRI_PRES_UNAVAILABLE | PRI_PRES_NETWORK_NUMBER:
                ast_presentation = AST_PRES_NUMBER_NOT_AVAILABLE;
                break;
+
        default:
-               ast_presentation = AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
+               ast_presentation = AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED;
                break;
        }
 
@@ -496,35 +502,41 @@ static int ast_to_pri_presentation(int ast_presentation)
        int pri_presentation;
 
        switch (ast_presentation) {
-       case AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED:
-               pri_presentation = PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
+       case AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_UNSCREENED:
+               pri_presentation = PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_UNSCREENED;
                break;
-       case AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN:
-               pri_presentation = PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
+       case AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_PASSED_SCREEN:
+               pri_presentation = PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_PASSED_SCREEN;
                break;
-       case AST_PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN:
-               pri_presentation = PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN;
+       case AST_PRES_ALLOWED | AST_PRES_USER_NUMBER_FAILED_SCREEN:
+               pri_presentation = PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_FAILED_SCREEN;
                break;
-       case AST_PRES_ALLOWED_NETWORK_NUMBER:
-               pri_presentation = PRES_ALLOWED_NETWORK_NUMBER;
+       case AST_PRES_ALLOWED | AST_PRES_NETWORK_NUMBER:
+               pri_presentation = PRI_PRES_ALLOWED | PRI_PRES_NETWORK_NUMBER;
                break;
-       case AST_PRES_PROHIB_USER_NUMBER_NOT_SCREENED:
-               pri_presentation = PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
+
+       case AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_UNSCREENED:
+               pri_presentation = PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
                break;
-       case AST_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN:
-               pri_presentation = PRES_PROHIB_USER_NUMBER_PASSED_SCREEN;
+       case AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_PASSED_SCREEN:
+               pri_presentation = PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_PASSED_SCREEN;
                break;
-       case AST_PRES_PROHIB_USER_NUMBER_FAILED_SCREEN:
-               pri_presentation = PRES_PROHIB_USER_NUMBER_FAILED_SCREEN;
+       case AST_PRES_RESTRICTED | AST_PRES_USER_NUMBER_FAILED_SCREEN:
+               pri_presentation = PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_FAILED_SCREEN;
                break;
-       case AST_PRES_PROHIB_NETWORK_NUMBER:
-               pri_presentation = PRES_PROHIB_NETWORK_NUMBER;
+       case AST_PRES_RESTRICTED | AST_PRES_NETWORK_NUMBER:
+               pri_presentation = PRI_PRES_RESTRICTED | PRI_PRES_NETWORK_NUMBER;
                break;
-       case AST_PRES_NUMBER_NOT_AVAILABLE:
+
+       case AST_PRES_UNAVAILABLE | AST_PRES_USER_NUMBER_UNSCREENED:
+       case AST_PRES_UNAVAILABLE | AST_PRES_USER_NUMBER_PASSED_SCREEN:
+       case AST_PRES_UNAVAILABLE | AST_PRES_USER_NUMBER_FAILED_SCREEN:
+       case AST_PRES_UNAVAILABLE | AST_PRES_NETWORK_NUMBER:
                pri_presentation = PRES_NUMBER_NOT_AVAILABLE;
                break;
+
        default:
-               pri_presentation = PRES_PROHIB_USER_NUMBER_NOT_SCREENED;
+               pri_presentation = PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
                break;
        }
 
index c1e24df..233acc7 100644 (file)
@@ -1949,6 +1949,9 @@ int ast_party_id_presentation(const struct ast_party_id *id)
        if (name_priority < number_priority) {
                number_value = name_value;
        }
+       if (number_value == AST_PRES_UNAVAILABLE) {
+               return AST_PRES_NUMBER_NOT_AVAILABLE;
+       }
 
        return number_value | number_screening;
 }