tomh / rpms / asterisk

Forked from rpms/asterisk 6 years ago
Clone

Blame 0003-Allow-alternate-extensions-to-be-specified-in-users.patch

ad44e41
From 2bc910c60188c668d7ad530a61eeacdac8ac9ee6 Mon Sep 17 00:00:00 2001
729de3c
From: Jeffrey C. Ollie <jcollie@pc21224.campus.dmacc.edu>
729de3c
Date: Thu, 8 Nov 2007 16:32:56 -0600
729de3c
Subject: [PATCH] Allow alternate extensions to be specified in users.conf
729de3c
729de3c
---
729de3c
 pbx/pbx_config.c |   14 ++++++++++++++
729de3c
 1 files changed, 14 insertions(+), 0 deletions(-)
729de3c
729de3c
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
9e6d5d3
index b63fedd..3574d0d 100644
729de3c
--- a/pbx/pbx_config.c
729de3c
+++ b/pbx/pbx_config.c
9e6d5d3
@@ -1562,11 +1562,14 @@ static void pbx_load_users(void)
729de3c
 {
729de3c
 	struct ast_config *cfg;
729de3c
 	char *cat, *chan;
729de3c
+	char *ext;
9e6d5d3
 	const char *dahdichan;
729de3c
 	const char *hasexten;
729de3c
+	const char *altexts;
729de3c
 	char tmp[256];
729de3c
 	char iface[256];
9e6d5d3
 	char dahdicopy[256];
729de3c
+	char altcopy[256];
729de3c
 	char *c;
729de3c
 	int len;
729de3c
 	int hasvoicemail;
9e6d5d3
@@ -1647,6 +1650,17 @@ static void pbx_load_users(void)
729de3c
 			} else {
e712aab
 				ast_add_extension2(con, 0, cat, 1, NULL, NULL, "Dial", strdup("${HINT}"), ast_free_ptr, registrar);
729de3c
 			}
729de3c
+			altexts = ast_variable_retrieve(cfg, cat, "alternateexts");
729de3c
+			if (!ast_strlen_zero(altexts)) {
729de3c
+				snprintf(tmp, sizeof(tmp), "%s|1", cat);
729de3c
+				ast_copy_string(altcopy, altexts, sizeof(altcopy));
729de3c
+				c = altcopy;
729de3c
+				ext = strsep(&c, ",");
729de3c
+				while (ext) {
729de3c
+					ast_add_extension2(con, 0, ext, 1, NULL, NULL, "Goto", strdup(tmp), ast_free, registrar);
729de3c
+					ext = strsep(&c, ",");
729de3c
+				}
729de3c
+			}
729de3c
 		}
729de3c
 	}
729de3c
 	ast_config_destroy(cfg);
729de3c
-- 
ad44e41
1.5.6.5
729de3c