]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 188647 via svnmerge from
authorDavid Vossel <dvossel@digium.com>
Wed, 15 Apr 2009 22:12:39 +0000 (22:12 +0000)
committerDavid Vossel <dvossel@digium.com>
Wed, 15 Apr 2009 22:12:39 +0000 (22:12 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

................
  r188647 | dvossel | 2009-04-15 17:10:04 -0500 (Wed, 15 Apr 2009) | 18 lines

  Merged revisions 188646 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.4

  ........
    r188646 | dvossel | 2009-04-15 17:08:40 -0500 (Wed, 15 Apr 2009) | 12 lines

    National prefix inserted even when caller ID not available

    When the caller ID is restricted, the expected behavior is for the caller id to be blank.  In chan_dahdi, the national prefix is placed onto the callers number even if its restricted (empty) causing the caller id to be the national prefix rather than blank.

    (closes issue #13207)
    Reported by: shawkris
    Patches:
          national_prefix.diff uploaded by dvossel (license 671)

    Review: http://reviewboard.digium.com/r/220/
  ........
................

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

channels/chan_dahdi.c

index 18142b7a20c0d83e51cc2774f33b2cd1a4a97eb4..50ccb22ace09ad1dceb032efd689af793a732144 100644 (file)
@@ -9887,6 +9887,12 @@ static void ss7_start_call(struct dahdi_pvt *p, struct dahdi_ss7 *linkset)
 
 static void ss7_apply_plan_to_number(char *buf, size_t size, const struct dahdi_ss7 *ss7, const char *number, const unsigned nai)
 {
+       if (ast_strlen_zero(number)) { /* make sure a number exists so prefix isn't placed on an empty string */
+               if (size) {
+                       *buf = '\0';
+               }
+               return;
+       }
        switch (nai) {
        case SS7_NAI_INTERNATIONAL:
                snprintf(buf, size, "%s%s", ss7->internationalprefix, number);
@@ -10792,6 +10798,12 @@ static void apply_plan_to_number(char *buf, size_t size, const struct dahdi_pri
                snprintf(buf, size, "%s", number);
                return;
        }
+       if (ast_strlen_zero(number)) { /* make sure a number exists so prefix isn't placed on an empty string */
+               if (size) {
+                       *buf = '\0';
+               }
+               return;
+       }
        switch (plan) {
        case PRI_INTERNATIONAL_ISDN:            /* Q.931 dialplan == 0x11 international dialplan => prepend international prefix digits */
                snprintf(buf, size, "%s%s", pri->internationalprefix, number);