mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
Properly deal with E.164 and Prefix routing
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2458 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -886,10 +886,7 @@ int h323_start_listener(int listenPort, struct sockaddr_in bindaddr)
|
||||
|
||||
int h323_set_alias(struct oh323_alias *alias)
|
||||
{
|
||||
char *p;
|
||||
char *num;
|
||||
PString h323id(alias->name);
|
||||
PString e164(alias->e164);
|
||||
|
||||
if (!h323_end_point_exist()) {
|
||||
cout << "ERROR: [h323_set_alias] No Endpoint, this is bad!" << endl;
|
||||
@@ -900,18 +897,26 @@ int h323_set_alias(struct oh323_alias *alias)
|
||||
endPoint->AddAliasName(h323id);
|
||||
endPoint->RemoveAliasName(localProcess->GetUserName());
|
||||
|
||||
if (!e164.IsEmpty()) {
|
||||
cout << " == Adding E.164 \"" << e164 << "\" to endpoint" << endl;
|
||||
endPoint->AddAliasName(e164);
|
||||
}
|
||||
if (strlen(alias->prefix)) {
|
||||
p = alias->prefix;
|
||||
num = strsep(&p, ",");
|
||||
if(alias->e164) {
|
||||
struct e164_number *num = alias->e164;
|
||||
while(num) {
|
||||
cout << " == Adding Prefix \"" << num << "\" to endpoint" << endl;
|
||||
endPoint->SupportedPrefixes += PString(num);
|
||||
endPoint->SetGateway();
|
||||
num = strsep(&p, ",");
|
||||
if(strlen(num->number)) {
|
||||
cout << " == Adding E.164 \"" << num->number << "\" to endpoint" << endl;
|
||||
endPoint->AddAliasName(num->number);
|
||||
}
|
||||
num = num->next;
|
||||
}
|
||||
}
|
||||
|
||||
if(alias->prefix) {
|
||||
struct e164_number *num = alias->prefix;
|
||||
while(num) {
|
||||
if(strlen(num->number)) {
|
||||
cout << " == Adding Prefix \"" << num->number << "\" to endpoint" << endl;
|
||||
endPoint->SupportedPrefixes += PString(num->number);
|
||||
endPoint->SetGateway();
|
||||
}
|
||||
num = num->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -49,14 +49,17 @@ allow=gsm ; Always allow GSM, it's cool :)
|
||||
; Default context gets used in siutations where you are using
|
||||
; the GK routed model or no type=user was found. This gives you
|
||||
; the ability to either play an invalid message or to simply not
|
||||
; use user authentication at all.
|
||||
; use user authentication at all. Also, if a call is accepted for
|
||||
; a prefix or e164 number that cannot be matched to any of the
|
||||
; following sections, it will be sent here.
|
||||
;
|
||||
;context=default
|
||||
;
|
||||
; H.323 Alias definitions
|
||||
;
|
||||
; Type 'h323' will register aliases to the endpoint
|
||||
; and Gatekeeper, if there is one.
|
||||
; and Gatekeeper, if there is one. It will also offer
|
||||
; itself as a gateway for prefixes.
|
||||
;
|
||||
; Example: if someone calls time@your.asterisk.box.com
|
||||
; Asterisk will send the call to the extension 'time'
|
||||
@@ -69,6 +72,11 @@ allow=gsm ; Always allow GSM, it's cool :)
|
||||
; Keyword's 'prefix' and 'e164' are only make sense when
|
||||
; used with a gatekeeper. You can specify either a prefix
|
||||
; or E.164 this endpoint is responsible for terminating.
|
||||
; In the case of a prefix or e164, the context specified
|
||||
; in that section will receive the called extension. E164
|
||||
; numbers are matched before prefixes, so you can have
|
||||
; a prefix covering a general case, and a specific E164 in
|
||||
; another context.
|
||||
;
|
||||
; Example: The H.323 alias 'det-gw' will tell the gatekeeper
|
||||
; to route any call with the prefix 1248 to this alias. Keyword
|
||||
|
Reference in New Issue
Block a user