From c0273110c480275197e5dedbc5650542d3b488d4 Mon Sep 17 00:00:00 2001 From: Jeremy McNamara Date: Mon, 4 Oct 2004 10:18:06 +0000 Subject: [PATCH] a major rework - type=peer support, code cleanup, and optimization. Still not ready to use git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3908 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/h323/ast_h323.cpp | 52 ++++++++++++++++++-------------------- channels/h323/chan_h323.h | 10 +++----- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/channels/h323/ast_h323.cpp b/channels/h323/ast_h323.cpp index 7466682079..cfec7e5c6a 100755 --- a/channels/h323/ast_h323.cpp +++ b/channels/h323/ast_h323.cpp @@ -262,8 +262,9 @@ int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int if (callername) { localAliasNames.RemoveAll(); connection->SetLocalPartyName(PString(callername)); - if (callerid) - localAliasNames.AppendString(PString(callerid)); + if (callerid) { + localAliasNames.AppendString(PString(callerid)); + } } else if (callerid) { localAliasNames.RemoveAll(); connection->SetLocalPartyName(PString(callerid)); @@ -469,20 +470,28 @@ void MyH323EndPoint::OnConnectionCleared(H323Connection & connection, const PStr } -H323Connection * MyH323EndPoint::CreateConnection(unsigned callReference, void *outbound) +H323Connection * MyH323EndPoint::CreateConnection(unsigned callReference, void *o) { unsigned options = 0; + call_options_t *opts = (call_options_t *)o; - if (noFastStart) + if (opts->noFastStart) { options |= H323Connection::FastStartOptionDisable; - else + } else { options |= H323Connection::FastStartOptionEnable; - - if (noH245Tunneling) + } + if (opts->noH245Tunneling) { options |= H323Connection::H245TunnelingOptionDisable; - else + } else { options |= H323Connection::H245TunnelingOptionEnable; - + } +#if 0 + if (opts->noSilenceSuppression) { + options |= H323Connection::SilenceSuppresionOptionDisable; + } else { + options |= H323Connection::SilenceSUppressionOptionEnable; + } +#endif return new MyH323Connection(*this, callReference, options); } @@ -515,9 +524,9 @@ H323Connection::AnswerCallResponse MyH323Connection::OnAnswerCall(const PString if (h323debug) cout << "\t=-= In OnAnswerCall for call " << GetCallReference() << endl; - if (!on_answer_call(GetCallReference(), (const char *)GetCallToken())) + if (!on_answer_call(GetCallReference(), (const char *)GetCallToken())) { return H323Connection::AnswerCallDenied; - + } /* The call will be answered later with "AnsweringCall()" function. */ return H323Connection::AnswerCallDeferred; @@ -716,7 +725,7 @@ void MyH323Connection::SendUserInputTone(char tone, unsigned duration) if (h323debug) { cout << " -- Sending user input tone (" << tone << ") to remote" << endl; } - on_send_digit(GetCallReference(), tone); + on_send_digit(GetCallReference(), tone, (const char *)GetCallToken()); H323Connection::SendUserInputTone(tone, duration); } @@ -726,7 +735,7 @@ void MyH323Connection::OnUserInputTone(char tone, unsigned duration, unsigned lo if (h323debug) { cout << " -- Received user input tone (" << tone << ") from remote" << endl; } - on_send_digit(GetCallReference(), tone); + on_send_digit(GetCallReference(), tone, (const char *)GetCallToken()); } H323Connection::OnUserInputTone(tone, duration, logicalChannel, rtpTimestamp); } @@ -737,7 +746,7 @@ void MyH323Connection::OnUserInputString(const PString &value) if (h323debug) { cout << " -- Received user input string (" << value << ") from remote." << endl; } - on_send_digit(GetCallReference(), value[0]); + on_send_digit(GetCallReference(), value[0], (const char *)GetCallToken()); } } @@ -901,13 +910,9 @@ int h323_end_point_exist(void) return 1; } -void h323_end_point_create(int no_fast_start, int no_h245_tunneling) +void h323_end_point_create(void) { channelsOpen = 0; - - noFastStart = (BOOL)no_fast_start; - noH245Tunneling = (BOOL)no_h245_tunneling; - localProcess = new MyProcess(); localProcess->Main(); } @@ -968,7 +973,7 @@ int h323_set_capability(int cap, int dtmfMode) H323Capabilities oldcaps; PStringArray codecs; int g711Frames = 30; - int gsmFrames = 4; +// int gsmFrames = 4; if (!h323_end_point_exist()) { cout << " ERROR: [h323_set_capablity] No Endpoint, this is bad" << endl; @@ -1320,12 +1325,5 @@ void h323_native_bridge(const char *token, const char *them, char *capability) } -/* set defalt h323 options */ -void h323_set_options(int nofs, int noh245tun) { - noFastStart = nofs; - noH245Tunneling = noh245tun; - return; -} - } /* extern "C" */ diff --git a/channels/h323/chan_h323.h b/channels/h323/chan_h323.h index 0215054f27..928301986f 100755 --- a/channels/h323/chan_h323.h +++ b/channels/h323/chan_h323.h @@ -56,7 +56,7 @@ struct oh323_user { All peers are registered to a GK if there is one */ struct oh323_peer { char name[80]; - char mailbox[AST_MAX_EXTENSION]; + char mailbox[80]; int capability; int noFastStart; int noH245Tunneling; @@ -83,9 +83,8 @@ struct oh323_alias { struct oh323_alias *next; }; -/** call_option struct is filled from the - PBX application and passed through make_call - function*/ +/** call_option struct holds various bits + of information for each call */ typedef struct call_options { char *callerid; char *callername; @@ -168,7 +167,7 @@ extern "C" { #endif void h323_gk_urq(void); - void h323_end_point_create(int, int); + void h323_end_point_create(void); void h323_end_process(void); int h323_end_point_exist(void); @@ -204,7 +203,6 @@ extern "C" { /* H323 create and destroy sessions */ int h323_make_call(char *host, call_details_t *cd, call_options_t); int h323_clear_call(const char *); - void h323_set_options(int nofs, int noh245tun); /* H.323 alerting and progress */ int h323_send_alerting(const char *token);