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
1.2-netsec
Jeremy McNamara 21 years ago
parent 9c65039c32
commit c0273110c4

@ -262,8 +262,9 @@ int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int
if (callername) { if (callername) {
localAliasNames.RemoveAll(); localAliasNames.RemoveAll();
connection->SetLocalPartyName(PString(callername)); connection->SetLocalPartyName(PString(callername));
if (callerid) if (callerid) {
localAliasNames.AppendString(PString(callerid)); localAliasNames.AppendString(PString(callerid));
}
} else if (callerid) { } else if (callerid) {
localAliasNames.RemoveAll(); localAliasNames.RemoveAll();
connection->SetLocalPartyName(PString(callerid)); 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; unsigned options = 0;
call_options_t *opts = (call_options_t *)o;
if (noFastStart) if (opts->noFastStart) {
options |= H323Connection::FastStartOptionDisable; options |= H323Connection::FastStartOptionDisable;
else } else {
options |= H323Connection::FastStartOptionEnable; options |= H323Connection::FastStartOptionEnable;
}
if (noH245Tunneling) if (opts->noH245Tunneling) {
options |= H323Connection::H245TunnelingOptionDisable; options |= H323Connection::H245TunnelingOptionDisable;
else } else {
options |= H323Connection::H245TunnelingOptionEnable; options |= H323Connection::H245TunnelingOptionEnable;
}
#if 0
if (opts->noSilenceSuppression) {
options |= H323Connection::SilenceSuppresionOptionDisable;
} else {
options |= H323Connection::SilenceSUppressionOptionEnable;
}
#endif
return new MyH323Connection(*this, callReference, options); return new MyH323Connection(*this, callReference, options);
} }
@ -515,9 +524,9 @@ H323Connection::AnswerCallResponse MyH323Connection::OnAnswerCall(const PString
if (h323debug) if (h323debug)
cout << "\t=-= In OnAnswerCall for call " << GetCallReference() << endl; 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; return H323Connection::AnswerCallDenied;
}
/* The call will be answered later with "AnsweringCall()" function. /* The call will be answered later with "AnsweringCall()" function.
*/ */
return H323Connection::AnswerCallDeferred; return H323Connection::AnswerCallDeferred;
@ -716,7 +725,7 @@ void MyH323Connection::SendUserInputTone(char tone, unsigned duration)
if (h323debug) { if (h323debug) {
cout << " -- Sending user input tone (" << tone << ") to remote" << endl; 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); H323Connection::SendUserInputTone(tone, duration);
} }
@ -726,7 +735,7 @@ void MyH323Connection::OnUserInputTone(char tone, unsigned duration, unsigned lo
if (h323debug) { if (h323debug) {
cout << " -- Received user input tone (" << tone << ") from remote" << endl; 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); H323Connection::OnUserInputTone(tone, duration, logicalChannel, rtpTimestamp);
} }
@ -737,7 +746,7 @@ void MyH323Connection::OnUserInputString(const PString &value)
if (h323debug) { if (h323debug) {
cout << " -- Received user input string (" << value << ") from remote." << endl; 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; return 1;
} }
void h323_end_point_create(int no_fast_start, int no_h245_tunneling) void h323_end_point_create(void)
{ {
channelsOpen = 0; channelsOpen = 0;
noFastStart = (BOOL)no_fast_start;
noH245Tunneling = (BOOL)no_h245_tunneling;
localProcess = new MyProcess(); localProcess = new MyProcess();
localProcess->Main(); localProcess->Main();
} }
@ -968,7 +973,7 @@ int h323_set_capability(int cap, int dtmfMode)
H323Capabilities oldcaps; H323Capabilities oldcaps;
PStringArray codecs; PStringArray codecs;
int g711Frames = 30; int g711Frames = 30;
int gsmFrames = 4; // int gsmFrames = 4;
if (!h323_end_point_exist()) { if (!h323_end_point_exist()) {
cout << " ERROR: [h323_set_capablity] No Endpoint, this is bad" << endl; 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" */ } /* extern "C" */

@ -56,7 +56,7 @@ struct oh323_user {
All peers are registered to a GK if there is one */ All peers are registered to a GK if there is one */
struct oh323_peer { struct oh323_peer {
char name[80]; char name[80];
char mailbox[AST_MAX_EXTENSION]; char mailbox[80];
int capability; int capability;
int noFastStart; int noFastStart;
int noH245Tunneling; int noH245Tunneling;
@ -83,9 +83,8 @@ struct oh323_alias {
struct oh323_alias *next; struct oh323_alias *next;
}; };
/** call_option struct is filled from the /** call_option struct holds various bits
PBX application and passed through make_call of information for each call */
function*/
typedef struct call_options { typedef struct call_options {
char *callerid; char *callerid;
char *callername; char *callername;
@ -168,7 +167,7 @@ extern "C" {
#endif #endif
void h323_gk_urq(void); void h323_gk_urq(void);
void h323_end_point_create(int, int); void h323_end_point_create(void);
void h323_end_process(void); void h323_end_process(void);
int h323_end_point_exist(void); int h323_end_point_exist(void);
@ -204,7 +203,6 @@ extern "C" {
/* H323 create and destroy sessions */ /* H323 create and destroy sessions */
int h323_make_call(char *host, call_details_t *cd, call_options_t); int h323_make_call(char *host, call_details_t *cd, call_options_t);
int h323_clear_call(const char *); int h323_clear_call(const char *);
void h323_set_options(int nofs, int noh245tun);
/* H.323 alerting and progress */ /* H.323 alerting and progress */
int h323_send_alerting(const char *token); int h323_send_alerting(const char *token);

Loading…
Cancel
Save