BOOL MyH323Connection::OnAlerting(const H323SignalPDU & alertingPDU, const PString & username) { if (h323debug) { cout << "\t=-= In OnAlerting for call " << GetCallReference() << ": sessionId=" << sessionId << endl; cout << "\t-- Ringing phone for \"" << username << "\"" << endl; } if (on_progress) { BOOL isInband; unsigned alertingPI; if (!alertingPDU.GetQ931().GetProgressIndicator(alertingPI)) { alertingPI = 0; } if (h323debug) { cout << "\t\t- Progress Indicator: " << alertingPI << endl; } switch(alertingPI) { case Q931::ProgressNotEndToEndISDN: case Q931::ProgressInbandInformationAvailable: isInband = TRUE; break; default: isInband = FALSE; } on_progress(GetCallReference(), (const char *)GetCallToken(), isInband); } on_chan_ringing(GetCallReference(), (const char *)GetCallToken() ); return connectionState != ShuttingDownConnection; }
BOOL MyH323Connection::OnAlerting(const H323SignalPDU & /*alertingPDU*/, const PString & username) { PIPSocket::Address remoteIpAddress; WORD remotePort; H323_ExternalRTPChannel * channel; if (h323debug) cout << "\t =-= In OnAlerting for call " << GetCallReference() << ": sessionId=" << sessionId << endl; /* Connect RTP if logical channel has already been opened */ if (Lock()) { if ( (channel = (H323_ExternalRTPChannel*) FindChannel(sessionId,TRUE)) ) { channel->GetRemoteAddress(remoteIpAddress, remotePort); if (h323debug) { cout << "\t\t--- found logical channel. Connecting RTP" << endl; cout << "\t\tRTP channel id " << sessionId << " parameters:" << endl; cout << "\t\t-- remoteIpAddress: " << remoteIpAddress << endl; cout << "\t\t-- remotePort: " << remotePort << endl; cout << "\t\t-- ExternalIpAddress: " << externalIpAddress << endl; cout << "\t\t-- ExternalPort: " << externalPort << endl; } on_start_logical_channel(GetCallReference(),(const char *)remoteIpAddress.AsString(), remotePort, (const char *)GetCallToken() ); AST_RTP_Connected=TRUE; } else if (h323debug) cout << "\t\t--- no logical channels" << endl; if (h323debug) { cout << " -- Ringing phone for \"" << username << "\"" << endl; } on_chan_ringing(GetCallReference(), (const char *)GetCallToken() ); Unlock(); return TRUE; } ast_log(LOG_ERROR,"chan_h323: OnAlerting: Could not obtain connection lock"); return FALSE; }