mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-28 18:51:30 +00:00
Merge Matteo's language setting code for iax2 (bug #1476)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2857 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -108,6 +108,8 @@ static char *type = "IAX2";
|
||||
|
||||
static char context[80] = "default";
|
||||
|
||||
static char language[MAX_LANGUAGE] = "";
|
||||
|
||||
static int max_retries = 4;
|
||||
static int ping_time = 20;
|
||||
static int lagrq_time = 10;
|
||||
@@ -189,6 +191,7 @@ struct iax2_user {
|
||||
int authmethods;
|
||||
char accountcode[20];
|
||||
char inkeys[80]; /* Key(s) this user can use to authenticate to us */
|
||||
char language[MAX_LANGUAGE];
|
||||
int amaflags;
|
||||
int hascallerid;
|
||||
int delme;
|
||||
@@ -409,7 +412,7 @@ struct chan_iax2_pvt {
|
||||
/* Private key for outgoing authentication */
|
||||
char outkey[80];
|
||||
/* Preferred language */
|
||||
char language[80];
|
||||
char language[MAX_LANGUAGE];
|
||||
/* Hostname/peername for naming purposes */
|
||||
char host[80];
|
||||
/* Associated registry */
|
||||
@@ -3445,6 +3448,8 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies
|
||||
strncpy(iaxs[callno]->accountcode, user->accountcode, sizeof(iaxs[callno]->accountcode)-1);
|
||||
if (user->amaflags)
|
||||
iaxs[callno]->amaflags = user->amaflags;
|
||||
if (strlen(user->language))
|
||||
strncpy(iaxs[callno]->language, user->language, sizeof(iaxs[callno]->language)-1);
|
||||
iaxs[callno]->notransfer = user->notransfer;
|
||||
res = 0;
|
||||
}
|
||||
@@ -6017,6 +6022,7 @@ static struct iax2_user *build_user(char *name, struct ast_variable *v)
|
||||
memset(user, 0, sizeof(struct iax2_user));
|
||||
user->capability = iax2_capability;
|
||||
strncpy(user->name, name, sizeof(user->name)-1);
|
||||
strcpy(user->language, language);
|
||||
while(v) {
|
||||
if (!strcasecmp(v->name, "context")) {
|
||||
con = build_context(v->value);
|
||||
@@ -6059,6 +6065,8 @@ static struct iax2_user *build_user(char *name, struct ast_variable *v)
|
||||
user->hascallerid=1;
|
||||
} else if (!strcasecmp(v->name, "accountcode")) {
|
||||
strncpy(user->accountcode, v->value, sizeof(user->accountcode)-1);
|
||||
} else if (!strcasecmp(v->name, "language")) {
|
||||
strncpy(user->language, v->value, sizeof(user->language)-1);
|
||||
} else if (!strcasecmp(v->name, "amaflags")) {
|
||||
format = ast_cdr_amaflags2int(v->value);
|
||||
if (format < 0) {
|
||||
@@ -6318,6 +6326,8 @@ static int set_config(char *config_file, struct sockaddr_in* sin){
|
||||
} else if (!strcasecmp(v->name, "dbname")) {
|
||||
strncpy(mydbname, v->value, sizeof(mydbname) - 1);
|
||||
#endif
|
||||
} else if (!strcasecmp(v->name, "language")) {
|
||||
strncpy(language, v->value, sizeof(language) - 1);
|
||||
} //else if (strcasecmp(v->name,"type"))
|
||||
// ast_log(LOG_WARNING, "Ignoring %s\n", v->name);
|
||||
v = v->next;
|
||||
@@ -6380,6 +6390,7 @@ static int reload_config(void)
|
||||
struct sockaddr_in dead_sin;
|
||||
struct iax2_peer *peer;
|
||||
strncpy(accountcode, "", sizeof(accountcode)-1);
|
||||
strncpy(language, "", sizeof(language)-1);
|
||||
amaflags = 0;
|
||||
notransfer = 0;
|
||||
srand(time(NULL));
|
||||
|
@@ -26,6 +26,12 @@
|
||||
;
|
||||
;accountcode=lss0101
|
||||
;
|
||||
; You may specify a global default language for users.
|
||||
; Can be specified also on a per-user basis
|
||||
; If omitted, will fallback to english
|
||||
;
|
||||
;language=en
|
||||
;
|
||||
; Specify bandwidth of low, medium, or high to control which codecs are used
|
||||
; in general.
|
||||
;
|
||||
@@ -148,6 +154,7 @@ permit=216.207.245.47/255.255.255.255
|
||||
;deny=0.0.0.0/0.0.0.0
|
||||
;accountcode=markster0101
|
||||
;permit=209.16.236.73/255.255.255.0
|
||||
;language=en ; Use english as default language
|
||||
;
|
||||
; Peers may also be specified, with a secret and
|
||||
; a remote hostname.
|
||||
|
Reference in New Issue
Block a user