]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Port "hasvoicemail" change from SIP to other channel drivers
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 16 Jun 2008 19:50:12 +0000 (19:50 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 16 Jun 2008 19:50:12 +0000 (19:50 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@123113 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_dahdi.c
channels/chan_h323.c
channels/chan_iax2.c
channels/chan_mgcp.c
channels/chan_skinny.c

index f20834181881d68146d6333ab02f6872a03c6dfc..c03981dd58d9b0d9980273ef529a465e285ae71b 100644 (file)
@@ -10656,7 +10656,7 @@ static int build_channels(struct dahdi_chan_conf *conf, int iscrv, const char *v
 /** The length of the parameters list of 'dahdichan'. 
  * \todo Move definition of MAX_CHANLIST_LEN to a proper place. */
 #define MAX_CHANLIST_LEN 80
-static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v, int reload, int skipchannels)
+static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct ast_variable *v, int reload, int skipchannels)
 {
        struct dahdi_pvt *tmp;
        char *ringc; /* temporary string for parsing the dring number. */
@@ -10736,6 +10736,10 @@ static int process_dahdi(struct dahdi_chan_conf *confp, struct ast_variable *v,
                                confp->chan.dtmfrelax = 0;
                } else if (!strcasecmp(v->name, "mailbox")) {
                        ast_copy_string(confp->chan.mailbox, v->value, sizeof(confp->chan.mailbox));
+               } else if (!strcasecmp(v->name, "hasvoicemail")) {
+                       if (ast_true(v->value) && ast_strlen_zero(confp->chan.mailbox)) {
+                               ast_copy_string(confp->chan.mailbox, cat, sizeof(confp->chan.mailbox));
+                       }
                } else if (!strcasecmp(v->name, "adsi")) {
                        confp->chan.adsi = ast_true(v->value);
                } else if (!strcasecmp(v->name, "usesmdi")) {
@@ -11425,7 +11429,7 @@ static int setup_dahdi(int reload)
        memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
 
        v = ast_variable_browse(cfg, "channels");
-       res = process_dahdi(&conf, v, reload, 0);
+       res = process_dahdi(&conf, "", v, reload, 0);
        ast_mutex_unlock(&iflock);
        ast_config_destroy(cfg);
        if (res)
@@ -11434,7 +11438,7 @@ static int setup_dahdi(int reload)
        if (cfg) {
                char *cat;
                const char *chans;
-               process_dahdi(&conf, ast_variable_browse(cfg, "general"), 1, 1);
+               process_dahdi(&conf, "", ast_variable_browse(cfg, "general"), 1, 1);
                for (cat = ast_category_browse(cfg, NULL); cat ; cat = ast_category_browse(cfg, cat)) {
                        if (!strcasecmp(cat, "general"))
                                continue;
@@ -11443,7 +11447,7 @@ static int setup_dahdi(int reload)
                                struct dahdi_chan_conf sect_conf;
                                memcpy(&sect_conf, &conf, sizeof(sect_conf));
 
-                               process_dahdi(&sect_conf, ast_variable_browse(cfg, cat), reload, 0);
+                               process_dahdi(&sect_conf, cat, ast_variable_browse(cfg, cat), reload, 0);
                        }
                }
                ast_config_destroy(cfg);
index 3ae30087635e90b3100d6d44321601159da9d3ab..710ebf37edcff8149744df94230c8b47fa7c8fb8 100644 (file)
@@ -1489,6 +1489,10 @@ static struct oh323_peer *build_peer(const char *name, struct ast_variable *v, s
                        peer->ha = ast_append_ha(v->name, v->value, peer->ha);
                } else if (!strcasecmp(v->name, "mailbox")) {
                        ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox));
+               } else if (!strcasecmp(v->name, "hasvoicemail")) {
+                       if (ast_true(v->value) && ast_strlen_zero(peer->mailbox)) {
+                               ast_copy_string(peer->mailbox, name, sizeof(peer->mailbox));
+                       }
                }
        }
        ASTOBJ_UNMARK(peer);
index 4f40bd28c41a6d00dd0d2a3356f950dae56a743c..1c1c2498131f5aa1b812e18133566227bf77cb0f 100644 (file)
@@ -9347,6 +9347,10 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
                                ast_string_field_set(peer, secret, v->value);
                        } else if (!strcasecmp(v->name, "mailbox")) {
                                ast_string_field_set(peer, mailbox, v->value);
+                       } else if (!strcasecmp(v->name, "hasvoicemail")) {
+                               if (ast_true(v->value) && ast_strlen_zero(peer->mailbox)) {
+                                       ast_string_field_set(peer, mailbox, name);
+                               }
                        } else if (!strcasecmp(v->name, "mohinterpret")) {
                                ast_string_field_set(peer, mohinterpret, v->value);
                        } else if (!strcasecmp(v->name, "mohsuggest")) {
index 0a76c02cdab5c82e9ead1ca3956c8b010d0af515..1d5114bee402534ec6ccb601e856a112b1b9ec22 100644 (file)
@@ -3728,6 +3728,10 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v)
                                canreinvite = ast_true(v->value);
                        } else if (!strcasecmp(v->name, "mailbox")) {
                                ast_copy_string(mailbox, v->value, sizeof(mailbox));
+                       } else if (!strcasecmp(v->name, "hasvoicemail")) {
+                               if (ast_true(v->value) && ast_strlen_zero(mailbox)) {
+                                       ast_copy_string(mailbox, gw->name, sizeof(mailbox));
+                               }
                        } else if (!strcasecmp(v->name, "adsi")) {
                                adsi = ast_true(v->value);
                        } else if (!strcasecmp(v->name, "callreturn")) {
index ee84c666a63faaf6deb4f9b4a8819f3f1ca752e9..2e796e7c4051d3a3b9fc8a79cdedd3c9d5990cf0 100644 (file)
@@ -2202,6 +2202,10 @@ static struct skinny_device *build_device(const char *cat, struct ast_variable *
                                cancallforward = ast_true(v->value);
                        } else if (!strcasecmp(v->name, "mailbox")) {
                                ast_copy_string(mailbox, v->value, sizeof(mailbox));
+                       } else if (!strcasecmp(v->name, "hasvoicemail")) {
+                               if (ast_true(v->value) && ast_strlen_zero(mailbox)) {
+                                       ast_copy_string(mailbox, cat, sizeof(mailbox));
+                               }
                        } else if (!strcasecmp(v->name, "callreturn")) {
                                callreturn = ast_true(v->value);
                        } else if (!strcasecmp(v->name, "callwaiting")) {