#include "playCommon.hh"#include "SIPClient.hh"Include dependency graph for playSIP.cpp:

Go to the source code of this file.
Functions | |
| Medium * | createClient (UsageEnvironment &env, char const *, int verbosityLevel, char const *applicationName) |
| void | getOptions (RTSPClient::responseHandler *afterFunc) |
| void | getSDPDescription (RTSPClient::responseHandler *afterFunc) |
| void | setupSubsession (MediaSubsession *subsession, Boolean, RTSPClient::responseHandler *afterFunc) |
| void | startPlayingSession (MediaSession *, double, double, float, RTSPClient::responseHandler *afterFunc) |
| void | tearDownSession (MediaSession *, RTSPClient::responseHandler *afterFunc) |
Variables | |
| SIPClient * | ourSIPClient = NULL |
| Boolean | allowProxyServers = True |
| Boolean | controlConnectionUsesTCP = False |
| Boolean | supportCodecSelection = True |
| char const * | clientProtocolName = "SIP" |
| Medium* createClient | ( | UsageEnvironment & | env, | |
| char const * | , | |||
| int | verbosityLevel, | |||
| char const * | applicationName | |||
| ) |
Definition at line 24 of file playSIP.cpp.
References RTSPClient::createNew(), SIPClient::createNew(), desiredAudioRTPPayloadFormat, env, mimeSubtype, ourRTSPClient, ourSIPClient, and tunnelOverHTTPPortNum.
00024 { 00025 // First, trim any directory prefixes from "applicationName": 00026 char const* suffix = &applicationName[strlen(applicationName)]; 00027 while (suffix != applicationName) { 00028 if (*suffix == '/' || *suffix == '\\') { 00029 applicationName = ++suffix; 00030 break; 00031 } 00032 --suffix; 00033 } 00034 00035 extern unsigned char desiredAudioRTPPayloadFormat; 00036 extern char* mimeSubtype; 00037 return ourSIPClient = SIPClient::createNew(env, desiredAudioRTPPayloadFormat, mimeSubtype, verbosityLevel, applicationName); 00038 }
| void getOptions | ( | RTSPClient::responseHandler * | afterFunc | ) |
Definition at line 40 of file playSIP.cpp.
References Medium::envir(), UsageEnvironment::getResultMsg(), NULL, ourAuthenticator, ourRTSPClient, ourSIPClient, RTSPClient::sendOptionsCommand(), UsageEnvironment::setResultMsg(), and strDup().
00040 { 00041 ourSIPClient->envir().setResultMsg("NOT SUPPORTED IN CLIENT"); 00042 afterFunc(NULL, -1, strDup(ourSIPClient->envir().getResultMsg())); 00043 }
| void getSDPDescription | ( | RTSPClient::responseHandler * | afterFunc | ) |
Definition at line 45 of file playSIP.cpp.
References NetAddress::data(), desiredPortNum, Medium::envir(), NetAddressList::firstAddress(), SIPClient::invite(), SIPClient::inviteWithPassword(), NULL, NetAddressList::numAddresses(), ourAuthenticator, ourRTSPClient, ourSIPClient, Authenticator::password(), password, proxyServerName, proxyServerPortNum, RTSPClient::sendDescribeCommand(), SIPClient::setClientStartPortNum(), SIPClient::setProxyServer(), strDup(), streamURL, Authenticator::username(), and username.
00045 { 00046 extern char* proxyServerName; 00047 if (proxyServerName != NULL) { 00048 // Tell the SIP client about the proxy: 00049 NetAddressList addresses(proxyServerName); 00050 if (addresses.numAddresses() == 0) { 00051 ourSIPClient->envir() << "Failed to find network address for \"" << proxyServerName << "\"\n"; 00052 } else { 00053 NetAddress address = *(addresses.firstAddress()); 00054 unsigned proxyServerAddress // later, allow for IPv6 ##### 00055 = *(unsigned*)(address.data()); 00056 extern unsigned short proxyServerPortNum; 00057 if (proxyServerPortNum == 0) proxyServerPortNum = 5060; // default 00058 00059 ourSIPClient->setProxyServer(proxyServerAddress, proxyServerPortNum); 00060 } 00061 } 00062 00063 extern unsigned short desiredPortNum; 00064 unsigned short clientStartPortNum = desiredPortNum; 00065 if (clientStartPortNum == 0) clientStartPortNum = 8000; // default 00066 ourSIPClient->setClientStartPortNum(clientStartPortNum); 00067 00068 extern char const* streamURL; 00069 char const* username = ourAuthenticator->username(); 00070 char const* password = ourAuthenticator->password(); 00071 char* result; 00072 if (username != NULL && password != NULL) { 00073 result = ourSIPClient->inviteWithPassword(streamURL, username, password); 00074 } else { 00075 result = ourSIPClient->invite(streamURL); 00076 } 00077 00078 int resultCode = result == NULL ? -1 : 0; 00079 afterFunc(NULL, resultCode, strDup(result)); 00080 }
| void setupSubsession | ( | MediaSubsession * | subsession, | |
| Boolean | , | |||
| RTSPClient::responseHandler * | afterFunc | |||
| ) |
Definition at line 82 of file playSIP.cpp.
References False, NULL, ourAuthenticator, ourRTSPClient, RTSPClient::sendSetupCommand(), MediaSubsession::setSessionId(), and subsession.
00082 { 00083 subsession->setSessionId("mumble"); // anything that's non-NULL will work 00084 00085 afterFunc(NULL, 0, NULL); 00086 }
| void startPlayingSession | ( | MediaSession * | , | |
| double | , | |||
| double | , | |||
| float | , | |||
| RTSPClient::responseHandler * | afterFunc | |||
| ) |
Definition at line 88 of file playSIP.cpp.
References Medium::envir(), UsageEnvironment::getResultMsg(), NULL, ourAuthenticator, ourRTSPClient, ourSIPClient, SIPClient::sendACK(), RTSPClient::sendPlayCommand(), session, and strDup().
00088 { 00089 if (ourSIPClient->sendACK()) { 00090 //##### This isn't quite right, because we should really be allowing 00091 //##### for the possibility of this ACK getting lost, by retransmitting 00092 //##### it *each time* we get a 2xx response from the server. 00093 afterFunc(NULL, 0, NULL); 00094 } else { 00095 afterFunc(NULL, -1, strDup(ourSIPClient->envir().getResultMsg())); 00096 } 00097 }
| void tearDownSession | ( | MediaSession * | , | |
| RTSPClient::responseHandler * | afterFunc | |||
| ) |
Definition at line 99 of file playSIP.cpp.
References Medium::envir(), UsageEnvironment::getResultMsg(), NULL, ourAuthenticator, ourRTSPClient, ourSIPClient, SIPClient::sendBYE(), RTSPClient::sendTeardownCommand(), session, and strDup().
00099 { 00100 if (ourSIPClient == NULL || ourSIPClient->sendBYE()) { 00101 afterFunc(NULL, 0, NULL); 00102 } else { 00103 afterFunc(NULL, -1, strDup(ourSIPClient->envir().getResultMsg())); 00104 } 00105 }
Definition at line 107 of file playSIP.cpp.
| char const* clientProtocolName = "SIP" |
Definition at line 110 of file playSIP.cpp.
Definition at line 108 of file playSIP.cpp.
| SIPClient* ourSIPClient = NULL |
Definition at line 23 of file playSIP.cpp.
Referenced by createClient(), getOptions(), getSDPDescription(), startPlayingSession(), and tearDownSession().
Definition at line 109 of file playSIP.cpp.
1.5.2