diff options
author | Jeremy McNamara <jj@nufone.net> | 2004-03-18 20:39:15 +0000 |
---|---|---|
committer | Jeremy McNamara <jj@nufone.net> | 2004-03-18 20:39:15 +0000 |
commit | d3b2cb19e480fd0fb115afb22dab0bcd18dc7c10 (patch) | |
tree | 95e033a5a85386fd2f94f5665df2184d2504419c /channels/h323 | |
parent | e7ecf6accb950c00454aa887681287556eb7181b (diff) |
Properly deal with E.164 and Prefix routing
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2458 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/h323')
-rwxr-xr-x | channels/h323/ast_h323.cpp | 31 | ||||
-rwxr-xr-x | channels/h323/h323.conf.sample | 12 |
2 files changed, 28 insertions, 15 deletions
diff --git a/channels/h323/ast_h323.cpp b/channels/h323/ast_h323.cpp index 44e816350..e55b93825 100755 --- a/channels/h323/ast_h323.cpp +++ b/channels/h323/ast_h323.cpp @@ -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(alias->e164) { + struct e164_number *num = alias->e164; + while(num) { + if(strlen(num->number)) { + cout << " == Adding E.164 \"" << num->number << "\" to endpoint" << endl; + endPoint->AddAliasName(num->number); + } + num = num->next; + } } - if (strlen(alias->prefix)) { - p = alias->prefix; - num = strsep(&p, ","); + + if(alias->prefix) { + struct e164_number *num = alias->prefix; while(num) { - cout << " == Adding Prefix \"" << num << "\" to endpoint" << endl; - endPoint->SupportedPrefixes += PString(num); - endPoint->SetGateway(); - num = strsep(&p, ","); + if(strlen(num->number)) { + cout << " == Adding Prefix \"" << num->number << "\" to endpoint" << endl; + endPoint->SupportedPrefixes += PString(num->number); + endPoint->SetGateway(); + } + num = num->next; } } diff --git a/channels/h323/h323.conf.sample b/channels/h323/h323.conf.sample index 811647a08..8d1e6559b 100755 --- a/channels/h323/h323.conf.sample +++ b/channels/h323/h323.conf.sample @@ -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 |