本文整理汇总了C++中SIPClient类的典型用法代码示例。如果您正苦于以下问题:C++ SIPClient类的具体用法?C++ SIPClient怎么用?C++ SIPClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SIPClient类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: timerDHandler
void SIPClient::timerDHandler(void* clientData) {
SIPClient* client = (SIPClient*)clientData;
if (client->fVerbosityLevel >= 1) {
client->envir() << "TIMER D EXPIRED\n";
}
client->doInviteStateMachine(timerDFires);
}
示例2: clientStartPlayingSession
Boolean clientStartPlayingSession(Medium* client,
MediaSession* /*session*/) {
SIPClient* sipClient = (SIPClient*)client;
return sipClient->sendACK();
//##### This isn't quite right, because we should really be allowing
//##### for the possibility of this ACK getting lost, by retransmitting
//##### it *each time* we get a 2xx response from the server.
}
示例3: timerBHandler
void SIPClient::timerBHandler(void* clientData) {
SIPClient* client = (SIPClient*)clientData;
if (client->fVerbosityLevel >= 1) {
client->envir() << "RETRANSMISSION TIMEOUT, after "
<< 64*client->fT1/1000000.0 << " seconds\n";
fflush(stderr);
}
client->doInviteStateMachine(timerBFires);
}
示例4: timerAHandler
void SIPClient::timerAHandler(void* clientData) {
SIPClient* client = (SIPClient*)clientData;
if (client->fVerbosityLevel >= 1) {
client->envir() << "RETRANSMISSION " << ++client->fTimerACount
<< ", after " << client->fTimerALen/1000000.0
<< " additional seconds\n";
}
client->doInviteStateMachine(timerAFires);
}
示例5: getSDPDescriptionFromURL
char* getSDPDescriptionFromURL(Medium* client, char const* url,
char const* username, char const* password,
char const* proxyServerName,
unsigned short proxyServerPortNum,
unsigned short clientStartPortNum) {
SIPClient* sipClient = (SIPClient*)client;
if (proxyServerName != NULL) {
// Tell the SIP client about the proxy:
NetAddressList addresses(proxyServerName);
if (addresses.numAddresses() == 0) {
client->envir() << "Failed to find network address for \""
<< proxyServerName << "\"\n";
} else {
NetAddress address = *(addresses.firstAddress());
unsigned proxyServerAddress // later, allow for IPv6 #####
= *(unsigned*)(address.data());
if (proxyServerPortNum == 0) proxyServerPortNum = 5060; // default
sipClient->setProxyServer(proxyServerAddress, proxyServerPortNum);
}
}
if (clientStartPortNum == 0) clientStartPortNum = 8000; // default
sipClient->setClientStartPortNum(clientStartPortNum);
char* result;
if (username != NULL && password != NULL) {
result = sipClient->inviteWithPassword(url, username, password);
} else {
result = sipClient->invite(url);
}
extern unsigned statusCode;
statusCode = sipClient->inviteStatus();
return result;
}
示例6: getOptionsResponse
char* getOptionsResponse(Medium* client, char const* url,
char* username, char* password) {
SIPClient* sipClient = (SIPClient*)client;
sipClient->envir().setResultMsg("NOT SUPPORTED IN CLIENT");//#####
return NULL;//#####
}
示例7: clientTearDownSession
Boolean clientTearDownSession(Medium* client,
MediaSession* /*session*/) {
if (client == NULL) return False;
SIPClient* sipClient = (SIPClient*)client;
return sipClient->sendBYE();
}
示例8: demux_open_rtp
extern "C" demuxer_t* demux_open_rtp(demuxer_t* demuxer) {
struct MPOpts *opts = demuxer->opts;
Boolean success = False;
do {
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
if (scheduler == NULL) break;
UsageEnvironment* env = BasicUsageEnvironment::createNew(*scheduler);
if (env == NULL) break;
RTSPClient* rtspClient = NULL;
SIPClient* sipClient = NULL;
if (demuxer == NULL || demuxer->stream == NULL) break; // shouldn't happen
demuxer->stream->eof = 0; // just in case
// Look at the stream's 'priv' field to see if we were initiated
// via a SDP description:
char* sdpDescription = (char*)(demuxer->stream->priv);
if (sdpDescription == NULL) {
// We weren't given a SDP description directly, so assume that
// we were given a RTSP or SIP URL:
char const* protocol = demuxer->stream->streaming_ctrl->url->protocol;
char const* url = demuxer->stream->streaming_ctrl->url->url;
extern int verbose;
if (strcmp(protocol, "rtsp") == 0) {
rtspClient = RTSPClient::createNew(*env, verbose, "MPlayer");
if (rtspClient == NULL) {
fprintf(stderr, "Failed to create RTSP client: %s\n",
env->getResultMsg());
break;
}
sdpDescription = openURL_rtsp(rtspClient, url);
} else { // SIP
unsigned char desiredAudioType = 0; // PCMU (use 3 for GSM)
sipClient = SIPClient::createNew(*env, desiredAudioType, NULL,
verbose, "MPlayer");
if (sipClient == NULL) {
fprintf(stderr, "Failed to create SIP client: %s\n",
env->getResultMsg());
break;
}
sipClient->setClientStartPortNum(8000);
sdpDescription = openURL_sip(sipClient, url);
}
if (sdpDescription == NULL) {
fprintf(stderr, "Failed to get a SDP description from URL \"%s\": %s\n",
url, env->getResultMsg());
break;
}
}
// Now that we have a SDP description, create a MediaSession from it:
MediaSession* mediaSession = MediaSession::createNew(*env, sdpDescription);
if (mediaSession == NULL) break;
// Create a 'RTPState' structure containing the state that we just created,
// and store it in the demuxer's 'priv' field, for future reference:
RTPState* rtpState = new RTPState;
rtpState->sdpDescription = sdpDescription;
rtpState->rtspClient = rtspClient;
rtpState->sipClient = sipClient;
rtpState->mediaSession = mediaSession;
rtpState->audioBufferQueue = rtpState->videoBufferQueue = NULL;
rtpState->flags = 0;
rtpState->firstSyncTime.tv_sec = rtpState->firstSyncTime.tv_usec = 0;
demuxer->priv = rtpState;
int audiofound = 0, videofound = 0;
// Create RTP receivers (sources) for each subsession:
MediaSubsessionIterator iter(*mediaSession);
MediaSubsession* subsession;
unsigned desiredReceiveBufferSize;
while ((subsession = iter.next()) != NULL) {
// Ignore any subsession that's not audio or video:
if (strcmp(subsession->mediumName(), "audio") == 0) {
if (audiofound) {
fprintf(stderr, "Additional subsession \"audio/%s\" skipped\n", subsession->codecName());
continue;
}
desiredReceiveBufferSize = 100000;
} else if (strcmp(subsession->mediumName(), "video") == 0) {
if (videofound) {
fprintf(stderr, "Additional subsession \"video/%s\" skipped\n", subsession->codecName());
continue;
}
desiredReceiveBufferSize = 2000000;
} else {
continue;
}
if (rtsp_port)
subsession->setClientPortNum (rtsp_port);
if (!subsession->initiate()) {
fprintf(stderr, "Failed to initiate \"%s/%s\" RTP subsession: %s\n", subsession->mediumName(), subsession->codecName(), env->getResultMsg());
} else {
fprintf(stderr, "Initiated \"%s/%s\" RTP subsession on port %d\n", subsession->mediumName(), subsession->codecName(), subsession->clientPortNum());
//.........这里部分代码省略.........
示例9: inviteResponseHandler
void SIPClient::inviteResponseHandler(void* clientData, int /*mask*/) {
SIPClient* client = (SIPClient*)clientData;
unsigned responseCode = client->getResponseCode();
client->doInviteStateMachine(responseCode);
}